Keyboard Layout support #102

Merged
MartinFouilleul merged 3 commits from keyboard_layout into main 2023-09-13 14:36:54 +00:00
3 changed files with 8 additions and 8 deletions
Showing only changes of commit 7026919b38 - Show all commits

View File

@ -125,7 +125,7 @@ ORCA_EXPORT void oc_on_resize(u32 width, u32 height)
frameSize.y = 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); oc_log_info("key down: %i", key);
if(key == OC_KEY_LEFT) 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); oc_log_info("key up: %i", key);
if(key == OC_KEY_LEFT) if(key == OC_KEY_LEFT)

View File

@ -661,8 +661,8 @@ i32 orca_runloop(void* user)
if(exports[OC_EXPORT_KEY_DOWN]) if(exports[OC_EXPORT_KEY_DOWN])
{ {
const void* args[1] = { &event->key.scanCode }; const void* args[2] = { &event->key.scanCode, &event->key.keyCode };
M3Result res = m3_Call(exports[OC_EXPORT_KEY_DOWN], 1, args); M3Result res = m3_Call(exports[OC_EXPORT_KEY_DOWN], 2, args);
if(res) if(res)
{ {
ORCA_WASM3_ABORT(app->env.m3Runtime, res, "Runtime error"); ORCA_WASM3_ABORT(app->env.m3Runtime, res, "Runtime error");
@ -673,8 +673,8 @@ i32 orca_runloop(void* user)
{ {
if(exports[OC_EXPORT_KEY_UP]) if(exports[OC_EXPORT_KEY_UP])
{ {
const void* args[1] = { &event->key.scanCode }; const void* args[2] = { &event->key.scanCode, &event->key.keyCode };
M3Result res = m3_Call(exports[OC_EXPORT_KEY_UP], 1, args); M3Result res = m3_Call(exports[OC_EXPORT_KEY_UP], 2, args);
if(res) if(res)
{ {
ORCA_WASM3_ABORT(app->env.m3Runtime, res, "Runtime error"); ORCA_WASM3_ABORT(app->env.m3Runtime, res, "Runtime error");

View File

@ -22,8 +22,8 @@
X(OC_EXPORT_MOUSE_LEAVE, "oc_on_mouse_leave", "", "") \ X(OC_EXPORT_MOUSE_LEAVE, "oc_on_mouse_leave", "", "") \
X(OC_EXPORT_MOUSE_MOVE, "oc_on_mouse_move", "", "ffff") \ X(OC_EXPORT_MOUSE_MOVE, "oc_on_mouse_move", "", "ffff") \
X(OC_EXPORT_MOUSE_WHEEL, "oc_on_mouse_wheel", "", "ff") \ X(OC_EXPORT_MOUSE_WHEEL, "oc_on_mouse_wheel", "", "ff") \
X(OC_EXPORT_KEY_DOWN, "oc_on_key_down", "", "i") \ X(OC_EXPORT_KEY_DOWN, "oc_on_key_down", "", "ii") \
X(OC_EXPORT_KEY_UP, "oc_on_key_up", "", "i") \ X(OC_EXPORT_KEY_UP, "oc_on_key_up", "", "ii") \
X(OC_EXPORT_FRAME_REFRESH, "oc_on_frame_refresh", "", "") \ X(OC_EXPORT_FRAME_REFRESH, "oc_on_frame_refresh", "", "") \
X(OC_EXPORT_FRAME_RESIZE, "oc_on_resize", "", "ii") \ X(OC_EXPORT_FRAME_RESIZE, "oc_on_resize", "", "ii") \
X(OC_EXPORT_RAW_EVENT, "oc_on_raw_event", "", "i") \ X(OC_EXPORT_RAW_EVENT, "oc_on_raw_event", "", "i") \