expose oc_request_quit() to wasm runtime
This commit is contained in:
parent
9d1d8e5306
commit
0973e26150
|
@ -274,6 +274,8 @@ extern "C"
|
||||||
|
|
||||||
} oc_event;
|
} oc_event;
|
||||||
|
|
||||||
|
ORCA_API void oc_request_quit(void);
|
||||||
|
|
||||||
//NOTE: these APIs are not directly available to Orca apps
|
//NOTE: these APIs are not directly available to Orca apps
|
||||||
#if !defined(OC_PLATFORM_ORCA) || !(OC_PLATFORM_ORCA)
|
#if !defined(OC_PLATFORM_ORCA) || !(OC_PLATFORM_ORCA)
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -285,7 +287,6 @@ extern "C"
|
||||||
|
|
||||||
ORCA_API bool oc_should_quit(void);
|
ORCA_API bool oc_should_quit(void);
|
||||||
ORCA_API void oc_cancel_quit(void);
|
ORCA_API void oc_cancel_quit(void);
|
||||||
ORCA_API void oc_request_quit(void);
|
|
||||||
|
|
||||||
ORCA_API void oc_set_cursor(oc_mouse_cursor cursor);
|
ORCA_API void oc_set_cursor(oc_mouse_cursor cursor);
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,10 @@
|
||||||
|
|
||||||
//This is used to pass raw events from the runtime
|
//This is used to pass raw events from the runtime
|
||||||
ORCA_EXPORT oc_event oc_rawEvent;
|
ORCA_EXPORT oc_event oc_rawEvent;
|
||||||
|
|
||||||
|
void ORCA_IMPORT(oc_request_quit_stub)(void);
|
||||||
|
|
||||||
|
void oc_request_quit()
|
||||||
|
{
|
||||||
|
oc_request_quit_stub();
|
||||||
|
}
|
||||||
|
|
|
@ -796,6 +796,15 @@ i32 orca_runloop(void* user)
|
||||||
oc_arena_clear(oc_scratch());
|
oc_arena_clear(oc_scratch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(exports[OC_EXPORT_TERMINATE])
|
||||||
|
{
|
||||||
|
M3Result res = m3_Call(exports[OC_EXPORT_TERMINATE], 0, 0);
|
||||||
|
if(res)
|
||||||
|
{
|
||||||
|
ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
X(OC_EXPORT_KEY_UP, "oc_on_key_up", "", "i") \
|
X(OC_EXPORT_KEY_UP, "oc_on_key_up", "", "i") \
|
||||||
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") \
|
||||||
|
X(OC_EXPORT_TERMINATE, "oc_on_terminate", "", "")
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,6 +62,10 @@
|
||||||
"name": "oc_get_host_platform",
|
"name": "oc_get_host_platform",
|
||||||
"cname": "oc_get_host_platform",
|
"cname": "oc_get_host_platform",
|
||||||
"ret": {"name": "int", "tag": "i"},
|
"ret": {"name": "int", "tag": "i"},
|
||||||
"args": []
|
},
|
||||||
|
{
|
||||||
|
"name": "oc_request_quit_stub",
|
||||||
|
"cname": "oc_request_quit",
|
||||||
|
"ret": {"name": "void", "tag": "v"},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue