First working version of hot-reloading feature
This commit is contained in:
+19
-5
@@ -17,24 +17,38 @@ main :: proc() {
|
||||
defer hot_reload.hot_reload_destroy(&hr)
|
||||
|
||||
api := hot_reload.active_lib(&hr)
|
||||
api.init()
|
||||
settings := api.settings()
|
||||
|
||||
// Initialize Window
|
||||
os_init()
|
||||
os_init(settings)
|
||||
os_set_monitor(settings)
|
||||
defer os_destroy()
|
||||
|
||||
// Initialize GPU resources
|
||||
instance_init()
|
||||
defer instance_destroy()
|
||||
|
||||
gt: f32
|
||||
api.init_once()
|
||||
api.init()
|
||||
|
||||
gt: f64 = 0
|
||||
dt: f32
|
||||
|
||||
for !os_should_close() && !hot_reload.should_close(&hr) {
|
||||
start := time.tick_now()
|
||||
|
||||
os_poll_events()
|
||||
frame(gt)
|
||||
api.update(dt)
|
||||
|
||||
gt = f32(time.duration_seconds(time.tick_since(start)))
|
||||
frame(dt)
|
||||
|
||||
dt = f32(time.duration_seconds(time.tick_since(start)))
|
||||
gt += f64(dt)
|
||||
|
||||
// Hot reload
|
||||
api, err = hot_reload.reload_game_lib(&hr)
|
||||
if err != nil do break
|
||||
}
|
||||
|
||||
api.destroy()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user