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