diff --git a/code/api.odin b/code/api.odin index baa822b..c28384e 100644 --- a/code/api.odin +++ b/code/api.odin @@ -75,7 +75,7 @@ startup :: proc( live_mem : virtual.Arena, snapshot_mem : []u8, host_logger : ^ rl.SetConfigFlags( { rl.ConfigFlag.WINDOW_RESIZABLE, - rl.ConfigFlag.WINDOW_TOPMOST, + // rl.ConfigFlag.WINDOW_TOPMOST, }) // Rough setup of window with rl stuff @@ -108,7 +108,7 @@ startup :: proc( live_mem : virtual.Arena, snapshot_mem : []u8, host_logger : ^ // path_squidgy_slimes := strings.concatenate( { Path_Assets, "Squidgy Slimes.ttf" } ) // font_squidgy_slimes = font_load( path_squidgy_slimes, 24.0, "Squidgy_Slime" ) - path_firacode := strings.concatenate( { Path_Assets, "FiraCode-Regular.ttf" } ) + path_firacode := strings.concatenate( { Path_Assets, "FiraCode-Regular.ttf" }, temp_allocator() ) font_firacode = font_load( path_firacode, 24.0, "FiraCode" ) // font_data, read_succeded : = os.read_entire_file( path_rec_mono_semicasual_reg ) diff --git a/code/grime_array.odin b/code/grime_array.odin index d093215..f89338c 100644 --- a/code/grime_array.odin +++ b/code/grime_array.odin @@ -25,10 +25,14 @@ array_underlying_slice :: proc(slice: []($ Type)) -> Array(Type) { return array_ptr ^ } -array_to_slice :: proc( using self : Array($ Type) ) -> []Type { +array_to_slice_num :: proc( using self : Array($ Type) ) -> []Type { return slice_ptr( data, int(num) ) } +array_to_slice :: proc( using self : Array($ Type) ) -> []Type { + return slice_ptr( data, int(capacity)) +} + array_grow_formula :: proc( value : u64 ) -> u64 { return 2 * value + 8 } @@ -41,7 +45,7 @@ array_init_reserve :: proc( $ Type : typeid, allocator : Allocator, capacity : u { raw_data, result_code := alloc( size_of(Array) + int(capacity) * size_of(Type), allocator = allocator ) result := cast(^Array(Type)) raw_data; - result.data = cast( [^]Type ) ptr_offset( result, 1 ) + result.data = cast( [^]Type ) (cast( [^]Array(Type)) result)[ 1:] result.allocator = allocator result.capacity = capacity return (result ^), result_code diff --git a/code/grime_hashmap_zpl.odin b/code/grime_hashmap_zpl.odin index 51151cb..b4de906 100644 --- a/code/grime_hashmap_zpl.odin +++ b/code/grime_hashmap_zpl.odin @@ -45,14 +45,12 @@ zpl_hmap_init_reserve :: proc( $ Type : typeid, allocator : Allocator, num : u64 result : HMapZPL(Type) hashes_result, entries_result : AllocatorError - hashes_size := cast(u64) (HMapZPL_HashToEntryRatio * f32(num)) - - result.hashes, hashes_result = array_init_reserve( i64, allocator, hashes_size ) + result.hashes, hashes_result = array_init_reserve( i64, allocator, num ) if hashes_result != AllocatorError.None { ensure( false, "Failed to allocate hashes array" ) return result, hashes_result } - array_resize( & result.hashes, hashes_size ) + array_resize( & result.hashes, num ) slice.fill( slice_ptr( result.hashes.data, cast(int) result.hashes.num), -1 ) result.entries, entries_result = array_init_reserve( HMapZPL_Entry(Type), allocator, num ) diff --git a/code/text.odin b/code/text.odin index fb0bcb3..399a7de 100644 --- a/code/text.odin +++ b/code/text.odin @@ -12,7 +12,7 @@ debug_draw_text :: proc( content : string, pos : Vec2, size : f32, color : rl.Co return } runes, alloc_error := to_runes( content, context.temp_allocator ) - verify( alloc_error != AllocatorError.None, "Failed to temp allocate runes" ) + verify( alloc_error == AllocatorError.None, "Failed to temp allocate runes" ) font := font if font.key == Font_Default.key { @@ -40,7 +40,7 @@ debug_draw_text_world :: proc( content : string, pos : Vec2, size : f32, color : return } runes, alloc_error := to_runes( content, context.temp_allocator ) - verify( alloc_error != AllocatorError.None, "Failed to temp allocate runes" ) + verify( alloc_error == AllocatorError.None, "Failed to temp allocate runes" ) font := font if font.key == Font_Default.key { diff --git a/code/tick_update.odin b/code/tick_update.odin index 27d2ae5..7c1e36e 100644 --- a/code/tick_update.odin +++ b/code/tick_update.odin @@ -217,7 +217,7 @@ update :: proc( delta_time : f64 ) -> b32 ui_set_layout( first_layout ) // First Demo - when false + when true { first_flags : UI_BoxFlags = { .Mouse_Clickable, .Focusable, .Click_To_Focus } first_box := ui_box_make( first_flags, "FIRST BOX BOIS" )