Console works again | UI crash fixes

This commit is contained in:
2024-12-22 00:49:35 +01:00
parent 664626c838
commit f8b540f583
7 changed files with 119 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
MAX_VERT_BUFFERS :: 64;
MAX_BOXES :: 4096;
UI_Box_Flags :: enum_flags u32 {
NONE :: 0;
@@ -264,7 +265,7 @@ ui_init :: () {
ui_state.colored_verts.allocator = ui_state.allocator;
ui_state.boxes.allocator = ui_state.allocator;
init(*ui_state.boxes, 1024);
init(*ui_state.boxes, MAX_BOXES);
ui_state.sampler = create_sampler(engine.renderer);
ui_state.fonts.regular = create_font(engine.renderer, "../assets/fonts/roboto/Roboto-Regular.ttf", 14);
@@ -720,6 +721,7 @@ get_ui_box_or_create_new :: (hash: u32) -> *UI_Box, bool {
ptr := table_find_pointer(*ui_state.boxes, hash);
if ptr == null {
assert(ui_state.boxes.count < MAX_BOXES);
table_add(*ui_state.boxes, hash, .{});
ptr = table_find_pointer(*ui_state.boxes, hash);
}