--- /dev/null
+info face="M+ 2m Nerd Font Complete" size=16 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=-2,-2
+common lineHeight=24 base=18 scaleW=128 scaleH=128 pages=1 packed=0
+page id=0 file="builtin.png"
+chars count=97
+char id=0 x=95 y=63 width=7 height=13 xoffset=-1 yoffset=6 xadvance=6 page=0 chnl=0
+char id=10 x=95 y=63 width=7 height=13 xoffset=-1 yoffset=6 xadvance=6 page=0 chnl=0
+char id=32 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=17 xadvance=8 page=0 chnl=0
+char id=33 x=121 y=35 width=5 height=14 xoffset=2 yoffset=5 xadvance=8 page=0 chnl=0
+char id=34 x=28 y=88 width=6 height=7 xoffset=1 yoffset=4 xadvance=8 page=0 chnl=0
+char id=35 x=75 y=63 width=9 height=14 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=0
+char id=36 x=61 y=0 width=9 height=18 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=0
+char id=37 x=64 y=63 width=11 height=14 xoffset=-1 yoffset=5 xadvance=9 page=0 chnl=0
+char id=38 x=84 y=63 width=11 height=14 xoffset=-1 yoffset=5 xadvance=9 page=0 chnl=0
+char id=39 x=40 y=88 width=4 height=7 xoffset=2 yoffset=4 xadvance=8 page=0 chnl=0
+char id=40 x=12 y=0 width=8 height=18 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=0
+char id=41 x=20 y=0 width=8 height=18 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=0
+char id=42 x=10 y=88 width=10 height=9 xoffset=-1 yoffset=4 xadvance=9 page=0 chnl=0
+char id=43 x=119 y=77 width=8 height=10 xoffset=0 yoffset=8 xadvance=8 page=0 chnl=0
+char id=44 x=44 y=88 width=6 height=7 xoffset=1 yoffset=14 xadvance=8 page=0 chnl=0
+char id=45 x=64 y=88 width=7 height=4 xoffset=1 yoffset=11 xadvance=9 page=0 chnl=0
+char id=46 x=50 y=88 width=5 height=5 xoffset=2 yoffset=14 xadvance=8 page=0 chnl=0
+char id=47 x=49 y=20 width=10 height=15 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=48 x=38 y=63 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=49 x=83 y=49 width=8 height=14 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=0
+char id=50 x=91 y=49 width=8 height=14 xoffset=0 yoffset=5 xadvance=7 page=0 chnl=0
+char id=51 x=99 y=49 width=9 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=52 x=108 y=49 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=53 x=118 y=49 width=9 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=54 x=0 y=63 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=55 x=10 y=63 width=8 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=56 x=18 y=63 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=57 x=28 y=63 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=58 x=114 y=77 width=5 height=11 xoffset=1 yoffset=8 xadvance=7 page=0 chnl=0
+char id=59 x=58 y=63 width=6 height=14 xoffset=0 yoffset=8 xadvance=7 page=0 chnl=0
+char id=60 x=102 y=63 width=8 height=13 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=0
+char id=61 x=20 y=88 width=8 height=8 xoffset=0 yoffset=9 xadvance=8 page=0 chnl=0
+char id=62 x=110 y=63 width=8 height=13 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=0
+char id=63 x=48 y=63 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=64 x=80 y=0 width=10 height=16 xoffset=-1 yoffset=6 xadvance=8 page=0 chnl=0
+char id=65 x=69 y=20 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=66 x=79 y=20 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=67 x=89 y=20 width=9 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=68 x=98 y=20 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=69 x=108 y=20 width=9 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=70 x=117 y=20 width=9 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=71 x=0 y=35 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=72 x=10 y=35 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=73 x=20 y=35 width=7 height=14 xoffset=0 yoffset=5 xadvance=7 page=0 chnl=0
+char id=74 x=27 y=35 width=9 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=75 x=36 y=35 width=9 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=76 x=45 y=35 width=8 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=77 x=53 y=35 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=78 x=63 y=35 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=79 x=73 y=35 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=80 x=83 y=35 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=81 x=70 y=0 width=10 height=17 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=82 x=93 y=35 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=83 x=103 y=35 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=84 x=113 y=35 width=8 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=85 x=0 y=49 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=86 x=10 y=49 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=87 x=20 y=49 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=88 x=30 y=49 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=89 x=40 y=49 width=10 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=90 x=50 y=49 width=8 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=91 x=28 y=0 width=7 height=18 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0
+char id=92 x=59 y=20 width=10 height=15 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=93 x=35 y=0 width=8 height=18 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0
+char id=94 x=0 y=88 width=10 height=10 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0
+char id=95 x=71 y=88 width=10 height=4 xoffset=-1 yoffset=18 xadvance=8 page=0 chnl=0
+char id=96 x=34 y=88 width=6 height=7 xoffset=1 yoffset=3 xadvance=8 page=0 chnl=0
+char id=97 x=0 y=77 width=10 height=11 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=98 x=90 y=0 width=10 height=15 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0
+char id=99 x=118 y=63 width=9 height=11 xoffset=0 yoffset=8 xadvance=9 page=0 chnl=0
+char id=100 x=100 y=0 width=10 height=15 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0
+char id=101 x=10 y=77 width=10 height=11 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=102 x=58 y=49 width=8 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=103 x=110 y=0 width=10 height=15 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=104 x=0 y=20 width=10 height=15 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0
+char id=105 x=120 y=0 width=7 height=15 xoffset=1 yoffset=4 xadvance=8 page=0 chnl=0
+char id=106 x=5 y=0 width=7 height=19 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0
+char id=107 x=10 y=20 width=9 height=15 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0
+char id=108 x=66 y=49 width=9 height=14 xoffset=-1 yoffset=5 xadvance=8 page=0 chnl=0
+char id=109 x=20 y=77 width=11 height=11 xoffset=-1 yoffset=8 xadvance=9 page=0 chnl=0
+char id=110 x=31 y=77 width=10 height=11 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=111 x=41 y=77 width=10 height=11 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=112 x=19 y=20 width=10 height=15 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=113 x=29 y=20 width=10 height=15 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=114 x=51 y=77 width=8 height=11 xoffset=0 yoffset=8 xadvance=8 page=0 chnl=0
+char id=115 x=59 y=77 width=9 height=11 xoffset=0 yoffset=8 xadvance=8 page=0 chnl=0
+char id=116 x=75 y=49 width=8 height=14 xoffset=0 yoffset=5 xadvance=8 page=0 chnl=0
+char id=117 x=68 y=77 width=9 height=11 xoffset=-1 yoffset=8 xadvance=7 page=0 chnl=0
+char id=118 x=77 y=77 width=10 height=11 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=119 x=87 y=77 width=10 height=11 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=120 x=97 y=77 width=10 height=11 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=121 x=39 y=20 width=10 height=15 xoffset=-1 yoffset=8 xadvance=8 page=0 chnl=0
+char id=122 x=107 y=77 width=7 height=11 xoffset=0 yoffset=8 xadvance=7 page=0 chnl=0
+char id=123 x=43 y=0 width=9 height=18 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0
+char id=124 x=0 y=0 width=5 height=20 xoffset=2 yoffset=3 xadvance=8 page=0 chnl=0
+char id=125 x=52 y=0 width=9 height=18 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=0
+char id=126 x=55 y=88 width=9 height=5 xoffset=0 yoffset=11 xadvance=8 page=0 chnl=0
+kernings count=0
#private active_item : UI_Id = 0
#private hot_item_was_set := false
-#private current_font : Font;
+#private current_font : ^Font;
init_ui :: () {
+ map.init(^font_registry, hash_count=4);
+
map.init(^animation_states, default=.{}, hash_count=4);
map.init(^workspace_states, default=.{}, hash_count=4);
- map.init(^font_registry, hash_count=4);
+ // Register a default font so things don't break everywhere
+ builtin_font := create_font(#file_contents "./fonts/builtin.fnt", #file_contents "./fonts/builtin.data");
+ register_font(-1, builtin_font);
+ use_font(-1);
}
// This function should be called at the end of drawing a frame, after all of the UI elements
}
@FontSizing // In the new font system, size is in ems, which can be set per font.
-draw_text_raw :: (text: str, x: f32, y: f32, size := DEFAULT_TEXT_SIZE, color := gfx.Color4.{1,1,1}) {
+draw_text_raw :: (text: str, x: f32, y: f32, font: i32 = -1, size := DEFAULT_TEXT_SIZE, color := gfx.Color4.{1,1,1}) {
+ use_font(font);
+ if current_font == null do use_font(-1);
current_font->render(text, x, y, size, color);
}
}
draw_text :: (use r: Rectangle, text: str, theme := ^default_text_theme, site := #callsite) -> bool {
- draw_text_raw(text, x0, y0 + current_font->get_baseline(theme.font_size), theme.font_size, theme.text_color);
+ draw_text_raw(text, x0, y0 + current_font->get_baseline(theme.font_size), theme.font, theme.font_size, theme.text_color);
}
Rectangle :: struct {