diff options
| author | 2026-09-07 14:42:21 -0400 | |
|---|---|---|
| committer | 2026-09-07 14:42:21 -0400 | |
| commit | e72c336d01b32bee304c8a2989e2335fcc26c143 (patch) | |
| tree | 62b69b421936114835481c27612aad023e070c4f /src/window_glfm.c | |
| parent | 9c4a7eb845126f068aaac0173453e803e5ea6bf8 (diff) | |
| download | stela-e72c336d01b32bee304c8a2989e2335fcc26c143.tar.gz stela-e72c336d01b32bee304c8a2989e2335fcc26c143.tar.bz2 stela-e72c336d01b32bee304c8a2989e2335fcc26c143.zip | |
Android improvements, update deps
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/window_glfm.c')
| -rw-r--r-- | src/window_glfm.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/window_glfm.c b/src/window_glfm.c index 7fdb26a..cc1979d 100644 --- a/src/window_glfm.c +++ b/src/window_glfm.c @@ -78,9 +78,9 @@ static s32 jniGetFDFromFileDescriptor(JNIEnv *jni, jobject fileDescriptor) return glfm__getJavaField(jni, fileDescriptor, "descriptor", "I", Int); } -static u32 parse_intent(ANativeActivity *activity, JNIEnv *jni) +static s32 parse_intent(ANativeActivity *activity, JNIEnv *jni) { - u32 main_arg_index = 0; + s32 main_arg_index = 0; jobject intent = glfm__callJavaMethod(jni, activity->clazz, "getIntent", "()Landroid/content/Intent;", Object); @@ -132,7 +132,7 @@ static u32 parse_intent(ANativeActivity *activity, JNIEnv *jni) str *arg; al_array_foreach_ptr(global.args, i, arg) { if (al_str_eq(arg, &main_arg)) { - main_arg_index = i; + main_arg_index = (s32)i; break; } } @@ -228,6 +228,12 @@ static void onSurfaceCreated(GLFMDisplay *display, s32 width, s32 height) api == GLFMRenderingAPIOpenGLES3 ? "3.0" : "2.0"); } +static void onSurfaceRefresh(GLFMDisplay *display) +{ + struct stl_window_glfm *glfm = (struct stl_window_glfm *)glfmGetUserData(display); + glfm->w.pending_refresh = true; +} + static void onDraw(GLFMDisplay *display) { struct stl_window_glfm *glfm = (struct stl_window_glfm *)glfmGetUserData(display); @@ -272,10 +278,20 @@ static bool onKey(GLFMDisplay *display, GLFMKeyCode key, GLFMKeyAction action, s (void)modifiers; u8 mapped_action = glfm_to_stela_button_action[action]; switch (key) { + case GLFMKeyCodeArrowRight: + stl_window_send_key_event(&glfm->w, mapped_action, STELA_KEY_RIGHT); + break; + case GLFMKeyCodeArrowLeft: + stl_window_send_key_event(&glfm->w, mapped_action, STELA_KEY_LEFT); + break; case GLFMKeyCodeVolumeUp: return stl_window_send_key_immediate_event(&glfm->w, mapped_action, STELA_KEY_RIGHT); case GLFMKeyCodeVolumeDown: return stl_window_send_key_immediate_event(&glfm->w, mapped_action, STELA_KEY_LEFT); + case GLFMKeyCodeMediaSelect: + case GLFMKeyCodeMediaPlayPause: + stl_window_send_key_event(&glfm->w, mapped_action, STELA_KEY_SPACE); + break; case GLFMKeyCodeNavigationBack: return false; default: @@ -330,6 +346,7 @@ void glfmMain(GLFMDisplay *display) glfmSetDisplayChrome(display, GLFMUserInterfaceChromeNone); glfmSetMultitouchEnabled(display, true); glfmSetSurfaceCreatedFunc(display, onSurfaceCreated); + glfmSetSurfaceRefreshFunc(display, onSurfaceRefresh); glfmSetRenderFunc(display, onDraw); glfmSetSurfaceDestroyedFunc(display, onSurfaceDestroyed); glfmSetOrientationChangedFunc(display, onOrientationChanged); @@ -388,7 +405,8 @@ static void window_glfm_poll(struct stl_window *window, bool block) #ifdef STELA_PAUSE static void window_glfm_wake(struct stl_window *window) { - (void)window; + struct stl_window_glfm *glfm = (struct stl_window_glfm *)window; + glfm->w.pending_refresh = true; } #endif #endif @@ -401,8 +419,7 @@ static void window_glfm_process_events(struct stl_window *window) #ifdef STELA_PAUSE static bool window_glfm_should_refresh(struct stl_window *window) { - (void)window; - return true; + return stl_should_refresh_common(window); } #endif @@ -418,6 +435,7 @@ static bool window_glfm_gl_loader_load(void *window) return true; } +// Always current. static bool window_glfm_gl_make_current(void *window) { (void)window; @@ -431,8 +449,7 @@ static void window_glfm_gl_release_current(void *window) static void window_glfm_gl_swap_buffers(void *window) { - struct stl_window_glfm *glfm = (struct stl_window_glfm *)window; - (void)glfm; + (void)window; glfmSwapBuffers(global.display); } #endif |