Recalculate Font on window resize
This commit is contained in:
+11
-7
@@ -114,7 +114,8 @@ camera_convert_screen_to_world :: proc {
|
||||
camera_convert_world_to_screen :: proc(
|
||||
cam : ^Camera,
|
||||
pw : [2]f32,
|
||||
) -> [2]f32 {
|
||||
) -> [2]f32
|
||||
{
|
||||
cam := cam
|
||||
pw := pw
|
||||
|
||||
@@ -1353,6 +1354,7 @@ Draw :: struct
|
||||
|
||||
//There should be option to draw without glyph? maybe
|
||||
glyph : e2_glyph.GlyphState,
|
||||
font_path : string,
|
||||
|
||||
texts : [dynamic]TextItem,
|
||||
}
|
||||
@@ -1413,20 +1415,20 @@ DrawStringVec :: proc(draw : ^Draw, p : [2]f32, cstr: cstring)
|
||||
str = strings.trim_right_space(str)
|
||||
str = strings.trim_null(str)
|
||||
|
||||
|
||||
append(&draw.texts, TextItem{str, {f32(ps.x), f32(ps.y)}, {200,200,200,255}})
|
||||
}
|
||||
|
||||
text_flush :: proc(draw: ^Draw)
|
||||
|
||||
text_flush :: proc(draw: ^Draw, flush_glyph := false)
|
||||
{
|
||||
for &t in &draw.texts{
|
||||
e2_glyph.glyph_draw_font(&draw.glyph, t.str, t.pos, t.color)
|
||||
e2_glyph.glyph_draw_font(&draw.glyph, t.str, t.pos, t.color, flush_glyph)
|
||||
}
|
||||
|
||||
clear(&draw.texts)
|
||||
}
|
||||
|
||||
draw_flush :: proc(draw : ^Draw) {
|
||||
draw_flush :: proc(draw : ^Draw, flush_glyph := false) {
|
||||
|
||||
//background_draw(&draw.background, &draw.cam)
|
||||
|
||||
@@ -1437,7 +1439,7 @@ draw_flush :: proc(draw : ^Draw) {
|
||||
points_flush(&draw.points, &draw.cam)
|
||||
circle_flush(&draw.circles, &draw.cam)
|
||||
textures_flush(draw)
|
||||
text_flush(draw)
|
||||
text_flush(draw, flush_glyph)
|
||||
|
||||
check_opengl()
|
||||
}
|
||||
@@ -1596,7 +1598,9 @@ draw_create :: proc(draw : ^Draw, camera : ^Camera, font_path : string = "")
|
||||
draw.glyph.width = draw.cam.width
|
||||
draw.glyph.height = draw.cam.height
|
||||
|
||||
e2_glyph.glyph_init(&draw.glyph, font_path)
|
||||
draw.font_path = font_path
|
||||
|
||||
e2_glyph.glyph_init(&draw.glyph, draw.font_path)
|
||||
}
|
||||
|
||||
check_opengl()
|
||||
|
||||
Reference in New Issue
Block a user