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