Add spacebar input; add shape enabling/disablg and sensors
This commit is contained in:
@@ -467,6 +467,11 @@ void phys2d_dbgdrawedge(struct phys2d_edge *edge)
|
||||
}
|
||||
}
|
||||
|
||||
cpShape *id2shape(int id)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void phys2d_reindex_body(cpBody *body) {
|
||||
cpSpaceReindexShapesForBody(space, body);
|
||||
}
|
||||
|
||||
@@ -97,6 +97,8 @@ void phys2d_add_handler_type(int cmd, int go, struct callee c);
|
||||
void register_collide(void *sym);
|
||||
void phys2d_set_gravity(cpVect v);
|
||||
|
||||
cpShape *id2shape(int id);
|
||||
|
||||
struct color {
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
|
||||
@@ -152,6 +152,17 @@ duk_ret_t duk_cmd(duk_context *duk) {
|
||||
set_trigger_color(duk2color(duk, 1));
|
||||
break;
|
||||
|
||||
case 18:
|
||||
cpShapeSetSensor(id2shape(duk_to_int(duk, 1)), duk_to_boolean(duk, 2));
|
||||
break;
|
||||
|
||||
case 19:
|
||||
if (id2shape(duk_to_int(duk, 1)))
|
||||
duk_push_boolean(duk, cpShapeGetSensor(id2shape(duk_to_int(duk, 1))));
|
||||
else
|
||||
duk_push_undefined(duk);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -127,6 +127,10 @@ const char *keyname_extd(int key, int scancode) {
|
||||
case GLFW_KEY_RIGHT_ALT:
|
||||
kkey= "ralt";
|
||||
break;
|
||||
|
||||
case GLFW_KEY_SPACE:
|
||||
kkey = "space";
|
||||
break;
|
||||
}
|
||||
|
||||
if (kkey) return kkey;
|
||||
|
||||
Reference in New Issue
Block a user