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