From ac769cd9cefb64825c78f0a28b58cb42251629a7 Mon Sep 17 00:00:00 2001 From: Ali Akbar Mohammadi Date: Fri, 26 Jul 2019 12:34:23 +0800 Subject: Add sapp_android_get_native_activity function --- sokol_app.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sokol_app.h b/sokol_app.h index a47c0d2f..541a4bd7 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -241,6 +241,10 @@ return a null pointer. Note that the returned pointers to the render-target-view and depth-stencil-view may change from one frame to the next! + + const void* sapp_android_get_native_activity(void); + On Android, get tne native activity ANativeActivity pointer, otherwise + a null pointer. --- Implement the frame-callback function, this function will be called on the same thread as the init callback, but might be on a different @@ -784,6 +788,9 @@ SOKOL_API_DECL const void* sapp_d3d11_get_depth_stencil_view(void); /* Win32: get the HWND window handle */ SOKOL_API_DECL const void* sapp_win32_get_hwnd(void); +/* Android: get native activity handle */ +SOKOL_API_DECL const void* sapp_android_get_native_activity(void); + #ifdef __cplusplus } /* extern "C" */ #endif @@ -7065,6 +7072,15 @@ SOKOL_API_IMPL const void* sapp_win32_get_hwnd(void) { #endif } +SOKOL_API_IMPL const void* sapp_android_get_native_activity(void) { + SOKOL_ASSERT(_sapp.valid); + #if defined(__ANDROID__) + return (void*)_sapp_android_state.activity; + #else + return 0; + #endif +} + SOKOL_API_IMPL void sapp_html5_ask_leave_site(bool ask) { _sapp.html5_ask_leave_site = ask; } -- cgit v1.2.3