1 /++ 2 + Machine generated D bindings for Sokol library. 3 + 4 + Generated on: 2025-06-01 10:38:02 5 + 6 + Source header: sokol_app.h 7 + Module: sokol.app 8 + 9 + Do not edit manually; regenerate using gen_d.py. 10 +/ 11 module sokol.app; 12 13 /++ 14 + misc constants 15 +/ 16 enum max_touchpoints = 8; 17 enum max_mousebuttons = 3; 18 enum max_keycodes = 512; 19 enum max_iconimages = 8; 20 /++ 21 + sapp_event_type 22 + 23 + The type of event that's passed to the event handler callback 24 + in the sapp_event.type field. These are not just "traditional" 25 + input events, but also notify the application about state changes 26 + or other user-invoked actions. 27 +/ 28 enum EventType { 29 Invalid, 30 Key_down, 31 Key_up, 32 Char, 33 Mouse_down, 34 Mouse_up, 35 Mouse_scroll, 36 Mouse_move, 37 Mouse_enter, 38 Mouse_leave, 39 Touches_began, 40 Touches_moved, 41 Touches_ended, 42 Touches_cancelled, 43 Resized, 44 Iconified, 45 Restored, 46 Focused, 47 Unfocused, 48 Suspended, 49 Resumed, 50 Quit_requested, 51 Clipboard_pasted, 52 Files_dropped, 53 Num, 54 } 55 /++ 56 + sapp_keycode 57 + 58 + The 'virtual keycode' of a KEY_DOWN or KEY_UP event in the 59 + struct field sapp_event.key_code. 60 + 61 + Note that the keycode values are identical with GLFW. 62 +/ 63 enum Keycode { 64 Invalid = 0, 65 Space = 32, 66 Apostrophe = 39, 67 Comma = 44, 68 Minus = 45, 69 Period = 46, 70 Slash = 47, 71 _0 = 48, 72 _1 = 49, 73 _2 = 50, 74 _3 = 51, 75 _4 = 52, 76 _5 = 53, 77 _6 = 54, 78 _7 = 55, 79 _8 = 56, 80 _9 = 57, 81 Semicolon = 59, 82 Equal = 61, 83 A = 65, 84 B = 66, 85 C = 67, 86 D = 68, 87 E = 69, 88 F = 70, 89 G = 71, 90 H = 72, 91 I = 73, 92 J = 74, 93 K = 75, 94 L = 76, 95 M = 77, 96 N = 78, 97 O = 79, 98 P = 80, 99 Q = 81, 100 R = 82, 101 S = 83, 102 T = 84, 103 U = 85, 104 V = 86, 105 W = 87, 106 X = 88, 107 Y = 89, 108 Z = 90, 109 Left_bracket = 91, 110 Backslash = 92, 111 Right_bracket = 93, 112 Grave_accent = 96, 113 World_1 = 161, 114 World_2 = 162, 115 Escape = 256, 116 Enter = 257, 117 Tab = 258, 118 Backspace = 259, 119 Insert = 260, 120 Delete = 261, 121 Right = 262, 122 Left = 263, 123 Down = 264, 124 Up = 265, 125 Page_up = 266, 126 Page_down = 267, 127 Home = 268, 128 End = 269, 129 Caps_lock = 280, 130 Scroll_lock = 281, 131 Num_lock = 282, 132 Print_screen = 283, 133 Pause = 284, 134 F1 = 290, 135 F2 = 291, 136 F3 = 292, 137 F4 = 293, 138 F5 = 294, 139 F6 = 295, 140 F7 = 296, 141 F8 = 297, 142 F9 = 298, 143 F10 = 299, 144 F11 = 300, 145 F12 = 301, 146 F13 = 302, 147 F14 = 303, 148 F15 = 304, 149 F16 = 305, 150 F17 = 306, 151 F18 = 307, 152 F19 = 308, 153 F20 = 309, 154 F21 = 310, 155 F22 = 311, 156 F23 = 312, 157 F24 = 313, 158 F25 = 314, 159 Kp_0 = 320, 160 Kp_1 = 321, 161 Kp_2 = 322, 162 Kp_3 = 323, 163 Kp_4 = 324, 164 Kp_5 = 325, 165 Kp_6 = 326, 166 Kp_7 = 327, 167 Kp_8 = 328, 168 Kp_9 = 329, 169 Kp_decimal = 330, 170 Kp_divide = 331, 171 Kp_multiply = 332, 172 Kp_subtract = 333, 173 Kp_add = 334, 174 Kp_enter = 335, 175 Kp_equal = 336, 176 Left_shift = 340, 177 Left_control = 341, 178 Left_alt = 342, 179 Left_super = 343, 180 Right_shift = 344, 181 Right_control = 345, 182 Right_alt = 346, 183 Right_super = 347, 184 Menu = 348, 185 } 186 /++ 187 + Android specific 'tool type' enum for touch events. This lets the 188 + application check what type of input device was used for 189 + touch events. 190 + 191 + NOTE: the values must remain in sync with the corresponding 192 + Android SDK type, so don't change those. 193 + 194 + See https://developer.android.com/reference/android/view/MotionEvent#TOOL_TYPE_UNKNOWN 195 +/ 196 enum AndroidTooltype { 197 Unknown = 0, 198 Finger = 1, 199 Stylus = 2, 200 Mouse = 3, 201 } 202 /++ 203 + sapp_touchpoint 204 + 205 + Describes a single touchpoint in a multitouch event (TOUCHES_BEGAN, 206 + TOUCHES_MOVED, TOUCHES_ENDED). 207 + 208 + Touch points are stored in the nested array sapp_event.touches[], 209 + and the number of touches is stored in sapp_event.num_touches. 210 +/ 211 extern(C) struct Touchpoint { 212 ulong identifier = 0; 213 float pos_x = 0.0f; 214 float pos_y = 0.0f; 215 AndroidTooltype android_tooltype = AndroidTooltype.Unknown; 216 bool changed = false; 217 } 218 /++ 219 + sapp_mousebutton 220 + 221 + The currently pressed mouse button in the events MOUSE_DOWN 222 + and MOUSE_UP, stored in the struct field sapp_event.mouse_button. 223 +/ 224 enum Mousebutton { 225 Left = 0, 226 Right = 1, 227 Middle = 2, 228 Invalid = 256, 229 } 230 /++ 231 + These are currently pressed modifier keys (and mouse buttons) which are 232 + passed in the event struct field sapp_event.modifiers. 233 +/ 234 enum modifier_shift = 1; 235 enum modifier_ctrl = 2; 236 enum modifier_alt = 4; 237 enum modifier_super = 8; 238 enum modifier_lmb = 256; 239 enum modifier_rmb = 512; 240 enum modifier_mmb = 1024; 241 /++ 242 + sapp_event 243 + 244 + This is an all-in-one event struct passed to the event handler 245 + user callback function. Note that it depends on the event 246 + type what struct fields actually contain useful values, so you 247 + should first check the event type before reading other struct 248 + fields. 249 +/ 250 extern(C) struct Event { 251 ulong frame_count = 0; 252 EventType type = EventType.Invalid; 253 Keycode key_code = Keycode.Invalid; 254 uint char_code = 0; 255 bool key_repeat = false; 256 uint modifiers = 0; 257 Mousebutton mouse_button = Mousebutton.Left; 258 float mouse_x = 0.0f; 259 float mouse_y = 0.0f; 260 float mouse_dx = 0.0f; 261 float mouse_dy = 0.0f; 262 float scroll_x = 0.0f; 263 float scroll_y = 0.0f; 264 int num_touches = 0; 265 Touchpoint[8] touches = []; 266 int window_width = 0; 267 int window_height = 0; 268 int framebuffer_width = 0; 269 int framebuffer_height = 0; 270 } 271 /++ 272 + sg_range 273 + 274 + A general pointer/size-pair struct and constructor macros for passing binary blobs 275 + into sokol_app.h. 276 +/ 277 extern(C) struct Range { 278 const(void)* ptr = null; 279 size_t size = 0; 280 } 281 /++ 282 + sapp_image_desc 283 + 284 + This is used to describe image data to sokol_app.h (at first, window 285 + icons, later maybe cursor images). 286 + 287 + Note that the actual image pixel format depends on the use case: 288 + 289 + - window icon pixels are RGBA8 290 +/ 291 extern(C) struct ImageDesc { 292 int width = 0; 293 int height = 0; 294 Range pixels = {}; 295 } 296 /++ 297 + sapp_icon_desc 298 + 299 + An icon description structure for use in sapp_desc.icon and 300 + sapp_set_icon(). 301 + 302 + When setting a custom image, the application can provide a number of 303 + candidates differing in size, and sokol_app.h will pick the image(s) 304 + closest to the size expected by the platform's window system. 305 + 306 + To set sokol-app's default icon, set .sokol_default to true. 307 + 308 + Otherwise provide candidate images of different sizes in the 309 + images[] array. 310 + 311 + If both the sokol_default flag is set to true, any image candidates 312 + will be ignored and the sokol_app.h default icon will be set. 313 +/ 314 extern(C) struct IconDesc { 315 bool sokol_default = false; 316 ImageDesc[8] images = []; 317 } 318 /++ 319 + sapp_allocator 320 + 321 + Used in sapp_desc to provide custom memory-alloc and -free functions 322 + to sokol_app.h. If memory management should be overridden, both the 323 + alloc_fn and free_fn function must be provided (e.g. it's not valid to 324 + override one function but not the other). 325 +/ 326 extern(C) struct Allocator { 327 extern(C) void* function(size_t, void*) alloc_fn = null; 328 extern(C) void function(void*, void*) free_fn = null; 329 void* user_data = null; 330 } 331 enum LogItem { 332 Ok, 333 Malloc_failed, 334 Macos_invalid_nsopengl_profile, 335 Win32_load_opengl32_dll_failed, 336 Win32_create_helper_window_failed, 337 Win32_helper_window_getdc_failed, 338 Win32_dummy_context_set_pixelformat_failed, 339 Win32_create_dummy_context_failed, 340 Win32_dummy_context_make_current_failed, 341 Win32_get_pixelformat_attrib_failed, 342 Win32_wgl_find_pixelformat_failed, 343 Win32_wgl_describe_pixelformat_failed, 344 Win32_wgl_set_pixelformat_failed, 345 Win32_wgl_arb_create_context_required, 346 Win32_wgl_arb_create_context_profile_required, 347 Win32_wgl_opengl_version_not_supported, 348 Win32_wgl_opengl_profile_not_supported, 349 Win32_wgl_incompatible_device_context, 350 Win32_wgl_create_context_attribs_failed_other, 351 Win32_d3d11_create_device_and_swapchain_with_debug_failed, 352 Win32_d3d11_get_idxgifactory_failed, 353 Win32_d3d11_get_idxgiadapter_failed, 354 Win32_d3d11_query_interface_idxgidevice1_failed, 355 Win32_register_raw_input_devices_failed_mouse_lock, 356 Win32_register_raw_input_devices_failed_mouse_unlock, 357 Win32_get_raw_input_data_failed, 358 Linux_glx_load_libgl_failed, 359 Linux_glx_load_entry_points_failed, 360 Linux_glx_extension_not_found, 361 Linux_glx_query_version_failed, 362 Linux_glx_version_too_low, 363 Linux_glx_no_glxfbconfigs, 364 Linux_glx_no_suitable_glxfbconfig, 365 Linux_glx_get_visual_from_fbconfig_failed, 366 Linux_glx_required_extensions_missing, 367 Linux_glx_create_context_failed, 368 Linux_glx_create_window_failed, 369 Linux_x11_create_window_failed, 370 Linux_egl_bind_opengl_api_failed, 371 Linux_egl_bind_opengl_es_api_failed, 372 Linux_egl_get_display_failed, 373 Linux_egl_initialize_failed, 374 Linux_egl_no_configs, 375 Linux_egl_no_native_visual, 376 Linux_egl_get_visual_info_failed, 377 Linux_egl_create_window_surface_failed, 378 Linux_egl_create_context_failed, 379 Linux_egl_make_current_failed, 380 Linux_x11_open_display_failed, 381 Linux_x11_query_system_dpi_failed, 382 Linux_x11_dropped_file_uri_wrong_scheme, 383 Linux_x11_failed_to_become_owner_of_clipboard, 384 Android_unsupported_input_event_input_cb, 385 Android_unsupported_input_event_main_cb, 386 Android_read_msg_failed, 387 Android_write_msg_failed, 388 Android_msg_create, 389 Android_msg_resume, 390 Android_msg_pause, 391 Android_msg_focus, 392 Android_msg_no_focus, 393 Android_msg_set_native_window, 394 Android_msg_set_input_queue, 395 Android_msg_destroy, 396 Android_unknown_msg, 397 Android_loop_thread_started, 398 Android_loop_thread_done, 399 Android_native_activity_onstart, 400 Android_native_activity_onresume, 401 Android_native_activity_onsaveinstancestate, 402 Android_native_activity_onwindowfocuschanged, 403 Android_native_activity_onpause, 404 Android_native_activity_onstop, 405 Android_native_activity_onnativewindowcreated, 406 Android_native_activity_onnativewindowdestroyed, 407 Android_native_activity_oninputqueuecreated, 408 Android_native_activity_oninputqueuedestroyed, 409 Android_native_activity_onconfigurationchanged, 410 Android_native_activity_onlowmemory, 411 Android_native_activity_ondestroy, 412 Android_native_activity_done, 413 Android_native_activity_oncreate, 414 Android_create_thread_pipe_failed, 415 Android_native_activity_create_success, 416 Wgpu_swapchain_create_surface_failed, 417 Wgpu_swapchain_create_swapchain_failed, 418 Wgpu_swapchain_create_depth_stencil_texture_failed, 419 Wgpu_swapchain_create_depth_stencil_view_failed, 420 Wgpu_swapchain_create_msaa_texture_failed, 421 Wgpu_swapchain_create_msaa_view_failed, 422 Wgpu_request_device_status_error, 423 Wgpu_request_device_status_unknown, 424 Wgpu_request_adapter_status_unavailable, 425 Wgpu_request_adapter_status_error, 426 Wgpu_request_adapter_status_unknown, 427 Wgpu_create_instance_failed, 428 Image_data_size_mismatch, 429 Dropped_file_path_too_long, 430 Clipboard_string_too_big, 431 } 432 /++ 433 + sapp_logger 434 + 435 + Used in sapp_desc to provide a logging function. Please be aware that 436 + without logging function, sokol-app will be completely silent, e.g. it will 437 + not report errors or warnings. For maximum error verbosity, compile in 438 + debug mode (e.g. NDEBUG *not* defined) and install a logger (for instance 439 + the standard logging function from sokol_log.h). 440 +/ 441 extern(C) struct Logger { 442 extern(C) void function(const(char)*, uint, uint, const(char)*, uint, const(char)*, void*) func = null; 443 void* user_data = null; 444 } 445 /++ 446 + sokol-app initialization options, used as return value of sokol_main() 447 + or sapp_run() argument. 448 +/ 449 extern(C) struct Desc { 450 extern(C) void function() init_cb = null; 451 extern(C) void function() frame_cb = null; 452 extern(C) void function() cleanup_cb = null; 453 extern(C) void function(const Event*) event_cb = null; 454 void* user_data = null; 455 extern(C) void function(void*) init_userdata_cb = null; 456 extern(C) void function(void*) frame_userdata_cb = null; 457 extern(C) void function(void*) cleanup_userdata_cb = null; 458 extern(C) void function(const Event*, void*) event_userdata_cb = null; 459 int width = 0; 460 int height = 0; 461 int sample_count = 0; 462 int swap_interval = 0; 463 bool high_dpi = false; 464 bool fullscreen = false; 465 bool alpha = false; 466 const(char)* window_title = null; 467 bool enable_clipboard = false; 468 int clipboard_size = 0; 469 bool enable_dragndrop = false; 470 int max_dropped_files = 0; 471 int max_dropped_file_path_length = 0; 472 IconDesc icon = {}; 473 Allocator allocator = {}; 474 Logger logger = {}; 475 int gl_major_version = 0; 476 int gl_minor_version = 0; 477 bool win32_console_utf8 = false; 478 bool win32_console_create = false; 479 bool win32_console_attach = false; 480 const(char)* html5_canvas_selector = null; 481 bool html5_canvas_resize = false; 482 bool html5_preserve_drawing_buffer = false; 483 bool html5_premultiplied_alpha = false; 484 bool html5_ask_leave_site = false; 485 bool html5_update_document_title = false; 486 bool html5_bubble_mouse_events = false; 487 bool html5_bubble_touch_events = false; 488 bool html5_bubble_wheel_events = false; 489 bool html5_bubble_key_events = false; 490 bool html5_bubble_char_events = false; 491 bool html5_use_emsc_set_main_loop = false; 492 bool html5_emsc_set_main_loop_simulate_infinite_loop = false; 493 bool ios_keyboard_resizes_canvas = false; 494 } 495 /++ 496 + HTML5 specific: request and response structs for 497 + asynchronously loading dropped-file content. 498 +/ 499 enum Html5FetchError { 500 Fetch_error_no_error, 501 Fetch_error_buffer_too_small, 502 Fetch_error_other, 503 } 504 extern(C) struct Html5FetchResponse { 505 bool succeeded = false; 506 Html5FetchError error_code = Html5FetchError.Fetch_error_no_error; 507 int file_index = 0; 508 Range data = {}; 509 Range buffer = {}; 510 void* user_data = null; 511 } 512 extern(C) struct Html5FetchRequest { 513 int dropped_file_index = 0; 514 extern(C) void function(const Html5FetchResponse*) callback = null; 515 Range buffer = {}; 516 void* user_data = null; 517 } 518 /++ 519 + sapp_mouse_cursor 520 + 521 + Predefined cursor image definitions, set with sapp_set_mouse_cursor(sapp_mouse_cursor cursor) 522 +/ 523 enum MouseCursor { 524 Default = 0, 525 Arrow, 526 Ibeam, 527 Crosshair, 528 Pointing_hand, 529 Resize_ew, 530 Resize_ns, 531 Resize_nwse, 532 Resize_nesw, 533 Resize_all, 534 Not_allowed, 535 Num, 536 } 537 /++ 538 + returns true after sokol-app has been initialized 539 +/ 540 extern(C) bool sapp_isvalid() @system @nogc nothrow pure; 541 bool isvalid() @trusted @nogc nothrow pure { 542 return sapp_isvalid(); 543 } 544 /++ 545 + returns the current framebuffer width in pixels 546 +/ 547 extern(C) int sapp_width() @system @nogc nothrow pure; 548 int width() @trusted @nogc nothrow pure { 549 return sapp_width(); 550 } 551 /++ 552 + same as sapp_width(), but returns float 553 +/ 554 extern(C) float sapp_widthf() @system @nogc nothrow pure; 555 float widthf() @trusted @nogc nothrow pure { 556 return sapp_widthf(); 557 } 558 /++ 559 + returns the current framebuffer height in pixels 560 +/ 561 extern(C) int sapp_height() @system @nogc nothrow pure; 562 int height() @trusted @nogc nothrow pure { 563 return sapp_height(); 564 } 565 /++ 566 + same as sapp_height(), but returns float 567 +/ 568 extern(C) float sapp_heightf() @system @nogc nothrow pure; 569 float heightf() @trusted @nogc nothrow pure { 570 return sapp_heightf(); 571 } 572 /++ 573 + get default framebuffer color pixel format 574 +/ 575 extern(C) int sapp_color_format() @system @nogc nothrow pure; 576 int colorFormat() @trusted @nogc nothrow pure { 577 return sapp_color_format(); 578 } 579 /++ 580 + get default framebuffer depth pixel format 581 +/ 582 extern(C) int sapp_depth_format() @system @nogc nothrow pure; 583 int depthFormat() @trusted @nogc nothrow pure { 584 return sapp_depth_format(); 585 } 586 /++ 587 + get default framebuffer sample count 588 +/ 589 extern(C) int sapp_sample_count() @system @nogc nothrow pure; 590 int sampleCount() @trusted @nogc nothrow pure { 591 return sapp_sample_count(); 592 } 593 /++ 594 + returns true when high_dpi was requested and actually running in a high-dpi scenario 595 +/ 596 extern(C) bool sapp_high_dpi() @system @nogc nothrow pure; 597 bool highDpi() @trusted @nogc nothrow pure { 598 return sapp_high_dpi(); 599 } 600 /++ 601 + returns the dpi scaling factor (window pixels to framebuffer pixels) 602 +/ 603 extern(C) float sapp_dpi_scale() @system @nogc nothrow pure; 604 float dpiScale() @trusted @nogc nothrow pure { 605 return sapp_dpi_scale(); 606 } 607 /++ 608 + show or hide the mobile device onscreen keyboard 609 +/ 610 extern(C) void sapp_show_keyboard(bool show) @system @nogc nothrow pure; 611 void showKeyboard(bool show) @trusted @nogc nothrow pure { 612 sapp_show_keyboard(show); 613 } 614 /++ 615 + return true if the mobile device onscreen keyboard is currently shown 616 +/ 617 extern(C) bool sapp_keyboard_shown() @system @nogc nothrow pure; 618 bool keyboardShown() @trusted @nogc nothrow pure { 619 return sapp_keyboard_shown(); 620 } 621 /++ 622 + query fullscreen mode 623 +/ 624 extern(C) bool sapp_is_fullscreen() @system @nogc nothrow pure; 625 bool isFullscreen() @trusted @nogc nothrow pure { 626 return sapp_is_fullscreen(); 627 } 628 /++ 629 + toggle fullscreen mode 630 +/ 631 extern(C) void sapp_toggle_fullscreen() @system @nogc nothrow pure; 632 void toggleFullscreen() @trusted @nogc nothrow pure { 633 sapp_toggle_fullscreen(); 634 } 635 /++ 636 + show or hide the mouse cursor 637 +/ 638 extern(C) void sapp_show_mouse(bool show) @system @nogc nothrow pure; 639 void showMouse(bool show) @trusted @nogc nothrow pure { 640 sapp_show_mouse(show); 641 } 642 /++ 643 + show or hide the mouse cursor 644 +/ 645 extern(C) bool sapp_mouse_shown() @system @nogc nothrow pure; 646 bool mouseShown() @trusted @nogc nothrow pure { 647 return sapp_mouse_shown(); 648 } 649 /++ 650 + enable/disable mouse-pointer-lock mode 651 +/ 652 extern(C) void sapp_lock_mouse(bool lock) @system @nogc nothrow pure; 653 void lockMouse(bool lock) @trusted @nogc nothrow pure { 654 sapp_lock_mouse(lock); 655 } 656 /++ 657 + return true if in mouse-pointer-lock mode (this may toggle a few frames later) 658 +/ 659 extern(C) bool sapp_mouse_locked() @system @nogc nothrow pure; 660 bool mouseLocked() @trusted @nogc nothrow pure { 661 return sapp_mouse_locked(); 662 } 663 /++ 664 + set mouse cursor type 665 +/ 666 extern(C) void sapp_set_mouse_cursor(MouseCursor cursor) @system @nogc nothrow pure; 667 void setMouseCursor(MouseCursor cursor) @trusted @nogc nothrow pure { 668 sapp_set_mouse_cursor(cursor); 669 } 670 /++ 671 + get current mouse cursor type 672 +/ 673 extern(C) MouseCursor sapp_get_mouse_cursor() @system @nogc nothrow pure; 674 MouseCursor getMouseCursor() @trusted @nogc nothrow pure { 675 return sapp_get_mouse_cursor(); 676 } 677 /++ 678 + return the userdata pointer optionally provided in sapp_desc 679 +/ 680 extern(C) void* sapp_userdata() @system @nogc nothrow pure; 681 void* userdata() @trusted @nogc nothrow pure { 682 return sapp_userdata(); 683 } 684 /++ 685 + return a copy of the sapp_desc structure 686 +/ 687 extern(C) Desc sapp_query_desc() @system @nogc nothrow pure; 688 Desc queryDesc() @trusted @nogc nothrow pure { 689 return sapp_query_desc(); 690 } 691 /++ 692 + initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED) 693 +/ 694 extern(C) void sapp_request_quit() @system @nogc nothrow pure; 695 void requestQuit() @trusted @nogc nothrow pure { 696 sapp_request_quit(); 697 } 698 /++ 699 + cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received) 700 +/ 701 extern(C) void sapp_cancel_quit() @system @nogc nothrow pure; 702 void cancelQuit() @trusted @nogc nothrow pure { 703 sapp_cancel_quit(); 704 } 705 /++ 706 + initiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUESTED) 707 +/ 708 extern(C) void sapp_quit() @system @nogc nothrow pure; 709 void quit() @trusted @nogc nothrow pure { 710 sapp_quit(); 711 } 712 /++ 713 + call from inside event callback to consume the current event (don't forward to platform) 714 +/ 715 extern(C) void sapp_consume_event() @system @nogc nothrow pure; 716 void consumeEvent() @trusted @nogc nothrow pure { 717 sapp_consume_event(); 718 } 719 /++ 720 + get the current frame counter (for comparison with sapp_event.frame_count) 721 +/ 722 extern(C) ulong sapp_frame_count() @system @nogc nothrow pure; 723 ulong frameCount() @trusted @nogc nothrow pure { 724 return sapp_frame_count(); 725 } 726 /++ 727 + get an averaged/smoothed frame duration in seconds 728 +/ 729 extern(C) double sapp_frame_duration() @system @nogc nothrow pure; 730 double frameDuration() @trusted @nogc nothrow pure { 731 return sapp_frame_duration(); 732 } 733 /++ 734 + write string into clipboard 735 +/ 736 extern(C) void sapp_set_clipboard_string(const(char)* str) @system @nogc nothrow pure; 737 void setClipboardString(const(char)* str) @trusted @nogc nothrow pure { 738 sapp_set_clipboard_string(str); 739 } 740 /++ 741 + read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED) 742 +/ 743 extern(C) const(char)* sapp_get_clipboard_string() @system @nogc nothrow pure; 744 const(char)* getClipboardString() @trusted @nogc nothrow pure { 745 return sapp_get_clipboard_string(); 746 } 747 /++ 748 + set the window title (only on desktop platforms) 749 +/ 750 extern(C) void sapp_set_window_title(const(char)* str) @system @nogc nothrow pure; 751 void setWindowTitle(const(char)* str) @trusted @nogc nothrow pure { 752 sapp_set_window_title(str); 753 } 754 /++ 755 + set the window icon (only on Windows and Linux) 756 +/ 757 extern(C) void sapp_set_icon(const IconDesc* icon_desc) @system @nogc nothrow pure; 758 void setIcon(scope ref IconDesc icon_desc) @trusted @nogc nothrow pure { 759 sapp_set_icon(&icon_desc); 760 } 761 /++ 762 + gets the total number of dropped files (after an SAPP_EVENTTYPE_FILES_DROPPED event) 763 +/ 764 extern(C) int sapp_get_num_dropped_files() @system @nogc nothrow pure; 765 int getNumDroppedFiles() @trusted @nogc nothrow pure { 766 return sapp_get_num_dropped_files(); 767 } 768 /++ 769 + gets the dropped file paths 770 +/ 771 extern(C) const(char)* sapp_get_dropped_file_path(int index) @system @nogc nothrow pure; 772 const(char)* getDroppedFilePath(int index) @trusted @nogc nothrow pure { 773 return sapp_get_dropped_file_path(index); 774 } 775 /++ 776 + special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub) 777 +/ 778 extern(C) void sapp_run(const Desc* desc) @system @nogc nothrow pure; 779 void run(scope ref Desc desc) @trusted @nogc nothrow pure { 780 sapp_run(&desc); 781 } 782 /++ 783 + EGL: get EGLDisplay object 784 +/ 785 extern(C) const(void)* sapp_egl_get_display() @system @nogc nothrow pure; 786 const(void)* eglGetDisplay() @trusted @nogc nothrow pure { 787 return sapp_egl_get_display(); 788 } 789 /++ 790 + EGL: get EGLContext object 791 +/ 792 extern(C) const(void)* sapp_egl_get_context() @system @nogc nothrow pure; 793 const(void)* eglGetContext() @trusted @nogc nothrow pure { 794 return sapp_egl_get_context(); 795 } 796 /++ 797 + HTML5: enable or disable the hardwired "Leave Site?" dialog box 798 +/ 799 extern(C) void sapp_html5_ask_leave_site(bool ask) @system @nogc nothrow pure; 800 void html5AskLeaveSite(bool ask) @trusted @nogc nothrow pure { 801 sapp_html5_ask_leave_site(ask); 802 } 803 /++ 804 + HTML5: get byte size of a dropped file 805 +/ 806 extern(C) uint sapp_html5_get_dropped_file_size(int index) @system @nogc nothrow pure; 807 uint html5GetDroppedFileSize(int index) @trusted @nogc nothrow pure { 808 return sapp_html5_get_dropped_file_size(index); 809 } 810 /++ 811 + HTML5: asynchronously load the content of a dropped file 812 +/ 813 extern(C) void sapp_html5_fetch_dropped_file(const Html5FetchRequest* request) @system @nogc nothrow pure; 814 void html5FetchDroppedFile(scope ref Html5FetchRequest request) @trusted @nogc nothrow pure { 815 sapp_html5_fetch_dropped_file(&request); 816 } 817 /++ 818 + Metal: get bridged pointer to Metal device object 819 +/ 820 extern(C) const(void)* sapp_metal_get_device() @system @nogc nothrow pure; 821 const(void)* metalGetDevice() @trusted @nogc nothrow pure { 822 return sapp_metal_get_device(); 823 } 824 /++ 825 + Metal: get bridged pointer to MTKView's current drawable of type CAMetalDrawable 826 +/ 827 extern(C) const(void)* sapp_metal_get_current_drawable() @system @nogc nothrow pure; 828 const(void)* metalGetCurrentDrawable() @trusted @nogc nothrow pure { 829 return sapp_metal_get_current_drawable(); 830 } 831 /++ 832 + Metal: get bridged pointer to MTKView's depth-stencil texture of type MTLTexture 833 +/ 834 extern(C) const(void)* sapp_metal_get_depth_stencil_texture() @system @nogc nothrow pure; 835 const(void)* metalGetDepthStencilTexture() @trusted @nogc nothrow pure { 836 return sapp_metal_get_depth_stencil_texture(); 837 } 838 /++ 839 + Metal: get bridged pointer to MTKView's msaa-color-texture of type MTLTexture (may be null) 840 +/ 841 extern(C) const(void)* sapp_metal_get_msaa_color_texture() @system @nogc nothrow pure; 842 const(void)* metalGetMsaaColorTexture() @trusted @nogc nothrow pure { 843 return sapp_metal_get_msaa_color_texture(); 844 } 845 /++ 846 + macOS: get bridged pointer to macOS NSWindow 847 +/ 848 extern(C) const(void)* sapp_macos_get_window() @system @nogc nothrow pure; 849 const(void)* macosGetWindow() @trusted @nogc nothrow pure { 850 return sapp_macos_get_window(); 851 } 852 /++ 853 + iOS: get bridged pointer to iOS UIWindow 854 +/ 855 extern(C) const(void)* sapp_ios_get_window() @system @nogc nothrow pure; 856 const(void)* iosGetWindow() @trusted @nogc nothrow pure { 857 return sapp_ios_get_window(); 858 } 859 /++ 860 + D3D11: get pointer to ID3D11Device object 861 +/ 862 extern(C) const(void)* sapp_d3d11_get_device() @system @nogc nothrow pure; 863 const(void)* d3d11GetDevice() @trusted @nogc nothrow pure { 864 return sapp_d3d11_get_device(); 865 } 866 /++ 867 + D3D11: get pointer to ID3D11DeviceContext object 868 +/ 869 extern(C) const(void)* sapp_d3d11_get_device_context() @system @nogc nothrow pure; 870 const(void)* d3d11GetDeviceContext() @trusted @nogc nothrow pure { 871 return sapp_d3d11_get_device_context(); 872 } 873 /++ 874 + D3D11: get pointer to IDXGISwapChain object 875 +/ 876 extern(C) const(void)* sapp_d3d11_get_swap_chain() @system @nogc nothrow pure; 877 const(void)* d3d11GetSwapChain() @trusted @nogc nothrow pure { 878 return sapp_d3d11_get_swap_chain(); 879 } 880 /++ 881 + D3D11: get pointer to ID3D11RenderTargetView object for rendering 882 +/ 883 extern(C) const(void)* sapp_d3d11_get_render_view() @system @nogc nothrow pure; 884 const(void)* d3d11GetRenderView() @trusted @nogc nothrow pure { 885 return sapp_d3d11_get_render_view(); 886 } 887 /++ 888 + D3D11: get pointer ID3D11RenderTargetView object for msaa-resolve (may return null) 889 +/ 890 extern(C) const(void)* sapp_d3d11_get_resolve_view() @system @nogc nothrow pure; 891 const(void)* d3d11GetResolveView() @trusted @nogc nothrow pure { 892 return sapp_d3d11_get_resolve_view(); 893 } 894 /++ 895 + D3D11: get pointer ID3D11DepthStencilView 896 +/ 897 extern(C) const(void)* sapp_d3d11_get_depth_stencil_view() @system @nogc nothrow pure; 898 const(void)* d3d11GetDepthStencilView() @trusted @nogc nothrow pure { 899 return sapp_d3d11_get_depth_stencil_view(); 900 } 901 /++ 902 + Win32: get the HWND window handle 903 +/ 904 extern(C) const(void)* sapp_win32_get_hwnd() @system @nogc nothrow pure; 905 const(void)* win32GetHwnd() @trusted @nogc nothrow pure { 906 return sapp_win32_get_hwnd(); 907 } 908 /++ 909 + WebGPU: get WGPUDevice handle 910 +/ 911 extern(C) const(void)* sapp_wgpu_get_device() @system @nogc nothrow pure; 912 const(void)* wgpuGetDevice() @trusted @nogc nothrow pure { 913 return sapp_wgpu_get_device(); 914 } 915 /++ 916 + WebGPU: get swapchain's WGPUTextureView handle for rendering 917 +/ 918 extern(C) const(void)* sapp_wgpu_get_render_view() @system @nogc nothrow pure; 919 const(void)* wgpuGetRenderView() @trusted @nogc nothrow pure { 920 return sapp_wgpu_get_render_view(); 921 } 922 /++ 923 + WebGPU: get swapchain's MSAA-resolve WGPUTextureView (may return null) 924 +/ 925 extern(C) const(void)* sapp_wgpu_get_resolve_view() @system @nogc nothrow pure; 926 const(void)* wgpuGetResolveView() @trusted @nogc nothrow pure { 927 return sapp_wgpu_get_resolve_view(); 928 } 929 /++ 930 + WebGPU: get swapchain's WGPUTextureView for the depth-stencil surface 931 +/ 932 extern(C) const(void)* sapp_wgpu_get_depth_stencil_view() @system @nogc nothrow pure; 933 const(void)* wgpuGetDepthStencilView() @trusted @nogc nothrow pure { 934 return sapp_wgpu_get_depth_stencil_view(); 935 } 936 /++ 937 + GL: get framebuffer object 938 +/ 939 extern(C) uint sapp_gl_get_framebuffer() @system @nogc nothrow pure; 940 uint glGetFramebuffer() @trusted @nogc nothrow pure { 941 return sapp_gl_get_framebuffer(); 942 } 943 /++ 944 + GL: get major version 945 +/ 946 extern(C) int sapp_gl_get_major_version() @system @nogc nothrow pure; 947 int glGetMajorVersion() @trusted @nogc nothrow pure { 948 return sapp_gl_get_major_version(); 949 } 950 /++ 951 + GL: get minor version 952 +/ 953 extern(C) int sapp_gl_get_minor_version() @system @nogc nothrow pure; 954 int glGetMinorVersion() @trusted @nogc nothrow pure { 955 return sapp_gl_get_minor_version(); 956 } 957 /++ 958 + GL: return true if the context is GLES 959 +/ 960 extern(C) bool sapp_gl_is_gles() @system @nogc nothrow pure; 961 bool glIsGles() @trusted @nogc nothrow pure { 962 return sapp_gl_is_gles(); 963 } 964 /++ 965 + X11: get Window 966 +/ 967 extern(C) const(void)* sapp_x11_get_window() @system @nogc nothrow pure; 968 const(void)* x11GetWindow() @trusted @nogc nothrow pure { 969 return sapp_x11_get_window(); 970 } 971 /++ 972 + X11: get Display 973 +/ 974 extern(C) const(void)* sapp_x11_get_display() @system @nogc nothrow pure; 975 const(void)* x11GetDisplay() @trusted @nogc nothrow pure { 976 return sapp_x11_get_display(); 977 } 978 /++ 979 + Android: get native activity handle 980 +/ 981 extern(C) const(void)* sapp_android_get_native_activity() @system @nogc nothrow pure; 982 const(void)* androidGetNativeActivity() @trusted @nogc nothrow pure { 983 return sapp_android_get_native_activity(); 984 }