| 1 | module sapp |
| 2 | |
| 3 | #define SOKOL_VALIDATE_NON_FATAL 1 |
| 4 | |
| 5 | // returns true after sokol-app has been initialized |
| 6 | fn C.sapp_isvalid() bool |
| 7 | |
| 8 | // returns the current framebuffer width in pixels |
| 9 | fn C.sapp_width() i32 |
| 10 | fn C.sapp_widthf() f32 |
| 11 | |
| 12 | // returns the current framebuffer height in pixels |
| 13 | fn C.sapp_height() i32 |
| 14 | fn C.sapp_heightf() f32 |
| 15 | |
| 16 | // get default framebuffer color pixel format |
| 17 | fn C.sapp_color_format() i32 |
| 18 | |
| 19 | // get default framebuffer depth pixel format |
| 20 | fn C.sapp_depth_format() i32 |
| 21 | |
| 22 | // get default framebuffer sample count |
| 23 | fn C.sapp_sample_count() i32 |
| 24 | |
| 25 | // returns true when high_dpi was requested and actually running in a high-dpi scenario |
| 26 | fn C.sapp_high_dpi() bool |
| 27 | |
| 28 | // returns the dpi scaling factor (window pixels to framebuffer pixels) |
| 29 | fn C.sapp_dpi_scale() f32 |
| 30 | |
| 31 | // show or hide the mobile device onscreen keyboard |
| 32 | fn C.sapp_show_keyboard(visible bool) |
| 33 | |
| 34 | // return true if the mobile device onscreen keyboard is currently shown |
| 35 | fn C.sapp_keyboard_shown() bool |
| 36 | |
| 37 | // Check if full screen rendering |
| 38 | fn C.sapp_is_fullscreen() bool |
| 39 | |
| 40 | // Toggle full screen |
| 41 | fn C.sapp_toggle_fullscreen() |
| 42 | |
| 43 | // show or hide the mouse cursor |
| 44 | fn C.sapp_show_mouse(visible bool) |
| 45 | |
| 46 | // return true if the mouse cursor is shown |
| 47 | fn C.sapp_mouse_shown() bool |
| 48 | |
| 49 | // set mouse cursor |
| 50 | fn C.sapp_set_mouse_cursor(cursor MouseCursor) |
| 51 | |
| 52 | // get current mouse cursor type |
| 53 | fn C.sapp_get_mouse_cursor() MouseCursor |
| 54 | |
| 55 | // bind a custom mouse cursor image to a cursor type, returns the cursor type |
| 56 | fn C.sapp_bind_mouse_cursor_image(cursor MouseCursor, desc &ImageDesc) MouseCursor |
| 57 | |
| 58 | // unbind a custom mouse cursor image |
| 59 | fn C.sapp_unbind_mouse_cursor_image(cursor MouseCursor) |
| 60 | |
| 61 | // lock or unlock the mouse cursor |
| 62 | fn C.sapp_lock_mouse(locked bool) |
| 63 | |
| 64 | // return true if the mouse cursor is locked |
| 65 | fn C.sapp_mouse_locked() bool |
| 66 | |
| 67 | // return the userdata pointer optionally provided in sapp_desc |
| 68 | fn C.sapp_userdata() voidptr |
| 69 | |
| 70 | // return a copy of the sapp_desc structure |
| 71 | fn C.sapp_query_desc() Desc |
| 72 | |
| 73 | // initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED) |
| 74 | fn C.sapp_request_quit() |
| 75 | |
| 76 | // cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received) |
| 77 | fn C.sapp_cancel_quit() |
| 78 | |
| 79 | // intiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUESTED) |
| 80 | fn C.sapp_quit() |
| 81 | |
| 82 | // call from inside event callback to consume the current event (don't forward to platform) |
| 83 | fn C.sapp_consume_event() |
| 84 | |
| 85 | // get the current frame counter (for comparison with sapp_event.frame_count) |
| 86 | fn C.sapp_frame_count() u64 |
| 87 | |
| 88 | // get an averaged/smoothed frame duration in seconds |
| 89 | fn C.sapp_frame_duration() f64 |
| 90 | |
| 91 | // write string into clipboard |
| 92 | fn C.sapp_set_clipboard_string(const_str &char) |
| 93 | |
| 94 | // read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED) |
| 95 | fn C.sapp_get_clipboard_string() &char |
| 96 | |
| 97 | // set the window title (only on desktop platforms) |
| 98 | fn C.sapp_set_window_title(&char) |
| 99 | |
| 100 | // set the window icon (only on Windows and Linux) |
| 101 | fn C.sapp_set_icon(const_icon_desc &IconDesc) |
| 102 | |
| 103 | // Get number of dropped files |
| 104 | fn C.sapp_get_num_dropped_files() i32 |
| 105 | |
| 106 | // Get the file path of the dropped file |
| 107 | fn C.sapp_get_dropped_file_path(i32) &char |
| 108 | |
| 109 | // special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub) |
| 110 | fn C.sapp_run(const_desc &Desc) i32 |
| 111 | |
| 112 | // get runtime environment information |
| 113 | fn C.sapp_get_environment() Environment |
| 114 | |
| 115 | // get current frame's swapchain information (call once per frame!) |
| 116 | fn C.sapp_get_swapchain() Swapchain |
| 117 | |
| 118 | // EGL: get EGLDisplay object |
| 119 | fn C.sapp_egl_get_display() voidptr |
| 120 | |
| 121 | // EGL: get EGLContext object |
| 122 | fn C.sapp_egl_get_context() voidptr |
| 123 | |
| 124 | // HTML5: enable or disable the hardwired "Leave Site?" dialog box |
| 125 | fn C.sapp_html5_ask_leave_site(ask bool) |
| 126 | |
| 127 | // HTML5: get byte size of a dropped file |
| 128 | fn C.sapp_html5_get_dropped_file_size(index i32) u32 |
| 129 | |
| 130 | // macOS: get ARC-bridged pointer to macOS NSWindow |
| 131 | fn C.sapp_macos_get_window() voidptr |
| 132 | |
| 133 | // iOS: get ARC-bridged pointer to iOS UIWindow |
| 134 | fn C.sapp_ios_get_window() voidptr |
| 135 | |
| 136 | // D3D11: get pointer to IDXGISwapChain object |
| 137 | fn C.sapp_d3d11_get_swap_chain() voidptr |
| 138 | |
| 139 | // Win32: get the HWND window handle |
| 140 | fn C.sapp_win32_get_hwnd() voidptr |
| 141 | |
| 142 | // GL: get major version |
| 143 | fn C.sapp_gl_get_major_version() i32 |
| 144 | |
| 145 | // GL: get minor version |
| 146 | fn C.sapp_gl_get_minor_version() i32 |
| 147 | |
| 148 | // GL: return true if the context is GLES |
| 149 | fn C.sapp_gl_is_gles() bool |
| 150 | |
| 151 | // GL: get framebuffer object |
| 152 | fn C.sapp_gl_get_framebuffer() u32 |
| 153 | |
| 154 | // X11: get Window |
| 155 | fn C.sapp_x11_get_window() voidptr |
| 156 | |
| 157 | // X11: get Display |
| 158 | fn C.sapp_x11_get_display() voidptr |
| 159 | |
| 160 | // Android: get native activity handle |
| 161 | fn C.sapp_android_get_native_activity() voidptr |
| 162 | |
| 163 | // V-specific: read RGBA pixels from the OpenGL framebuffer |
| 164 | fn C.v_sapp_gl_read_rgba_pixels(x i32, y i32, width i32, height i32, pixels charptr) |
| 165 | |