pass both scancode and keycode to oc_on_key_up()/oc_on_key_down()
This commit is contained in:
parent
a1ffcd3ddc
commit
7026919b38
|
@ -125,7 +125,7 @@ ORCA_EXPORT void oc_on_resize(u32 width, u32 height)
|
|||
frameSize.y = height;
|
||||
}
|
||||
|
||||
ORCA_EXPORT void oc_on_key_down(int key)
|
||||
ORCA_EXPORT void oc_on_key_down(oc_scan_code scan, oc_key_code key)
|
||||
{
|
||||
oc_log_info("key down: %i", key);
|
||||
if(key == OC_KEY_LEFT)
|
||||
|
@ -138,7 +138,7 @@ ORCA_EXPORT void oc_on_key_down(int key)
|
|||
}
|
||||
}
|
||||
|
||||
ORCA_EXPORT void oc_on_key_up(int key)
|
||||
ORCA_EXPORT void oc_on_key_up(oc_scan_code scan, oc_key_code key)
|
||||
{
|
||||
oc_log_info("key up: %i", key);
|
||||
if(key == OC_KEY_LEFT)
|
||||
|
|
|
@ -661,8 +661,8 @@ i32 orca_runloop(void* user)
|
|||
|
||||
if(exports[OC_EXPORT_KEY_DOWN])
|
||||
{
|
||||
const void* args[1] = { &event->key.scanCode };
|
||||
M3Result res = m3_Call(exports[OC_EXPORT_KEY_DOWN], 1, args);
|
||||
const void* args[2] = { &event->key.scanCode, &event->key.keyCode };
|
||||
M3Result res = m3_Call(exports[OC_EXPORT_KEY_DOWN], 2, args);
|
||||
if(res)
|
||||
{
|
||||
ORCA_WASM3_ABORT(app->env.m3Runtime, res, "Runtime error");
|
||||
|
@ -673,8 +673,8 @@ i32 orca_runloop(void* user)
|
|||
{
|
||||
if(exports[OC_EXPORT_KEY_UP])
|
||||
{
|
||||
const void* args[1] = { &event->key.scanCode };
|
||||
M3Result res = m3_Call(exports[OC_EXPORT_KEY_UP], 1, args);
|
||||
const void* args[2] = { &event->key.scanCode, &event->key.keyCode };
|
||||
M3Result res = m3_Call(exports[OC_EXPORT_KEY_UP], 2, args);
|
||||
if(res)
|
||||
{
|
||||
ORCA_WASM3_ABORT(app->env.m3Runtime, res, "Runtime error");
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
X(OC_EXPORT_MOUSE_LEAVE, "oc_on_mouse_leave", "", "") \
|
||||
X(OC_EXPORT_MOUSE_MOVE, "oc_on_mouse_move", "", "ffff") \
|
||||
X(OC_EXPORT_MOUSE_WHEEL, "oc_on_mouse_wheel", "", "ff") \
|
||||
X(OC_EXPORT_KEY_DOWN, "oc_on_key_down", "", "i") \
|
||||
X(OC_EXPORT_KEY_UP, "oc_on_key_up", "", "i") \
|
||||
X(OC_EXPORT_KEY_DOWN, "oc_on_key_down", "", "ii") \
|
||||
X(OC_EXPORT_KEY_UP, "oc_on_key_up", "", "ii") \
|
||||
X(OC_EXPORT_FRAME_REFRESH, "oc_on_frame_refresh", "", "") \
|
||||
X(OC_EXPORT_FRAME_RESIZE, "oc_on_resize", "", "ii") \
|
||||
X(OC_EXPORT_RAW_EVENT, "oc_on_raw_event", "", "i") \
|
||||
|
|
Loading…
Reference in New Issue