2020-01-16 20:45:47 +01:00
|
|
|
module sapp
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// returns true after sokol-app has been initialized
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_isvalid() bool
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// returns the current framebuffer width in pixels
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_width() int
|
2021-04-07 20:39:23 +02:00
|
|
|
fn C.sapp_widthf() f32
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// returns the current framebuffer height in pixels
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_height() int
|
2021-04-07 20:39:23 +02:00
|
|
|
fn C.sapp_heightf() f32
|
2021-05-08 12:32:29 +02:00
|
|
|
|
2022-01-27 20:16:00 +01:00
|
|
|
// get default framebuffer color pixel format
|
|
|
|
fn C.sapp_color_format() int
|
|
|
|
|
|
|
|
// get default framebuffer depth pixel format
|
|
|
|
fn C.sapp_depth_format() int
|
|
|
|
|
|
|
|
// get default framebuffer sample count
|
|
|
|
fn C.sapp_sample_count() int
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// returns true when high_dpi was requested and actually running in a high-dpi scenario
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_high_dpi() bool
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// returns the dpi scaling factor (window pixels to framebuffer pixels)
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_dpi_scale() f32
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// show or hide the mobile device onscreen keyboard
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_show_keyboard(visible bool)
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// return true if the mobile device onscreen keyboard is currently shown
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_keyboard_shown() bool
|
2021-05-08 12:32:29 +02:00
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// Check if full screen rendering
|
|
|
|
fn C.sapp_is_fullscreen() bool
|
|
|
|
|
|
|
|
// Toggle full screen
|
|
|
|
fn C.sapp_toggle_fullscreen()
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// show or hide the mouse cursor
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_show_mouse(visible bool)
|
2021-05-08 12:32:29 +02:00
|
|
|
|
2021-07-06 19:43:41 +02:00
|
|
|
// return true if the mouse cursor is shown
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_mouse_shown() bool
|
2021-05-08 12:32:29 +02:00
|
|
|
|
2021-07-06 19:43:41 +02:00
|
|
|
// lock or unlock the mouse cursor
|
|
|
|
fn C.sapp_lock_mouse(locked bool)
|
|
|
|
|
|
|
|
// return true if the mouse cursor is locked
|
|
|
|
fn C.sapp_mouse_locked() bool
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// return the userdata pointer optionally provided in sapp_desc
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_userdata() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// return a copy of the sapp_desc structure
|
2021-12-26 12:02:51 +01:00
|
|
|
fn C.sapp_query_desc() Desc
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED)
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_request_quit()
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received)
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_cancel_quit()
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// intiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUSTED)
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_quit()
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// call from inside event callback to consume the current event (don't forward to platform)
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_consume_event()
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// get the current frame counter (for comparison with sapp_event.frame_count)
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_frame_count() u64
|
|
|
|
|
2022-01-05 17:23:14 +01:00
|
|
|
// get an averaged/smoothed frame duration in seconds
|
|
|
|
fn C.sapp_frame_duration() f64
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// write string into clipboard
|
2022-04-15 15:12:05 +02:00
|
|
|
fn C.sapp_set_clipboard_string(str &u8)
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED)
|
2022-04-15 15:12:05 +02:00
|
|
|
fn C.sapp_get_clipboard_string() &u8
|
2021-05-08 12:32:29 +02:00
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// set the window title (only on desktop platforms)
|
|
|
|
fn C.sapp_set_window_title(&char)
|
|
|
|
|
|
|
|
// /* set the window icon (only on Windows and Linux) */
|
|
|
|
// SOKOL_APP_API_DECL void sapp_set_icon(const sapp_icon_desc* icon_desc);
|
|
|
|
|
|
|
|
// Get number of droped files
|
|
|
|
fn C.sapp_get_num_dropped_files() int
|
|
|
|
|
|
|
|
// Get the file path of the droped file
|
2022-04-15 15:12:05 +02:00
|
|
|
fn C.sapp_get_dropped_file_path(int) &u8
|
2022-03-04 12:39:38 +01:00
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub)
|
2021-12-26 12:02:51 +01:00
|
|
|
fn C.sapp_run(desc &Desc) int
|
2020-01-16 20:45:47 +01:00
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// GL: return true when GLES2 fallback is active (to detect fallback from GLES3)
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_gles2() bool
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// HTML5: enable or disable the hardwired "Leave Site?" dialog box
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_html5_ask_leave_site(ask bool)
|
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// /* HTML5: get byte size of a dropped file */
|
|
|
|
// SOKOL_APP_API_DECL uint32_t sapp_html5_get_dropped_file_size(int index);
|
|
|
|
|
|
|
|
// /* HTML5: asynchronously load the content of a dropped file */
|
|
|
|
// SOKOL_APP_API_DECL void sapp_html5_fetch_dropped_file(const sapp_html5_fetch_request* request);
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// Metal: get ARC-bridged pointer to Metal device object
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_metal_get_device() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// Metal: get ARC-bridged pointer to this frame's renderpass descriptor
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_metal_get_renderpass_descriptor() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// Metal: get ARC-bridged pointer to current drawable
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_metal_get_drawable() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// macOS: get ARC-bridged pointer to macOS NSWindow
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_macos_get_window() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// iOS: get ARC-bridged pointer to iOS UIWindow
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_ios_get_window() voidptr
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// D3D11: get pointer to ID3D11Device object
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_d3d11_get_device() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// D3D11: get pointer to ID3D11DeviceContext object
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_d3d11_get_device_context() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// D3D11: get pointer to IDXGISwapChain object
|
|
|
|
fn C.sapp_d3d11_get_swap_chain() voidptr
|
|
|
|
|
2021-05-08 12:32:29 +02:00
|
|
|
// D3D11: get pointer to ID3D11RenderTargetView object
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_d3d11_get_render_target_view() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// D3D11: get pointer to ID3D11DepthStencilView
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_d3d11_get_depth_stencil_view() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
|
|
|
// Win32: get the HWND window handle
|
2020-01-16 20:45:47 +01:00
|
|
|
fn C.sapp_win32_get_hwnd() voidptr
|
2021-05-08 12:32:29 +02:00
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// WebGPU: get WGPUDevice handle
|
|
|
|
fn C.sapp_wgpu_get_device() voidptr
|
2021-08-30 16:10:14 +02:00
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// WebGPU: get swapchain's WGPUTextureView handle for rendering
|
|
|
|
fn C.sapp_wgpu_get_render_view() voidptr
|
2021-08-30 16:10:14 +02:00
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// WebGPU: get swapchain's MSAA-resolve WGPUTextureView (may return null)
|
|
|
|
fn C.sapp_wgpu_get_resolve_view() voidptr
|
2021-09-01 08:21:27 +02:00
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// WebGPU: get swapchain's WGPUTextureView for the depth-stencil surface
|
|
|
|
fn C.sapp_wgpu_get_depth_stencil_view() voidptr
|
2021-09-01 08:21:27 +02:00
|
|
|
|
2022-03-04 12:39:38 +01:00
|
|
|
// Android: get native activity handle
|
|
|
|
fn C.sapp_android_get_native_activity() voidptr
|