| 1 | module gg |
| 2 | |
| 3 | import sokol.sgl |
| 4 | |
| 5 | // Stuff for ui from now for screenshot (that would be interesting for gg if screenshot is implemented also for gg) |
| 6 | |
| 7 | // required for ui.DrawDevice interface (with &gg.Context as an instance) |
| 8 | pub fn (ctx &Context) scissor_rect(x int, y int, w int, h int) { |
| 9 | sgl.scissor_rect(int(ctx.scale * x), int(ctx.scale * y), int(ctx.scale * w), |
| 10 | int(ctx.scale * h), true) |
| 11 | } |
| 12 | |
| 13 | // empty function |
| 14 | pub fn (ctx &Context) has_text_style() bool { |
| 15 | return false |
| 16 | } |
| 17 | |
| 18 | // empty function |
| 19 | pub fn (ctx &Context) set_text_style(font_name string, font_path string, size int, color Color, align int, |
| 20 | vertical_align int) { |
| 21 | } |
| 22 | |
| 23 | // default draw_text (draw_text_def but without set_text_cfg) |
| 24 | pub fn (ctx &Context) draw_text_default(x int, y int, text string) { |
| 25 | scale := if ctx.ft.scale == 0 { f32(1) } else { ctx.ft.scale } |
| 26 | ctx.ft.fons.draw_text(x * scale, y * scale, text) // TODO: check offsets/alignment |
| 27 | } |
| 28 | |