tojson for ur and entity separation

This commit is contained in:
2023-09-20 18:33:11 +00:00
parent 31331af57d
commit f6d491b142
7 changed files with 104 additions and 128 deletions

View File

@@ -129,7 +129,7 @@ void phys2d_set_gravity(cpVect v);
void shape_enabled(struct phys2d_shape *shape, int enabled);
int shape_is_enabled(struct phys2d_shape *shape);
void shape_set_sensor(struct phys2d_shape *shape, int sensor);
int shape_get_sensor(struct phys2d_shape *shape);
int shape_get_sensor(struct phys2d_shape *shape);
struct rgba shape_color_s(cpShape *shape);

View File

@@ -1257,20 +1257,7 @@ JSValue duk_sys_cmd(JSContext *js, JSValueConst this, int argc, JSValueConst *ar
}
JSValue duk_make_gameobject(JSContext *js, JSValueConst this, int argc, JSValueConst *argv) {
int g = MakeGameobject();
struct gameobject *go = get_gameobject_from_id(g);
go->scale = js2number(argv[0]);
go->bodytype = js2int(argv[1]);
go->mass = js2number(argv[2]);
go->f = js2number(argv[3]);
go->e = js2number(argv[4]);
go->flipx = 1.f;
go->flipy = 1.f;
gameobject_apply(go);
return JS_NewInt64(js, g);
return JS_NewInt64(js, MakeGameobject());
}
JSValue duk_yughlog(JSContext *js, JSValueConst this, int argc, JSValueConst *argv) {
@@ -1653,7 +1640,7 @@ void ffi_load() {
DUK_FUNC(nuke, 6)
#endif
DUK_FUNC(make_gameobject, 7)
DUK_FUNC(make_gameobject, 0)
DUK_FUNC(set_body, 3)
DUK_FUNC(q_body, 2)