aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2019-08-02 11:04:51 +0200
committerGitHub <noreply@github.com>2019-08-02 11:04:51 +0200
commitcdf192919143f063f14e6a19c009602c407df5ba (patch)
tree06abc039f316dcc3b674582390f81efa8a1e4f9a
parent580a06ec968741ef994112be9014cd02dfa34b37 (diff)
parentac769cd9cefb64825c78f0a28b58cb42251629a7 (diff)
Merge pull request #188 from kochol/master
Add sapp_android_get_native_activity function
-rw-r--r--sokol_app.h16
1 files changed, 16 insertions, 0 deletions
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;
}