diff --git a/Debug.rdbg b/Debug.rdbg index 91175ec..0d575e0 100644 Binary files a/Debug.rdbg and b/Debug.rdbg differ diff --git a/code/api.odin b/code/api.odin index adbed6c..e93b823 100644 --- a/code/api.odin +++ b/code/api.odin @@ -23,18 +23,20 @@ ModuleAPI :: struct { Memory :: struct { persistent : ^ mem.Arena, - transient : ^ mem.Arena + transient : ^ mem.Arena, + temp : ^ mem.Arena } memory : Memory @export -startup :: proc( persistent, transient : ^ mem.Arena ) +startup :: proc( persistent, transient, temp : ^ mem.Arena ) { - memory.persistent = persistent - memory.transient = transient + memory.persistent = persistent + + // Anything allocated by default is considered transient. context.allocator = mem.arena_allocator( transient ) - context.temp_allocator = mem.arena_allocator( transient ) + context.temp_allocator = mem.arena_allocator( temp ) state := cast(^State) memory.persistent @@ -53,7 +55,7 @@ startup :: proc( persistent, transient : ^ mem.Arena ) // Basic Font Setup { path_rec_mono_semicasual_reg := strings.concatenate( { Path_Assets, "RecMonoSemicasual-Regular-1.084.ttf" }) - cstr := strings.clone_to_cstring(path_rec_mono_semicasual_reg) + cstr := strings.clone_to_cstring( path_rec_mono_semicasual_reg ) font_rec_mono_semicasual_reg = rl.LoadFontEx( cstr, 24, nil, 0 ) delete( cstr) @@ -71,7 +73,7 @@ sectr_shutdown :: proc() } @export -reload :: proc( persistent, transient : ^ mem.Arena ) +reload :: proc( persistent, transient, temp : ^ mem.Arena ) { memory.persistent = persistent memory.transient = transient diff --git a/code/host/host.odin b/code/host/host.odin index 401f4ef..c190c07 100644 --- a/code/host/host.odin +++ b/code/host/host.odin @@ -33,7 +33,8 @@ VMemChunk :: struct { eng_persistent : mem.Arena, eng_transient : mem.Arena, env_persistent : mem.Arena, - env_transient : mem.Arena + env_transient : mem.Arena, + env_temp : mem.Arena } setup_engine_memory :: proc () -> VMemChunk @@ -57,22 +58,29 @@ setup_engine_memory :: proc () -> VMemChunk } // For now I'm making persistent sections each 128 meg and transient sections w/e is left over / 2 (one for engine the other for the env) - persistent_size := Megabyte * 128 - transient_size := (Gigabyte * 2 - persistent_size * 2) / 2 + persistent_size :: Megabyte * 128 * 2 + transient_size :: (Gigabyte * 2 - persistent_size * 2) / 2 + + eng_persistent_size :: persistent_size / 4 + eng_transient_size :: transient_size / 4 + + env_persistent_size :: persistent_size - eng_persistent_size + env_trans_temp_size :: (transient_size - eng_transient_size) / 2 block := memory.sarena.curr_block // Try to get a slice for each segment - eng_persistent_slice := slice_ptr( block.base, persistent_size) - eng_transient_slice := slice_ptr( & eng_persistent_slice[persistent_size - 1], transient_size) - env_persistent_slice := slice_ptr( & eng_transient_slice [transient_size - 1], persistent_size) - env_transient_slice := slice_ptr( & env_persistent_slice[persistent_size -1], transient_size) + eng_persistent_slice := slice_ptr( block.base, eng_persistent_size) + eng_transient_slice := slice_ptr( & eng_persistent_slice[ eng_persistent_size - 1], eng_transient_size) + env_persistent_slice := slice_ptr( & eng_transient_slice [ eng_transient_size - 1], env_persistent_size) + env_transient_slice := slice_ptr( & env_persistent_slice[ env_persistent_size - 1], env_trans_temp_size) + env_temp_slice := slice_ptr( & env_transient_slice [ env_trans_temp_size - 1], env_trans_temp_size) arena_init( & eng_persistent, eng_persistent_slice ) arena_init( & eng_transient, eng_transient_slice ) arena_init( & env_persistent, env_persistent_slice ) arena_init( & env_transient, env_transient_slice ) - + arena_init( & env_temp, env_temp_slice ) return memory; } @@ -141,15 +149,10 @@ main :: proc() state : RuntimeState state.running = true; - // state.monitor_id = monitor_id - // state.screen_width = screen_width - // state.screen_height = screen_height - // state.monitor_id = monitor_id - // state.monitor_refresh_hz = monitor_refresh_hz state.memory = memory state.sectr_api = sectr_api - state.sectr_api.startup( & memory.env_persistent, & memory.env_persistent ) + state.sectr_api.startup( & memory.env_persistent, & memory.env_transient, & memory.env_temp ) // TODO(Ed) : This should return a end status so that we know the reason the engine stopped. for ; state.running ; diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 47feb32..0e064ae 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -1,8 +1,9 @@ cls -$path_root = git rev-parse --show-toplevel -$path_code = join-path $path_root 'code' -$path_build = join-path $path_root 'build' +$path_root = git rev-parse --show-toplevel +$path_code = join-path $path_root 'code' +$path_build = join-path $path_root 'build' +$path_thirdparty = join-path $path_root 'thirdparty' # Odin Compiler Flags @@ -87,6 +88,12 @@ push-location $path_root & odin $build_args + $third_party_dlls = Get-ChildItem -Path $path_thirdparty -Filter '*.dll' + foreach ($dll in $third_party_dlls) { + $destination = join-path $path_build $dll.Name + Copy-Item $dll.FullName -Destination $destination -Force + } + Pop-Location } build-prototype diff --git a/thirdparty/raygui.dll b/thirdparty/raygui.dll new file mode 100644 index 0000000..ca99ee7 Binary files /dev/null and b/thirdparty/raygui.dll differ diff --git a/thirdparty/raylib.dll b/thirdparty/raylib.dll new file mode 100644 index 0000000..a9d218b Binary files /dev/null and b/thirdparty/raylib.dll differ