First working version of hot-reloading feature

This commit is contained in:
Riyyi
2026-09-06 23:35:21 +02:00
parent 6edcce16c6
commit 80bad9aad5
7 changed files with 314 additions and 43 deletions
+75
View File
@@ -3,9 +3,72 @@ package game
import "core:time"
import "core:fmt"
import "sindri:core"
// -----------------------------------------
Game_Memory :: struct {
}
g: ^Game_Memory
// -----------------------------------------
@(export)
memory :: proc() -> rawptr {
return g
}
@(export)
memory_free :: proc() {
free(g)
}
@(export)
memory_size :: proc() -> int {
return size_of(Game_Memory)
}
@(export)
memory_set :: proc(mem: rawptr) {
g = (^Game_Memory)(mem)
// Here you can also set your own global variables. A good idea is to make
// your global variables into pointers that point to something inside `g`.
}
@(export)
settings :: proc() -> core.Settings {
return core.Settings {
width = 960,
height = 540,
title = "WGPU Native Triangle",
mode = core.WindowMode.Windowed,
refresh = 60,
vsync = true,
}
}
@(export)
init_once :: proc() {
fmt.println("init once")
}
@(export)
init :: proc() {
fmt.println("hello from .dll!")
g = new(Game_Memory)
}
@(export)
update :: proc(dt: f32) {
fmt.println("dt:", dt)
}
@(export)
destroy :: proc() {
fmt.println("bye")
}
start := time.tick_now()
@@ -18,3 +81,15 @@ should_close :: proc() -> bool {
return false
}
@(export)
force_reload :: proc() -> bool {
// TODO: read keypress
return false
}
@(export)
force_restart :: proc() -> bool {
// TODO: read keypress
return false
}