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 Macos_invalid_nsopengl_profile, 335 Metal_create_swapchain_depth_texture_failed, 336 Metal_create_swapchain_msaa_texture_failed, 337 Win32_load_opengl32_dll_failed, 338 Win32_create_helper_window_failed, 339 Win32_helper_window_getdc_failed, 340 Win32_dummy_context_set_pixelformat_failed, 341 Win32_create_dummy_context_failed, 342 Win32_dummy_context_make_current_failed, 343 Win32_get_pixelformat_attrib_failed, 344 Win32_wgl_find_pixelformat_failed, 345 Win32_wgl_describe_pixelformat_failed, 346 Win32_wgl_set_pixelformat_failed, 347 Win32_wgl_arb_create_context_required, 348 Win32_wgl_arb_create_context_profile_required, 349 Win32_wgl_opengl_version_not_supported, 350 Win32_wgl_opengl_profile_not_supported, 351 Win32_wgl_incompatible_device_context, 352 Win32_wgl_create_context_attribs_failed_other, 353 Win32_d3d11_create_device_and_swapchain_with_debug_failed, 354 Win32_d3d11_get_idxgifactory_failed, 355 Win32_d3d11_get_idxgiadapter_failed, 356 Win32_d3d11_query_interface_idxgidevice1_failed, 357 Win32_register_raw_input_devices_failed_mouse_lock, 358 Win32_register_raw_input_devices_failed_mouse_unlock, 359 Win32_get_raw_input_data_failed, 360 Win32_destroyicon_for_cursor_failed, 361 Linux_glx_load_libgl_failed, 362 Linux_glx_load_entry_points_failed, 363 Linux_glx_extension_not_found, 364 Linux_glx_query_version_failed, 365 Linux_glx_version_too_low, 366 Linux_glx_no_glxfbconfigs, 367 Linux_glx_no_suitable_glxfbconfig, 368 Linux_glx_get_visual_from_fbconfig_failed, 369 Linux_glx_required_extensions_missing, 370 Linux_glx_create_context_failed, 371 Linux_glx_create_window_failed, 372 Linux_x11_create_window_failed, 373 Linux_egl_bind_opengl_api_failed, 374 Linux_egl_bind_opengl_es_api_failed, 375 Linux_egl_get_display_failed, 376 Linux_egl_initialize_failed, 377 Linux_egl_no_configs, 378 Linux_egl_no_native_visual, 379 Linux_egl_get_visual_info_failed, 380 Linux_egl_create_window_surface_failed, 381 Linux_egl_create_context_failed, 382 Linux_egl_make_current_failed, 383 Linux_x11_open_display_failed, 384 Linux_x11_query_system_dpi_failed, 385 Linux_x11_dropped_file_uri_wrong_scheme, 386 Linux_x11_failed_to_become_owner_of_clipboard, 387 Android_unsupported_input_event_input_cb, 388 Android_unsupported_input_event_main_cb, 389 Android_read_msg_failed, 390 Android_write_msg_failed, 391 Android_msg_create, 392 Android_msg_resume, 393 Android_msg_pause, 394 Android_msg_focus, 395 Android_msg_no_focus, 396 Android_msg_set_native_window, 397 Android_msg_set_input_queue, 398 Android_msg_destroy, 399 Android_unknown_msg, 400 Android_loop_thread_started, 401 Android_loop_thread_done, 402 Android_native_activity_onstart, 403 Android_native_activity_onresume, 404 Android_native_activity_onsaveinstancestate, 405 Android_native_activity_onwindowfocuschanged, 406 Android_native_activity_onpause, 407 Android_native_activity_onstop, 408 Android_native_activity_onnativewindowcreated, 409 Android_native_activity_onnativewindowdestroyed, 410 Android_native_activity_oninputqueuecreated, 411 Android_native_activity_oninputqueuedestroyed, 412 Android_native_activity_onconfigurationchanged, 413 Android_native_activity_onlowmemory, 414 Android_native_activity_ondestroy, 415 Android_native_activity_done, 416 Android_native_activity_oncreate, 417 Android_create_thread_pipe_failed, 418 Android_native_activity_create_success, 419 Wgpu_device_lost, 420 Wgpu_device_log, 421 Wgpu_device_uncaptured_error, 422 Wgpu_swapchain_create_surface_failed, 423 Wgpu_swapchain_surface_get_capabilities_failed, 424 Wgpu_swapchain_create_depth_stencil_texture_failed, 425 Wgpu_swapchain_create_depth_stencil_view_failed, 426 Wgpu_swapchain_create_msaa_texture_failed, 427 Wgpu_swapchain_create_msaa_view_failed, 428 Wgpu_swapchain_getcurrenttexture_failed, 429 Wgpu_request_device_status_error, 430 Wgpu_request_device_status_unknown, 431 Wgpu_request_adapter_status_unavailable, 432 Wgpu_request_adapter_status_error, 433 Wgpu_request_adapter_status_unknown, 434 Wgpu_create_instance_failed, 435 Vulkan_required_instance_extension_function_missing, 436 Vulkan_alloc_device_memory_no_suitable_memory_type, 437 Vulkan_allocate_memory_failed, 438 Vulkan_create_instance_failed, 439 Vulkan_enumerate_physical_devices_failed, 440 Vulkan_no_physical_devices_found, 441 Vulkan_no_suitable_physical_device_found, 442 Vulkan_create_device_failed_extension_not_present, 443 Vulkan_create_device_failed_feature_not_present, 444 Vulkan_create_device_failed_initialization_failed, 445 Vulkan_create_device_failed_other, 446 Vulkan_create_surface_failed, 447 Vulkan_create_swapchain_failed, 448 Vulkan_swapchain_create_image_view_failed, 449 Vulkan_swapchain_create_image_failed, 450 Vulkan_swapchain_alloc_image_device_memory_failed, 451 Vulkan_swapchain_bind_image_memory_failed, 452 Vulkan_acquire_next_image_failed, 453 Vulkan_queue_present_failed, 454 Image_data_size_mismatch, 455 Dropped_file_path_too_long, 456 Clipboard_string_too_big, 457 } 458 /++ 459 + sapp_pixel_format 460 + 461 + Defines the pixel format for swapchain surfaces. 462 + 463 + NOTE: when using sokol_gfx.h do not assume that the underlying 464 + values are compatible with sg_pixel_format! 465 +/ 466 enum PixelFormat { 467 Default, 468 None, 469 Rgba8, 470 Srgb8a8, 471 Bgra8, 472 Sbgra8, 473 Depth, 474 Depth_stencil, 475 } 476 /++ 477 + sapp_environment 478 + 479 + Used to provide runtime environment information to the 480 + outside world (like default pixel formats and the backend 481 + 3D API device pointer) via a call to sapp_get_environment(). 482 + 483 + NOTE: when using sokol_gfx.h, don't assume that sapp_environment 484 + is binary compatible with sg_environment! Always use a translation 485 + function like sglue_environment() to populate sg_environment 486 + from sapp_environment! 487 +/ 488 extern(C) struct EnvironmentDefaults { 489 PixelFormat color_format = PixelFormat.Default; 490 PixelFormat depth_format = PixelFormat.Default; 491 int sample_count = 0; 492 } 493 extern(C) struct MetalEnvironment { 494 const(void)* device = null; 495 } 496 extern(C) struct D3d11Environment { 497 const(void)* device = null; 498 const(void)* device_context = null; 499 } 500 extern(C) struct WgpuEnvironment { 501 const(void)* device = null; 502 } 503 extern(C) struct VulkanEnvironment { 504 const(void)* instance = null; 505 const(void)* physical_device = null; 506 const(void)* device = null; 507 const(void)* queue = null; 508 uint queue_family_index = 0; 509 } 510 extern(C) struct Environment { 511 EnvironmentDefaults defaults = {}; 512 MetalEnvironment metal = {}; 513 D3d11Environment d3d11 = {}; 514 WgpuEnvironment wgpu = {}; 515 VulkanEnvironment vulkan = {}; 516 } 517 /++ 518 + sapp_swapchain 519 + 520 + Provides swapchain information for the current frame to the outside 521 + world via a call to sapp_get_swapchain(). 522 + 523 + NOTE: sapp_get_swapchain() must be called exactly once per frame since 524 + on some backends it will also acquire the next swapchain image. 525 + 526 + NOTE: when using sokol_gfx.h, don't assume that the sapp_swapchain struct 527 + has the same memory layout as sg_swapchain! Use the sokol_log.h helper 528 + function sglue_swapchain() to translate sapp_swapchain into a 529 + sg_swapchain instead. 530 +/ 531 extern(C) struct MetalSwapchain { 532 const(void)* current_drawable = null; 533 const(void)* depth_stencil_texture = null; 534 const(void)* msaa_color_texture = null; 535 } 536 extern(C) struct D3d11Swapchain { 537 const(void)* render_view = null; 538 const(void)* resolve_view = null; 539 const(void)* depth_stencil_view = null; 540 } 541 extern(C) struct WgpuSwapchain { 542 const(void)* render_view = null; 543 const(void)* resolve_view = null; 544 const(void)* depth_stencil_view = null; 545 } 546 extern(C) struct VulkanSwapchain { 547 const(void)* render_image = null; 548 const(void)* render_view = null; 549 const(void)* resolve_image = null; 550 const(void)* resolve_view = null; 551 const(void)* depth_stencil_image = null; 552 const(void)* depth_stencil_view = null; 553 const(void)* render_finished_semaphore = null; 554 const(void)* present_complete_semaphore = null; 555 } 556 extern(C) struct GlSwapchain { 557 uint framebuffer = 0; 558 } 559 extern(C) struct Swapchain { 560 int width = 0; 561 int height = 0; 562 int sample_count = 0; 563 PixelFormat color_format = PixelFormat.Default; 564 PixelFormat depth_format = PixelFormat.Default; 565 MetalSwapchain metal = {}; 566 D3d11Swapchain d3d11 = {}; 567 WgpuSwapchain wgpu = {}; 568 VulkanSwapchain vulkan = {}; 569 GlSwapchain gl = {}; 570 } 571 /++ 572 + sapp_logger 573 + 574 + Used in sapp_desc to provide a logging function. Please be aware that 575 + without logging function, sokol-app will be completely silent, e.g. it will 576 + not report errors or warnings. For maximum error verbosity, compile in 577 + debug mode (e.g. NDEBUG *not* defined) and install a logger (for instance 578 + the standard logging function from sokol_log.h). 579 +/ 580 extern(C) struct Logger { 581 extern(C) void function(const(char)*, uint, uint, const(char)*, uint, const(char)*, void*) func = null; 582 void* user_data = null; 583 } 584 /++ 585 + sokol-app initialization options, used as return value of sokol_main() 586 + or sapp_run() argument. 587 +/ 588 extern(C) struct GlDesc { 589 int major_version = 0; 590 int minor_version = 0; 591 } 592 extern(C) struct Win32Desc { 593 bool console_utf8 = false; 594 bool console_create = false; 595 bool console_attach = false; 596 } 597 extern(C) struct Html5Desc { 598 const(char)* canvas_selector = null; 599 bool canvas_resize = false; 600 bool preserve_drawing_buffer = false; 601 bool premultiplied_alpha = false; 602 bool ask_leave_site = false; 603 bool update_document_title = false; 604 bool bubble_mouse_events = false; 605 bool bubble_touch_events = false; 606 bool bubble_wheel_events = false; 607 bool bubble_key_events = false; 608 bool bubble_char_events = false; 609 bool use_emsc_set_main_loop = false; 610 bool emsc_set_main_loop_simulate_infinite_loop = false; 611 } 612 extern(C) struct IosDesc { 613 bool keyboard_resizes_canvas = false; 614 } 615 extern(C) struct Desc { 616 extern(C) void function() init_cb = null; 617 extern(C) void function() frame_cb = null; 618 extern(C) void function() cleanup_cb = null; 619 extern(C) void function(const Event*) event_cb = null; 620 void* user_data = null; 621 extern(C) void function(void*) init_userdata_cb = null; 622 extern(C) void function(void*) frame_userdata_cb = null; 623 extern(C) void function(void*) cleanup_userdata_cb = null; 624 extern(C) void function(const Event*, void*) event_userdata_cb = null; 625 int width = 0; 626 int height = 0; 627 int sample_count = 0; 628 int swap_interval = 0; 629 bool high_dpi = false; 630 bool fullscreen = false; 631 bool alpha = false; 632 const(char)* window_title = null; 633 bool enable_clipboard = false; 634 int clipboard_size = 0; 635 bool enable_dragndrop = false; 636 int max_dropped_files = 0; 637 int max_dropped_file_path_length = 0; 638 IconDesc icon = {}; 639 Allocator allocator = {}; 640 Logger logger = {}; 641 GlDesc gl = {}; 642 Win32Desc win32 = {}; 643 Html5Desc html5 = {}; 644 IosDesc ios = {}; 645 } 646 /++ 647 + HTML5 specific: request and response structs for 648 + asynchronously loading dropped-file content. 649 +/ 650 enum Html5FetchError { 651 Fetch_error_no_error, 652 Fetch_error_buffer_too_small, 653 Fetch_error_other, 654 } 655 extern(C) struct Html5FetchResponse { 656 bool succeeded = false; 657 Html5FetchError error_code = Html5FetchError.Fetch_error_no_error; 658 int file_index = 0; 659 Range data = {}; 660 Range buffer = {}; 661 void* user_data = null; 662 } 663 extern(C) struct Html5FetchRequest { 664 int dropped_file_index = 0; 665 extern(C) void function(const Html5FetchResponse*) callback = null; 666 Range buffer = {}; 667 void* user_data = null; 668 } 669 /++ 670 + sapp_mouse_cursor 671 + 672 + Predefined cursor image definitions, set with sapp_set_mouse_cursor(sapp_mouse_cursor cursor) 673 +/ 674 enum MouseCursor { 675 Default = 0, 676 Arrow, 677 Ibeam, 678 Crosshair, 679 Pointing_hand, 680 Resize_ew, 681 Resize_ns, 682 Resize_nwse, 683 Resize_nesw, 684 Resize_all, 685 Not_allowed, 686 Custom_0, 687 Custom_1, 688 Custom_2, 689 Custom_3, 690 Custom_4, 691 Custom_5, 692 Custom_6, 693 Custom_7, 694 Custom_8, 695 Custom_9, 696 Custom_10, 697 Custom_11, 698 Custom_12, 699 Custom_13, 700 Custom_14, 701 Custom_15, 702 Num, 703 } 704 /++ 705 + returns true after sokol-app has been initialized 706 +/ 707 extern(C) bool sapp_isvalid() @system @nogc nothrow pure; 708 bool isvalid() @trusted @nogc nothrow pure { 709 return sapp_isvalid(); 710 } 711 /++ 712 + returns the current framebuffer width in pixels 713 +/ 714 extern(C) int sapp_width() @system @nogc nothrow pure; 715 int width() @trusted @nogc nothrow pure { 716 return sapp_width(); 717 } 718 /++ 719 + same as sapp_width(), but returns float 720 +/ 721 extern(C) float sapp_widthf() @system @nogc nothrow pure; 722 float widthf() @trusted @nogc nothrow pure { 723 return sapp_widthf(); 724 } 725 /++ 726 + returns the current framebuffer height in pixels 727 +/ 728 extern(C) int sapp_height() @system @nogc nothrow pure; 729 int height() @trusted @nogc nothrow pure { 730 return sapp_height(); 731 } 732 /++ 733 + same as sapp_height(), but returns float 734 +/ 735 extern(C) float sapp_heightf() @system @nogc nothrow pure; 736 float heightf() @trusted @nogc nothrow pure { 737 return sapp_heightf(); 738 } 739 /++ 740 + get default framebuffer color pixel format 741 +/ 742 extern(C) PixelFormat sapp_color_format() @system @nogc nothrow pure; 743 PixelFormat colorFormat() @trusted @nogc nothrow pure { 744 return sapp_color_format(); 745 } 746 /++ 747 + get default framebuffer depth pixel format 748 +/ 749 extern(C) PixelFormat sapp_depth_format() @system @nogc nothrow pure; 750 PixelFormat depthFormat() @trusted @nogc nothrow pure { 751 return sapp_depth_format(); 752 } 753 /++ 754 + get default framebuffer sample count 755 +/ 756 extern(C) int sapp_sample_count() @system @nogc nothrow pure; 757 int sampleCount() @trusted @nogc nothrow pure { 758 return sapp_sample_count(); 759 } 760 /++ 761 + returns true when high_dpi was requested and actually running in a high-dpi scenario 762 +/ 763 extern(C) bool sapp_high_dpi() @system @nogc nothrow pure; 764 bool highDpi() @trusted @nogc nothrow pure { 765 return sapp_high_dpi(); 766 } 767 /++ 768 + returns the dpi scaling factor (window pixels to framebuffer pixels) 769 +/ 770 extern(C) float sapp_dpi_scale() @system @nogc nothrow pure; 771 float dpiScale() @trusted @nogc nothrow pure { 772 return sapp_dpi_scale(); 773 } 774 /++ 775 + show or hide the mobile device onscreen keyboard 776 +/ 777 extern(C) void sapp_show_keyboard(bool show) @system @nogc nothrow pure; 778 void showKeyboard(bool show) @trusted @nogc nothrow pure { 779 sapp_show_keyboard(show); 780 } 781 /++ 782 + return true if the mobile device onscreen keyboard is currently shown 783 +/ 784 extern(C) bool sapp_keyboard_shown() @system @nogc nothrow pure; 785 bool keyboardShown() @trusted @nogc nothrow pure { 786 return sapp_keyboard_shown(); 787 } 788 /++ 789 + query fullscreen mode 790 +/ 791 extern(C) bool sapp_is_fullscreen() @system @nogc nothrow pure; 792 bool isFullscreen() @trusted @nogc nothrow pure { 793 return sapp_is_fullscreen(); 794 } 795 /++ 796 + toggle fullscreen mode 797 +/ 798 extern(C) void sapp_toggle_fullscreen() @system @nogc nothrow pure; 799 void toggleFullscreen() @trusted @nogc nothrow pure { 800 sapp_toggle_fullscreen(); 801 } 802 /++ 803 + show or hide the mouse cursor 804 +/ 805 extern(C) void sapp_show_mouse(bool show) @system @nogc nothrow pure; 806 void showMouse(bool show) @trusted @nogc nothrow pure { 807 sapp_show_mouse(show); 808 } 809 /++ 810 + show or hide the mouse cursor 811 +/ 812 extern(C) bool sapp_mouse_shown() @system @nogc nothrow pure; 813 bool mouseShown() @trusted @nogc nothrow pure { 814 return sapp_mouse_shown(); 815 } 816 /++ 817 + enable/disable mouse-pointer-lock mode 818 +/ 819 extern(C) void sapp_lock_mouse(bool lock) @system @nogc nothrow pure; 820 void lockMouse(bool lock) @trusted @nogc nothrow pure { 821 sapp_lock_mouse(lock); 822 } 823 /++ 824 + return true if in mouse-pointer-lock mode (this may toggle a few frames later) 825 +/ 826 extern(C) bool sapp_mouse_locked() @system @nogc nothrow pure; 827 bool mouseLocked() @trusted @nogc nothrow pure { 828 return sapp_mouse_locked(); 829 } 830 /++ 831 + set mouse cursor type 832 +/ 833 extern(C) void sapp_set_mouse_cursor(MouseCursor cursor) @system @nogc nothrow pure; 834 void setMouseCursor(MouseCursor cursor) @trusted @nogc nothrow pure { 835 sapp_set_mouse_cursor(cursor); 836 } 837 /++ 838 + get current mouse cursor type 839 +/ 840 extern(C) MouseCursor sapp_get_mouse_cursor() @system @nogc nothrow pure; 841 MouseCursor getMouseCursor() @trusted @nogc nothrow pure { 842 return sapp_get_mouse_cursor(); 843 } 844 /++ 845 + associate a custom mouse cursor image to a sapp_mouse_cursor enum entry 846 +/ 847 extern(C) MouseCursor sapp_bind_mouse_cursor_image(MouseCursor cursor, const ImageDesc* desc) @system @nogc nothrow pure; 848 MouseCursor bindMouseCursorImage(MouseCursor cursor, scope ref ImageDesc desc) @trusted @nogc nothrow pure { 849 return sapp_bind_mouse_cursor_image(cursor, &desc); 850 } 851 /++ 852 + restore the sapp_mouse_cursor enum entry to it's default system appearance 853 +/ 854 extern(C) void sapp_unbind_mouse_cursor_image(MouseCursor cursor) @system @nogc nothrow pure; 855 void unbindMouseCursorImage(MouseCursor cursor) @trusted @nogc nothrow pure { 856 sapp_unbind_mouse_cursor_image(cursor); 857 } 858 /++ 859 + return the userdata pointer optionally provided in sapp_desc 860 +/ 861 extern(C) void* sapp_userdata() @system @nogc nothrow pure; 862 void* userdata() @trusted @nogc nothrow pure { 863 return sapp_userdata(); 864 } 865 /++ 866 + return a copy of the sapp_desc structure 867 +/ 868 extern(C) Desc sapp_query_desc() @system @nogc nothrow pure; 869 Desc queryDesc() @trusted @nogc nothrow pure { 870 return sapp_query_desc(); 871 } 872 /++ 873 + initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED) 874 +/ 875 extern(C) void sapp_request_quit() @system @nogc nothrow pure; 876 void requestQuit() @trusted @nogc nothrow pure { 877 sapp_request_quit(); 878 } 879 /++ 880 + cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received) 881 +/ 882 extern(C) void sapp_cancel_quit() @system @nogc nothrow pure; 883 void cancelQuit() @trusted @nogc nothrow pure { 884 sapp_cancel_quit(); 885 } 886 /++ 887 + initiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUESTED) 888 +/ 889 extern(C) void sapp_quit() @system @nogc nothrow pure; 890 void quit() @trusted @nogc nothrow pure { 891 sapp_quit(); 892 } 893 /++ 894 + call from inside event callback to consume the current event (don't forward to platform) 895 +/ 896 extern(C) void sapp_consume_event() @system @nogc nothrow pure; 897 void consumeEvent() @trusted @nogc nothrow pure { 898 sapp_consume_event(); 899 } 900 /++ 901 + get the current frame counter (for comparison with sapp_event.frame_count) 902 +/ 903 extern(C) ulong sapp_frame_count() @system @nogc nothrow pure; 904 ulong frameCount() @trusted @nogc nothrow pure { 905 return sapp_frame_count(); 906 } 907 /++ 908 + get an averaged/smoothed frame duration in seconds 909 +/ 910 extern(C) double sapp_frame_duration() @system @nogc nothrow pure; 911 double frameDuration() @trusted @nogc nothrow pure { 912 return sapp_frame_duration(); 913 } 914 /++ 915 + write string into clipboard 916 +/ 917 extern(C) void sapp_set_clipboard_string(const(char)* str) @system @nogc nothrow pure; 918 void setClipboardString(const(char)* str) @trusted @nogc nothrow pure { 919 sapp_set_clipboard_string(str); 920 } 921 /++ 922 + read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED) 923 +/ 924 extern(C) const(char)* sapp_get_clipboard_string() @system @nogc nothrow pure; 925 const(char)* getClipboardString() @trusted @nogc nothrow pure { 926 return sapp_get_clipboard_string(); 927 } 928 /++ 929 + set the window title (only on desktop platforms) 930 +/ 931 extern(C) void sapp_set_window_title(const(char)* str) @system @nogc nothrow pure; 932 void setWindowTitle(const(char)* str) @trusted @nogc nothrow pure { 933 sapp_set_window_title(str); 934 } 935 /++ 936 + set the window icon (only on Windows and Linux) 937 +/ 938 extern(C) void sapp_set_icon(const IconDesc* icon_desc) @system @nogc nothrow pure; 939 void setIcon(scope ref IconDesc icon_desc) @trusted @nogc nothrow pure { 940 sapp_set_icon(&icon_desc); 941 } 942 /++ 943 + gets the total number of dropped files (after an SAPP_EVENTTYPE_FILES_DROPPED event) 944 +/ 945 extern(C) int sapp_get_num_dropped_files() @system @nogc nothrow pure; 946 int getNumDroppedFiles() @trusted @nogc nothrow pure { 947 return sapp_get_num_dropped_files(); 948 } 949 /++ 950 + gets the dropped file paths 951 +/ 952 extern(C) const(char)* sapp_get_dropped_file_path(int index) @system @nogc nothrow pure; 953 const(char)* getDroppedFilePath(int index) @trusted @nogc nothrow pure { 954 return sapp_get_dropped_file_path(index); 955 } 956 /++ 957 + special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub) 958 +/ 959 extern(C) void sapp_run(const Desc* desc) @system @nogc nothrow pure; 960 void run(scope ref Desc desc) @trusted @nogc nothrow pure { 961 sapp_run(&desc); 962 } 963 /++ 964 + get runtime environment information 965 +/ 966 extern(C) Environment sapp_get_environment() @system @nogc nothrow pure; 967 Environment getEnvironment() @trusted @nogc nothrow pure { 968 return sapp_get_environment(); 969 } 970 /++ 971 + get current frame's swapchain information (call once per frame!) 972 +/ 973 extern(C) Swapchain sapp_get_swapchain() @system @nogc nothrow pure; 974 Swapchain getSwapchain() @trusted @nogc nothrow pure { 975 return sapp_get_swapchain(); 976 } 977 /++ 978 + EGL: get EGLDisplay object 979 +/ 980 extern(C) const(void)* sapp_egl_get_display() @system @nogc nothrow pure; 981 const(void)* eglGetDisplay() @trusted @nogc nothrow pure { 982 return sapp_egl_get_display(); 983 } 984 /++ 985 + EGL: get EGLContext object 986 +/ 987 extern(C) const(void)* sapp_egl_get_context() @system @nogc nothrow pure; 988 const(void)* eglGetContext() @trusted @nogc nothrow pure { 989 return sapp_egl_get_context(); 990 } 991 /++ 992 + HTML5: enable or disable the hardwired "Leave Site?" dialog box 993 +/ 994 extern(C) void sapp_html5_ask_leave_site(bool ask) @system @nogc nothrow pure; 995 void html5AskLeaveSite(bool ask) @trusted @nogc nothrow pure { 996 sapp_html5_ask_leave_site(ask); 997 } 998 /++ 999 + HTML5: get byte size of a dropped file 1000 +/ 1001 extern(C) uint sapp_html5_get_dropped_file_size(int index) @system @nogc nothrow pure; 1002 uint html5GetDroppedFileSize(int index) @trusted @nogc nothrow pure { 1003 return sapp_html5_get_dropped_file_size(index); 1004 } 1005 /++ 1006 + HTML5: asynchronously load the content of a dropped file 1007 +/ 1008 extern(C) void sapp_html5_fetch_dropped_file(const Html5FetchRequest* request) @system @nogc nothrow pure; 1009 void html5FetchDroppedFile(scope ref Html5FetchRequest request) @trusted @nogc nothrow pure { 1010 sapp_html5_fetch_dropped_file(&request); 1011 } 1012 /++ 1013 + macOS: get bridged pointer to macOS NSWindow 1014 +/ 1015 extern(C) const(void)* sapp_macos_get_window() @system @nogc nothrow pure; 1016 const(void)* macosGetWindow() @trusted @nogc nothrow pure { 1017 return sapp_macos_get_window(); 1018 } 1019 /++ 1020 + iOS: get bridged pointer to iOS UIWindow 1021 +/ 1022 extern(C) const(void)* sapp_ios_get_window() @system @nogc nothrow pure; 1023 const(void)* iosGetWindow() @trusted @nogc nothrow pure { 1024 return sapp_ios_get_window(); 1025 } 1026 /++ 1027 + D3D11: get pointer to IDXGISwapChain object 1028 +/ 1029 extern(C) const(void)* sapp_d3d11_get_swap_chain() @system @nogc nothrow pure; 1030 const(void)* d3d11GetSwapChain() @trusted @nogc nothrow pure { 1031 return sapp_d3d11_get_swap_chain(); 1032 } 1033 /++ 1034 + Win32: get the HWND window handle 1035 +/ 1036 extern(C) const(void)* sapp_win32_get_hwnd() @system @nogc nothrow pure; 1037 const(void)* win32GetHwnd() @trusted @nogc nothrow pure { 1038 return sapp_win32_get_hwnd(); 1039 } 1040 /++ 1041 + GL: get major version 1042 +/ 1043 extern(C) int sapp_gl_get_major_version() @system @nogc nothrow pure; 1044 int glGetMajorVersion() @trusted @nogc nothrow pure { 1045 return sapp_gl_get_major_version(); 1046 } 1047 /++ 1048 + GL: get minor version 1049 +/ 1050 extern(C) int sapp_gl_get_minor_version() @system @nogc nothrow pure; 1051 int glGetMinorVersion() @trusted @nogc nothrow pure { 1052 return sapp_gl_get_minor_version(); 1053 } 1054 /++ 1055 + GL: return true if the context is GLES 1056 +/ 1057 extern(C) bool sapp_gl_is_gles() @system @nogc nothrow pure; 1058 bool glIsGles() @trusted @nogc nothrow pure { 1059 return sapp_gl_is_gles(); 1060 } 1061 /++ 1062 + X11: get Window 1063 +/ 1064 extern(C) const(void)* sapp_x11_get_window() @system @nogc nothrow pure; 1065 const(void)* x11GetWindow() @trusted @nogc nothrow pure { 1066 return sapp_x11_get_window(); 1067 } 1068 /++ 1069 + X11: get Display 1070 +/ 1071 extern(C) const(void)* sapp_x11_get_display() @system @nogc nothrow pure; 1072 const(void)* x11GetDisplay() @trusted @nogc nothrow pure { 1073 return sapp_x11_get_display(); 1074 } 1075 /++ 1076 + Android: get native activity handle 1077 +/ 1078 extern(C) const(void)* sapp_android_get_native_activity() @system @nogc nothrow pure; 1079 const(void)* androidGetNativeActivity() @trusted @nogc nothrow pure { 1080 return sapp_android_get_native_activity(); 1081 }