First working version of hot-reloading feature
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user