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