From 5ecab600e04b63b9a736677f8e1b253c388b2b25 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Thu, 19 Jan 2023 22:43:29 +0000 Subject: [PATCH] nuke GUI bindings --- source/engine/2dphysics.c | 2 -- source/engine/ffi.c | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/source/engine/2dphysics.c b/source/engine/2dphysics.c index 9262c53..5988e57 100644 --- a/source/engine/2dphysics.c +++ b/source/engine/2dphysics.c @@ -368,8 +368,6 @@ void phys2d_applycircle(struct phys2d_circle *circle) float s = go->scale; cpVect offset = { circle->offset[0] * s, circle->offset[1] * s }; - YughInfo("Setting radius to %g ...", radius); - cpCircleShapeSetRadius(circle->shape.shape, radius); cpCircleShapeSetOffset(circle->shape.shape, offset); cpBodySetMoment(go->body, cpMomentForCircle(go->mass, 0, radius, offset)); diff --git a/source/engine/ffi.c b/source/engine/ffi.c index 261b844..0a98714 100644 --- a/source/engine/ffi.c +++ b/source/engine/ffi.c @@ -67,6 +67,7 @@ duk_ret_t duk_nuke(duk_context *duk) { int cmd = duk_to_int(duk, 0); float editnum; + int editint; switch(cmd) { case 0: @@ -86,6 +87,16 @@ duk_ret_t duk_nuke(duk_context *duk) case 3: nuke_nel(duk_to_number(duk, 1)); return 0; + + case 4: + editint = duk_to_boolean(duk, 2); + nuke_checkbox(duk_to_string(duk, 1), &editint); + duk_push_boolean(duk, editint); + return 1; + + case 5: + nuke_label(duk_to_string(duk, 1)); + return 0; } return 0; @@ -529,7 +540,11 @@ duk_ret_t duk_make_circle2d(duk_context *duk) { phys2d_applycircle(circle); + int idx = duk_push_object(duk); duk_push_pointer(duk, &circle->shape); + duk_put_prop_string(duk, idx, "id"); + duk_push_pointer(duk, circle); + duk_put_prop_string(duk, idx, "shape"); return 1; } @@ -539,7 +554,7 @@ duk_ret_t duk_cmd_circle2d(duk_context *duk) int cmd = duk_to_int(duk, 0); struct phys2d_circle *circle = duk_to_pointer(duk, 1); - YughInfo("DOING CIRCLE CMD"); + if (!circle) return 0; switch(cmd) { case 0: