fix imgui input handle capture

This commit is contained in:
John Alanbrook 2024-08-25 17:42:43 -05:00
parent 88de7fb547
commit 8abb0ae10f
4 changed files with 6 additions and 5 deletions

View file

@ -170,10 +170,11 @@ JSValue gui_init(JSContext *js)
return imgui;
}
void gui_input(sapp_event *e)
int gui_input(sapp_event *e)
{
if (started)
simgui_handle_event(e);
return simgui_handle_event(e);
return 0;
}
void gui_newframe(int x, int y, float dt)

View file

@ -11,7 +11,7 @@ extern "C" {
JSValue gui_init(JSContext *js);
void gui_newframe(int x, int y, float dt);
void gfx_gui();
void gui_input(sapp_event *e);
int gui_input(sapp_event *e);
void gui_endframe();
void gui_exit();

View file

@ -1536,9 +1536,9 @@ JS_HMM_FN(div, Div, /)
JS_HMM_FN(scale, Mul, *)
JSC_CCALL(array_lerp,
double t = js2number(argv[1]);
int len = js_arrlen(self);
JSValue arr = JS_NewArray(js);
double t = js2number(argv[1]);
for (int i = 0; i < len; i++) {
double from = js2number(js_getpropidx(self, i));

View file

@ -110,7 +110,7 @@ void c_clean() {
void c_event(const sapp_event *e)
{
gui_input(e);
if (gui_input(e)) return;
char lcfmt[5];
switch (e->type) {
case SAPP_EVENTTYPE_MOUSE_MOVE: