Start working on hot-reload functionality

This commit is contained in:
Riyyi
2026-09-06 16:37:49 +02:00
parent d353a43090
commit aea791fe2b
6 changed files with 92 additions and 17 deletions
+43
View File
@@ -1,13 +1,56 @@
package sindri
import "core:dynlib"
import "core:fmt"
import "core:time"
VERSION :: #config(VERSION, "dev")
// -----------------------------------------
instance_ready: bool
Game_API :: struct {
__handle: dynlib.Library,
hello: proc(),
should_close: proc() -> bool,
}
main :: proc() {
fmt.println("hello world!")
api: Game_API
load_game_api(&api)
api.hello()
// Initialize window
os_init()
// Initialize GPU resources
instance_init()
gt: f32
for !os_should_close() && !api.should_close() {
start := time.tick_now()
os_poll_events()
frame(gt)
gt = f32(time.duration_seconds(time.tick_since(start)))
}
// Cleanup GPU resources
instance_destroy()
// Cleanup window
os_destroy()
}
load_game_api :: proc(api: ^Game_API) {
// Match the names of the fields in Game_API to symbols in the game DLL
_, ok := dynlib.initialize_symbols(api, "build/game.dylib")
if !ok {
fmt.printfln("Failed initializing symbols: {0}", dynlib.last_error())
}
}