diff options
| author | Andre Weissflog <floooh@gmail.com> | 2019-06-05 15:42:40 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2019-06-05 15:42:40 +0200 |
| commit | e7e619c0fd8700f68531004bc7b531db4af2c6a3 (patch) | |
| tree | 0875b3687b072a2b273a62da7afbe69709fd335d /sokol_app.h | |
| parent | de7241f95e7146571dd51dacaba5a26103258f54 (diff) | |
sokol_app.h: new function sapp_userdata() and sapp_query_desc()
Diffstat (limited to 'sokol_app.h')
| -rw-r--r-- | sokol_app.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sokol_app.h b/sokol_app.h index 4e1d0885..3c95d926 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -176,6 +176,12 @@ can mix those with the standard callbacks that don't have the user_data argument. + The function sapp_userdata() can be used to query the user_data + pointer provided in the sapp_desc struct. + + You you can call sapp_query_desc() to get a copy(!) of the + original sapp_desc structure. + NOTE that there's also an alternative compile mode where sokol_app.h doesn't "hijack" the main() function. Search below for SOKOL_NO_ENTRY. @@ -649,6 +655,8 @@ SOKOL_API_DECL bool sapp_high_dpi(void); SOKOL_API_DECL float sapp_dpi_scale(void); SOKOL_API_DECL void sapp_show_keyboard(bool visible); SOKOL_API_DECL bool sapp_keyboard_shown(void); +SOKOL_API_DECL void* sapp_userdata(void); +SOKOL_API_DECL sapp_desc sapp_query_desc(void); /* GL/GLES specific functions */ SOKOL_API_DECL bool sapp_gles2(void); @@ -6712,6 +6720,14 @@ SOKOL_API_IMPL bool sapp_isvalid(void) { return _sapp.valid; } +SOKOL_API_IMPL void* sapp_userdata(void) { + return _sapp.desc.user_data; +} + +SOKOL_API_IMPL sapp_desc sapp_query_desc(void) { + return _sapp.desc; +} + SOKOL_API_IMPL int sapp_width(void) { return (_sapp.framebuffer_width > 0) ? _sapp.framebuffer_width : 1; } |