diff --git a/.cell/cell.toml b/.cell/cell.toml index 5dc6d5d6..813c7c86 100644 --- a/.cell/cell.toml +++ b/.cell/cell.toml @@ -2,5 +2,5 @@ LDFLAGS = "-lSDL3" CFLAGS = "-Iimgui" [dependencies] -rtree = "/Users/john/work/cell-rtree" -dmon = "/Users/john/work/cell-rtree" \ No newline at end of file +rtree = "gitea.pockle.world/john/cell-rtree" +dmon = "gitea.pockle.world/john/cell-watch" \ No newline at end of file diff --git a/model.c b/model.c index 30e71e84..e9a71675 100644 --- a/model.c +++ b/model.c @@ -3,6 +3,7 @@ #include "stb_ds.h" #include "HandmadeMath.h" +#include #include "math.h" #include "time.h" diff --git a/prosperon.cm b/prosperon.cm index bc3c4310..1ef3d7b9 100644 --- a/prosperon.cm +++ b/prosperon.cm @@ -1171,14 +1171,21 @@ prosperon.create_batch = function create_batch(draw_cmds, done) { if (done) done() } +var shop = use('shop') ////////// dmon hot reload //////// function poll_file_changes() { - dmon.poll(e => { - log.console(json.encode(e)) + dmon.poll(e => { if (e.action == 'modify' || e.action == 'create') { // Check if it's an image file var ext = e.file.split('.').pop().toLowerCase() var imageExts = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tga', 'webp', 'qoi', 'ase', 'aseprite'] + + if (ext == 'cm') { + var info = shop.file_info(e.file) + var pkg = info.package == 'local' ? null : info.package + log.console(`hot reloading ${info.name} in ${pkg}`) + shop.module_reload(info.name, pkg) + } if (imageExts.includes(ext)) { // Try to find the full path for this image @@ -1198,7 +1205,7 @@ function poll_file_changes() { $_.delay(poll_file_changes, 0.5) } -var dmon = use('dmon') +var dmon = use('dmon/dmon') prosperon.dmon = function() { if (!dmon) return diff --git a/prosperon.h b/prosperon.h index 77390997..7f92caaa 100644 --- a/prosperon.h +++ b/prosperon.h @@ -2,6 +2,7 @@ #define PROSPERON_H #include "cell.h" +#include #include "HandmadeMath.h" struct lrtb {