diff --git a/cell.toml b/cell.toml index 8997f49d..c5134157 100644 --- a/cell.toml +++ b/cell.toml @@ -1,6 +1,6 @@ [compilation] LDFLAGS = "-lSDL3 -lstdc++ -lm -lc++" -CFLAGS = "-Iimgui" +CFLAGS = "-Isrc/imgui" [dependencies] rtree = "gitea.pockle.world/john/cell-rtree" diff --git a/examples/bunnymark/main.ce b/examples/bunnymark/main.ce index ca05e33b..f498ee84 100644 --- a/examples/bunnymark/main.ce +++ b/examples/bunnymark/main.ce @@ -23,7 +23,7 @@ for (i = 0; i < 100; i++) { }) } -this.update = function(dt) { +var update = function(dt) { // If left mouse is down, spawn some more bunnies: var mouse = input.mousestate() var i = 0; @@ -54,6 +54,6 @@ this.update = function(dt) { } } -this.hud = function() { +var hud = function() { draw.images(bunnyTex, bunnies) } diff --git a/examples/pong/main.ce b/examples/pong/main.ce index 43a65c02..30110c61 100644 --- a/examples/pong/main.ce +++ b/examples/pong/main.ce @@ -23,7 +23,7 @@ function resetBall() { resetBall() -this.update = function(dt) { +var update = function(dt) { // Move paddles: positive Y is up, so W/↑ means p.y += speed if (input.keyboard.down('w')) p1.y += p1.speed*dt if (input.keyboard.down('s')) p1.y -= p1.speed*dt @@ -69,7 +69,7 @@ this.update = function(dt) { if (l>config.width) { score1++; resetBall() } } -this.hud = function() { +var hud = function() { // Clear screen black draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1]) diff --git a/examples/snake/main.ce b/examples/snake/main.ce index 2b67860e..5205cc02 100644 --- a/examples/snake/main.ce +++ b/examples/snake/main.ce @@ -50,7 +50,7 @@ function wrap(pos) { resetGame() -this.update = function(dt) { +var update = function(dt) { if (gameState != "playing") return moveTimer += dt if (moveTimer < moveInterval) return @@ -80,7 +80,7 @@ this.update = function(dt) { else pop(snake) } -this.hud = function() { +var hud = function() { // Optional clear screen draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1]) @@ -104,7 +104,7 @@ this.hud = function() { // No immediate reversal // "Up" means y=1, so going physically up on screen -this.inputs = { +var inputs = { up: function() { if (direction.y != -1) nextDirection = {x:0,y:1} }, @@ -122,4 +122,4 @@ this.inputs = { } } -input.player[0].control(this) +//input.player[0].control() diff --git a/examples/tetris/main.ce b/examples/tetris/main.ce index 874b098a..e77acd63 100644 --- a/examples/tetris/main.ce +++ b/examples/tetris/main.ce @@ -166,7 +166,7 @@ function hardDrop() { spawnPiece() -this.update = function(dt) { +var update = function(dt) { if (gameOver) return // ======= Horizontal Movement Gate ======= @@ -243,7 +243,7 @@ this.update = function(dt) { } } -this.hud = function() { +var hud = function() { // Clear screen draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1]) diff --git a/graphics.cm b/graphics.cm index f9776d24..02d6661a 100644 --- a/graphics.cm +++ b/graphics.cm @@ -4,7 +4,6 @@ var io = use('cellfs') var time = use('time') var res = use('resources') var json = use('json') -var os = use('os') var staef = use('staef') var qoi = use('image/qoi') var png = use('image/png') diff --git a/imgui.cpp b/imgui.cpp index 4223767d..95583c80 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -19,9 +19,9 @@ #include #include #include -#include "imgui/backends/imgui_impl_sdl3.h" +#include "src/imgui/backends/imgui_impl_sdl3.h" //#include "imgui_impl_sdlrenderer3.h" -#include "imgui/backends/imgui_impl_sdlgpu3.h" +#include "src/imgui/backends/imgui_impl_sdlgpu3.h" // Forward declarations for the functions we need extern "C" { diff --git a/layout.c b/layout.c index fb60d296..33c37a3e 100644 --- a/layout.c +++ b/layout.c @@ -17,7 +17,7 @@ lay_id VAR; \ if (JS_ToUint32(js, &VAR, ARG)) return JS_EXCEPTION; \ static JSValue js_layout_context_new(JSContext *js, JSValueConst self, int argc, JSValueConst *argv) { - lay_context *lay = js_malloc(js, sizeof(*lay)); + lay_context *lay = js_malloc_rt(sizeof(*lay)); lay_init_context(lay); JSValue obj = JS_NewObjectClass(js, js_layout_class_id); JS_SetOpaque(obj, lay); diff --git a/mersenne.c b/mersenne.c index f77e5f62..d53ea9b0 100644 --- a/mersenne.c +++ b/mersenne.c @@ -110,7 +110,7 @@ static JSValue js_mersenne_use_call(JSContext *js, JSValueConst new_target, int } } - MTRand *mrand = js_malloc(js, sizeof(MTRand)); + MTRand *mrand = js_malloc_rt(sizeof(MTRand)); if (!mrand) return JS_ThrowOutOfMemory(js); m_seedRand(mrand, seed); @@ -118,7 +118,7 @@ static JSValue js_mersenne_use_call(JSContext *js, JSValueConst new_target, int JS_FRAME(js); JS_ROOT(obj, JS_NewObjectClass(js, js_mersenne_class_id)); if (JS_IsException(obj.val)) { - js_free(js, mrand); + js_free_rt(mrand); JS_RETURN_EX(); } diff --git a/imgui/GraphEditor.cpp b/src/imgui/GraphEditor.cpp similarity index 100% rename from imgui/GraphEditor.cpp rename to src/imgui/GraphEditor.cpp diff --git a/imgui/GraphEditor.h b/src/imgui/GraphEditor.h similarity index 100% rename from imgui/GraphEditor.h rename to src/imgui/GraphEditor.h diff --git a/imgui/ImCurveEdit.cpp b/src/imgui/ImCurveEdit.cpp similarity index 100% rename from imgui/ImCurveEdit.cpp rename to src/imgui/ImCurveEdit.cpp diff --git a/imgui/ImCurveEdit.h b/src/imgui/ImCurveEdit.h similarity index 100% rename from imgui/ImCurveEdit.h rename to src/imgui/ImCurveEdit.h diff --git a/imgui/ImGradient.cpp b/src/imgui/ImGradient.cpp similarity index 100% rename from imgui/ImGradient.cpp rename to src/imgui/ImGradient.cpp diff --git a/imgui/ImGradient.h b/src/imgui/ImGradient.h similarity index 100% rename from imgui/ImGradient.h rename to src/imgui/ImGradient.h diff --git a/imgui/ImGuizmo.cpp b/src/imgui/ImGuizmo.cpp similarity index 100% rename from imgui/ImGuizmo.cpp rename to src/imgui/ImGuizmo.cpp diff --git a/imgui/ImGuizmo.h b/src/imgui/ImGuizmo.h similarity index 100% rename from imgui/ImGuizmo.h rename to src/imgui/ImGuizmo.h diff --git a/imgui/ImZoomSlider.h b/src/imgui/ImZoomSlider.h similarity index 100% rename from imgui/ImZoomSlider.h rename to src/imgui/ImZoomSlider.h diff --git a/imgui/backends/imgui_impl_sdl3.cpp b/src/imgui/backends/imgui_impl_sdl3.cpp similarity index 100% rename from imgui/backends/imgui_impl_sdl3.cpp rename to src/imgui/backends/imgui_impl_sdl3.cpp diff --git a/imgui/backends/imgui_impl_sdl3.h b/src/imgui/backends/imgui_impl_sdl3.h similarity index 100% rename from imgui/backends/imgui_impl_sdl3.h rename to src/imgui/backends/imgui_impl_sdl3.h diff --git a/imgui/backends/imgui_impl_sdlgpu3.cpp b/src/imgui/backends/imgui_impl_sdlgpu3.cpp similarity index 100% rename from imgui/backends/imgui_impl_sdlgpu3.cpp rename to src/imgui/backends/imgui_impl_sdlgpu3.cpp diff --git a/imgui/backends/imgui_impl_sdlgpu3.h b/src/imgui/backends/imgui_impl_sdlgpu3.h similarity index 100% rename from imgui/backends/imgui_impl_sdlgpu3.h rename to src/imgui/backends/imgui_impl_sdlgpu3.h diff --git a/imgui/backends/imgui_impl_sdlgpu3_shaders.h b/src/imgui/backends/imgui_impl_sdlgpu3_shaders.h similarity index 100% rename from imgui/backends/imgui_impl_sdlgpu3_shaders.h rename to src/imgui/backends/imgui_impl_sdlgpu3_shaders.h diff --git a/imgui/backends/imgui_impl_sdlrenderer3.cpp b/src/imgui/backends/imgui_impl_sdlrenderer3.cpp similarity index 100% rename from imgui/backends/imgui_impl_sdlrenderer3.cpp rename to src/imgui/backends/imgui_impl_sdlrenderer3.cpp diff --git a/imgui/backends/imgui_impl_sdlrenderer3.h b/src/imgui/backends/imgui_impl_sdlrenderer3.h similarity index 100% rename from imgui/backends/imgui_impl_sdlrenderer3.h rename to src/imgui/backends/imgui_impl_sdlrenderer3.h diff --git a/imgui/backends/sdlgpu3/build_instructions.txt b/src/imgui/backends/sdlgpu3/build_instructions.txt similarity index 100% rename from imgui/backends/sdlgpu3/build_instructions.txt rename to src/imgui/backends/sdlgpu3/build_instructions.txt diff --git a/imgui/backends/sdlgpu3/shader.frag b/src/imgui/backends/sdlgpu3/shader.frag similarity index 100% rename from imgui/backends/sdlgpu3/shader.frag rename to src/imgui/backends/sdlgpu3/shader.frag diff --git a/imgui/backends/sdlgpu3/shader.vert b/src/imgui/backends/sdlgpu3/shader.vert similarity index 100% rename from imgui/backends/sdlgpu3/shader.vert rename to src/imgui/backends/sdlgpu3/shader.vert diff --git a/imgui/backends/vulkan/build_instructions.txt b/src/imgui/backends/vulkan/build_instructions.txt similarity index 100% rename from imgui/backends/vulkan/build_instructions.txt rename to src/imgui/backends/vulkan/build_instructions.txt diff --git a/imgui/backends/vulkan/generate_spv.sh b/src/imgui/backends/vulkan/generate_spv.sh similarity index 100% rename from imgui/backends/vulkan/generate_spv.sh rename to src/imgui/backends/vulkan/generate_spv.sh diff --git a/imgui/backends/vulkan/glsl_shader.frag b/src/imgui/backends/vulkan/glsl_shader.frag similarity index 100% rename from imgui/backends/vulkan/glsl_shader.frag rename to src/imgui/backends/vulkan/glsl_shader.frag diff --git a/imgui/backends/vulkan/glsl_shader.vert b/src/imgui/backends/vulkan/glsl_shader.vert similarity index 100% rename from imgui/backends/vulkan/glsl_shader.vert rename to src/imgui/backends/vulkan/glsl_shader.vert diff --git a/imgui/imconfig.h b/src/imgui/imconfig.h similarity index 100% rename from imgui/imconfig.h rename to src/imgui/imconfig.h diff --git a/imgui/imgui.cpp b/src/imgui/imgui.cpp similarity index 100% rename from imgui/imgui.cpp rename to src/imgui/imgui.cpp diff --git a/imgui/imgui.h b/src/imgui/imgui.h similarity index 100% rename from imgui/imgui.h rename to src/imgui/imgui.h diff --git a/imgui/imgui_demo.cpp b/src/imgui/imgui_demo.cpp similarity index 100% rename from imgui/imgui_demo.cpp rename to src/imgui/imgui_demo.cpp diff --git a/imgui/imgui_draw.cpp b/src/imgui/imgui_draw.cpp similarity index 100% rename from imgui/imgui_draw.cpp rename to src/imgui/imgui_draw.cpp diff --git a/imgui/imgui_internal.h b/src/imgui/imgui_internal.h similarity index 100% rename from imgui/imgui_internal.h rename to src/imgui/imgui_internal.h diff --git a/imgui/imgui_tables.cpp b/src/imgui/imgui_tables.cpp similarity index 100% rename from imgui/imgui_tables.cpp rename to src/imgui/imgui_tables.cpp diff --git a/imgui/imgui_widgets.cpp b/src/imgui/imgui_widgets.cpp similarity index 100% rename from imgui/imgui_widgets.cpp rename to src/imgui/imgui_widgets.cpp diff --git a/imgui/imstb_rectpack.h b/src/imgui/imstb_rectpack.h similarity index 100% rename from imgui/imstb_rectpack.h rename to src/imgui/imstb_rectpack.h diff --git a/imgui/imstb_textedit.h b/src/imgui/imstb_textedit.h similarity index 100% rename from imgui/imstb_textedit.h rename to src/imgui/imstb_textedit.h diff --git a/imgui/imstb_truetype.h b/src/imgui/imstb_truetype.h similarity index 100% rename from imgui/imstb_truetype.h rename to src/imgui/imstb_truetype.h diff --git a/staef.c b/staef.c index 5d62430c..735bf28a 100644 --- a/staef.c +++ b/staef.c @@ -847,7 +847,7 @@ static JSValue js_msdf_font_constructor(JSContext *ctx, JSValueConst new_target, CELL_USE_INIT( // Initialize font class JS_NewClassID(&js_font_id); - JS_NewClass(JS_GetRuntime(js), js_font_id, &js_font_class); + JS_NewClass(js, js_font_id, &js_font_class); JS_FRAME(js); JS_ROOT(proto, JS_NewObject(js)); JS_SetPropertyFunctionList(js, proto.val, js_font_funcs, countof(js_font_funcs));