const (
used_import = gfx.used_import
)
fn android_get_native_activity() voidptr
Android: get native activity handle
fn cancel_quit()
cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received)
fn consume_event()
call from inside event callback to consume the current event (don't forward to platform)
fn create_desc() C.sg_desc
fn d3d11_get_depth_stencil_view() voidptr
D3D11: get pointer to ID3D11DepthStencilView
fn d3d11_get_device() voidptr
D3D11: get pointer to ID3D11Device object
fn d3d11_get_device_context() voidptr
D3D11: get pointer to ID3D11DeviceContext object
fn d3d11_get_render_target_view() voidptr
D3D11: get pointer to ID3D11RenderTargetView object
fn dpi_scale() f32
returns the dpi scaling factor (window pixels to framebuffer pixels)
fn frame_count() u64
get the current frame counter (for comparison with sapp_event.frame_count)
fn get_clipboard_string() byteptr
read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED)
fn gles2() bool
GL: return true when GLES2 fallback is active (to detect fallback from GLES3)
fn height() int
returns the current framebuffer height in pixels
fn high_dpi() bool
returns true when high_dpi was requested and actually running in a high-dpi scenario
fn html5_ask_leave_site(ask bool)
HTML5: enable or disable the hardwired "Leave Site?" dialog box
fn ios_get_window() voidptr
iOS: get ARC-bridged pointer to iOS UIWindow
fn isvalid() bool
returns true after sokol-app has been initialized
fn keyboard_shown() bool
return true if the mobile device onscreen keyboard is currently shown
fn macos_get_window() voidptr
macOS: get ARC-bridged pointer to macOS NSWindow
fn metal_get_device() voidptr
Metal: get ARC-bridged pointer to Metal device object
fn metal_get_drawable() voidptr
Metal: get ARC-bridged pointer to current drawable
fn metal_get_renderpass_descriptor() voidptr
Metal: get ARC-bridged pointer to this frame's renderpass descriptor
fn mouse_shown() bool
show or hide the mouse cursor
fn query_desc() C.sapp_desc
return a copy of the sapp_desc structure
fn quit()
intiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUSTED)
fn request_quit()
initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED)
fn run(desc &C.sapp_desc) int
special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub)
fn set_clipboard_string(str byteptr)
write string into clipboard
fn show_keyboard(visible bool)
show or hide the mobile device onscreen keyboard
fn show_mouse(visible bool)
show or hide the mouse cursor
fn userdata() voidptr
return the userdata pointer optionally provided in sapp_desc
fn width() int
returns the current framebuffer width in pixels
fn win32_get_hwnd() voidptr
Win32: get the HWND window handle
enum EventType {
invalid
key_down
key_up
char
mouse_down
mouse_up
mouse_scroll
mouse_move
mouse_enter
mouse_leave
touches_began
touches_moved
touches_ended
touches_cancelled
resized
iconified
restored
suspended
resumed
update_cursor
quit_requested
clipboard_pasted
num
}
enum KeyCode {
invalid = 0
space = 32
apostrophe = 39
comma = 44
minus = 45
period = 46
slash = 47
_0 = 48
_1 = 49
_2 = 50
_3 = 51
_4 = 52
_5 = 53
_6 = 54
_7 = 55
_8 = 56
_9 = 57
semicolon = 59
equal = 61
a = 65
b = 66
c = 67
d = 68
e = 69
f = 70
g = 71
h = 72
i = 73
j = 74
k = 75
l = 76
m = 77
n = 78
o = 79
p = 80
q = 81
r = 82
s = 83
t = 84
u = 85
v = 86
w = 87
x = 88
y = 89
z = 90
left_bracket = 91
backslash = 92
right_bracket = 93
grave_accent = 96
world_1 = 161
world_2 = 162
escape = 256
enter = 257
tab = 258
backspace = 259
insert = 260
delete = 261
right = 262
left = 263
down = 264
up = 265
page_up = 266
page_down = 267
home = 268
end = 269
caps_lock = 280
scroll_lock = 281
num_lock = 282
print_screen = 283
pause = 284
f1 = 290
f2 = 291
f3 = 292
f4 = 293
f5 = 294
f6 = 295
f7 = 296
f8 = 297
f9 = 298
f10 = 299
f11 = 300
f12 = 301
f13 = 302
f14 = 303
f15 = 304
f16 = 305
f17 = 306
f18 = 307
f19 = 308
f20 = 309
f21 = 310
f22 = 311
f23 = 312
f24 = 313
f25 = 314
kp_0 = 320
kp_1 = 321
kp_2 = 322
kp_3 = 323
kp_4 = 324
kp_5 = 325
kp_6 = 326
kp_7 = 327
kp_8 = 328
kp_9 = 329
kp_decimal = 330
kp_divide = 331
kp_multiply = 332
kp_subtract = 333
kp_add = 334
kp_enter = 335
kp_equal = 336
left_shift = 340
left_control = 341
left_alt = 342
left_super = 343
right_shift = 344
right_control = 345
right_alt = 346
right_super = 347
menu = 348
}
enum Modifier {
shift = 1
ctrl = 2
alt = 4
super = 8
}
enum MouseButton {
invalid = -1
left = 0
right = 1
middle = 2
}
struct C.sapp_desc {
pub:
init_cb fn ()
frame_cb fn ()
cleanup_cb fn ()
event_cb fn (&C.sapp_event)
fail_cb fn (byteptr)
user_data voidptr
init_userdata_cb fn (voidptr)
frame_userdata_cb fn (voidptr)
cleanup_userdata_cb fn (voidptr)
event_userdata_cb fn (&C.sapp_event, voidptr)
fail_userdata_cb fn (byteptr, voidptr)
width int
height int
sample_count int
swap_interval int
high_dpi bool
fullscreen bool
alpha bool
window_title byteptr
user_cursor bool
enable_clipboard bool
clipboard_size int
html5_canvas_name byteptr
html5_canvas_resize bool
html5_preserve_drawing_buffer bool
html5_premultiplied_alpha bool
html5_ask_leave_site bool
ios_keyboard_resizes_canvas bool
gl_force_gles2 bool
native_render bool
}
struct C.sapp_event {
pub:
frame_count u64
type EventType
key_code KeyCode
char_code u32
key_repeat bool
modifiers u32
mouse_button MouseButton
mouse_x f32
mouse_y f32
mouse_dx f32
mouse_dy f32
scroll_x f32
scroll_y f32
num_touches int
touches [8]C.sapp_touchpoint
window_width int
window_height int
framebuffer_width int
framebuffer_height int
}
fn (e &C.sapp_event) str() string
struct C.sapp_touchpoint {
pub:
identifier u64
pos_x f32
pos_y f32
changed bool
}
struct Event {
pub:
frame_count u64
typ EventType
key_code KeyCode
char_code u32
key_repeat bool
modifiers u32
mouse_button MouseButton
mouse_x f32
mouse_y f32
mouse_dx f32
mouse_dy f32
scroll_x f32
scroll_y f32
num_touches int
touches [8]C.sapp_touchpoint
window_width int
window_height int
framebuffer_width int
framebuffer_height int
}