// // This file was auto-generated using the following command: // // jai generate.jai // SDL_PLATFORM_APPLE :: 1; SDL_PLATFORM_MACOS :: 1; SDL_MAX_SINT8 :: cast(Sint8) 0x7F; SDL_MIN_SINT8 :: cast,trunc(Sint8) (~0x7F); SDL_MAX_UINT8 :: cast(Uint8) 0xFF; SDL_MIN_UINT8 :: cast(Uint8) 0x00; SDL_MAX_SINT16 :: cast(Sint16) 0x7FFF; SDL_MIN_SINT16 :: cast,trunc(Sint16) (~0x7FFF); SDL_MAX_UINT16 :: cast(Uint16) 0xFFFF; SDL_MIN_UINT16 :: cast(Uint16) 0x0000; SDL_MAX_SINT32 :: cast(Sint32) 0x7FFFFFFF; SDL_MIN_SINT32 :: cast,trunc(Sint32) (~0x7FFFFFFF); SDL_MAX_UINT32 :: cast(Uint32) 0xFFFFFFFF; SDL_MIN_UINT32 :: cast(Uint32) 0x00000000; SDL_FLT_EPSILON :: 1.1920928955078125e-07; SDL_PRILL_PREFIX :: "ll"; SDL_INVALID_UNICODE_CODEPOINT :: 0xFFFD; SDL_PI_D :: 3.141592653589793238462643383279502884; SDL_PI_F :: 3.141592653589793238462643383279502884; SDL_ICONV_ERROR :: cast,trunc(u64) -1; SDL_ICONV_E2BIG :: cast,trunc(u64) -2; SDL_ICONV_EILSEQ :: cast,trunc(u64) -3; SDL_ICONV_EINVAL :: cast,trunc(u64) -4; SDL_ASSERT_LEVEL :: 2; SDL_NULL_WHILE_LOOP_CONDITION :: 0; SDL_LIL_ENDIAN :: 1234; SDL_BIG_ENDIAN :: 4321; SDL_BYTEORDER :: SDL_LIL_ENDIAN; SDL_FLOATWORDORDER :: SDL_BYTEORDER; SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER :: "SDL.thread.create.entry_function"; SDL_PROP_THREAD_CREATE_NAME_STRING :: "SDL.thread.create.name"; SDL_PROP_THREAD_CREATE_USERDATA_POINTER :: "SDL.thread.create.userdata"; SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER :: "SDL.thread.create.stacksize"; SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER :: "SDL.iostream.windows.handle"; SDL_PROP_IOSTREAM_STDIO_FILE_POINTER :: "SDL.iostream.stdio.file"; SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER :: "SDL.iostream.file_descriptor"; SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER :: "SDL.iostream.android.aasset"; SDL_PROP_IOSTREAM_MEMORY_POINTER :: "SDL.iostream.memory.base"; SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER :: "SDL.iostream.memory.size"; SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER :: "SDL.iostream.dynamic.memory"; SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER :: "SDL.iostream.dynamic.chunksize"; SDL_AUDIO_MASK_BITSIZE :: 0xFF; SDL_AUDIO_MASK_FLOAT :: 1<<8; SDL_AUDIO_MASK_BIG_ENDIAN :: 1<<12; SDL_AUDIO_MASK_SIGNED :: 1<<15; SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK :: cast(SDL_AudioDeviceID) 0xFFFFFFFF; SDL_AUDIO_DEVICE_DEFAULT_RECORDING :: cast(SDL_AudioDeviceID) 0xFFFFFFFE; SDL_BLENDMODE_NONE :: 0x00000000; SDL_BLENDMODE_BLEND :: 0x00000001; SDL_BLENDMODE_BLEND_PREMULTIPLIED :: 0x00000010; SDL_BLENDMODE_ADD :: 0x00000002; SDL_BLENDMODE_ADD_PREMULTIPLIED :: 0x00000020; SDL_BLENDMODE_MOD :: 0x00000004; SDL_BLENDMODE_MUL :: 0x00000008; SDL_BLENDMODE_INVALID :: 0x7FFFFFFF; SDL_ALPHA_OPAQUE :: 255; SDL_ALPHA_OPAQUE_FLOAT :: 1.0; SDL_ALPHA_TRANSPARENT :: 0; SDL_ALPHA_TRANSPARENT_FLOAT :: 0.0; SDL_SURFACE_PREALLOCATED :: 0x00000001; SDL_SURFACE_LOCK_NEEDED :: 0x00000002; SDL_SURFACE_LOCKED :: 0x00000004; SDL_SURFACE_SIMD_ALIGNED :: 0x00000008; SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT :: "SDL.surface.SDR_white_point"; SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT :: "SDL.surface.HDR_headroom"; SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING :: "SDL.surface.tonemap"; SDL_CACHELINE_SIZE :: 128; SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER :: "SDL.video.wayland.wl_display"; SDL_WINDOWPOS_UNDEFINED_MASK :: 0x1FFF0000; SDL_WINDOWPOS_CENTERED_MASK :: 0x2FFF0000; SDL_GL_CONTEXT_PROFILE_CORE :: 0x0001; SDL_GL_CONTEXT_PROFILE_COMPATIBILITY :: 0x0002; SDL_GL_CONTEXT_PROFILE_ES :: 0x0004; SDL_GL_CONTEXT_DEBUG_FLAG :: 0x0001; SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG :: 0x0002; SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG :: 0x0004; SDL_GL_CONTEXT_RESET_ISOLATION_FLAG :: 0x0008; SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE :: 0x0000; SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH :: 0x0001; SDL_GL_CONTEXT_RESET_NO_NOTIFICATION :: 0x0000; SDL_GL_CONTEXT_RESET_LOSE_CONTEXT :: 0x0001; SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN :: "SDL.display.HDR_enabled"; SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER :: "SDL.display.KMSDRM.panel_orientation"; SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN :: "SDL.window.create.always_on_top"; SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN :: "SDL.window.create.borderless"; SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN :: "SDL.window.create.focusable"; SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN :: "SDL.window.create.external_graphics_context"; SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER :: "SDL.window.create.flags"; SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN :: "SDL.window.create.fullscreen"; SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER :: "SDL.window.create.height"; SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN :: "SDL.window.create.hidden"; SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN :: "SDL.window.create.high_pixel_density"; SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN :: "SDL.window.create.maximized"; SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN :: "SDL.window.create.menu"; SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN :: "SDL.window.create.metal"; SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN :: "SDL.window.create.minimized"; SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN :: "SDL.window.create.modal"; SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN :: "SDL.window.create.mouse_grabbed"; SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN :: "SDL.window.create.opengl"; SDL_PROP_WINDOW_CREATE_PARENT_POINTER :: "SDL.window.create.parent"; SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN :: "SDL.window.create.resizable"; SDL_PROP_WINDOW_CREATE_TITLE_STRING :: "SDL.window.create.title"; SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN :: "SDL.window.create.transparent"; SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN :: "SDL.window.create.tooltip"; SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN :: "SDL.window.create.utility"; SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN :: "SDL.window.create.vulkan"; SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER :: "SDL.window.create.width"; SDL_PROP_WINDOW_CREATE_X_NUMBER :: "SDL.window.create.x"; SDL_PROP_WINDOW_CREATE_Y_NUMBER :: "SDL.window.create.y"; SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER :: "SDL.window.create.cocoa.window"; SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER :: "SDL.window.create.cocoa.view"; SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN :: "SDL.window.create.wayland.surface_role_custom"; SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN :: "SDL.window.create.wayland.create_egl_window"; SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER :: "SDL.window.create.wayland.wl_surface"; SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER :: "SDL.window.create.win32.hwnd"; SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER :: "SDL.window.create.win32.pixel_format_hwnd"; SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER :: "SDL.window.create.x11.window"; SDL_PROP_WINDOW_SHAPE_POINTER :: "SDL.window.shape"; SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN :: "SDL.window.HDR_enabled"; SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT :: "SDL.window.SDR_white_level"; SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT :: "SDL.window.HDR_headroom"; SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER :: "SDL.window.android.window"; SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER :: "SDL.window.android.surface"; SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER :: "SDL.window.uikit.window"; SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER :: "SDL.window.uikit.metal_view_tag"; SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER :: "SDL.window.uikit.opengl.framebuffer"; SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER :: "SDL.window.uikit.opengl.renderbuffer"; SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER :: "SDL.window.uikit.opengl.resolve_framebuffer"; SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER :: "SDL.window.kmsdrm.dev_index"; SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER :: "SDL.window.kmsdrm.drm_fd"; SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER :: "SDL.window.kmsdrm.gbm_dev"; SDL_PROP_WINDOW_COCOA_WINDOW_POINTER :: "SDL.window.cocoa.window"; SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER :: "SDL.window.cocoa.metal_view_tag"; SDL_PROP_WINDOW_OPENVR_OVERLAY_ID :: "SDL.window.openvr.overlay_id"; SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER :: "SDL.window.vivante.display"; SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER :: "SDL.window.vivante.window"; SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER :: "SDL.window.vivante.surface"; SDL_PROP_WINDOW_WIN32_HWND_POINTER :: "SDL.window.win32.hwnd"; SDL_PROP_WINDOW_WIN32_HDC_POINTER :: "SDL.window.win32.hdc"; SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER :: "SDL.window.win32.instance"; SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER :: "SDL.window.wayland.display"; SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER :: "SDL.window.wayland.surface"; SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER :: "SDL.window.wayland.viewport"; SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER :: "SDL.window.wayland.egl_window"; SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER :: "SDL.window.wayland.xdg_surface"; SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER :: "SDL.window.wayland.xdg_toplevel"; SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING :: "SDL.window.wayland.xdg_toplevel_export_handle"; SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER :: "SDL.window.wayland.xdg_popup"; SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER :: "SDL.window.wayland.xdg_positioner"; SDL_PROP_WINDOW_X11_DISPLAY_POINTER :: "SDL.window.x11.display"; SDL_PROP_WINDOW_X11_SCREEN_NUMBER :: "SDL.window.x11.screen"; SDL_PROP_WINDOW_X11_WINDOW_NUMBER :: "SDL.window.x11.window"; SDL_WINDOW_SURFACE_VSYNC_DISABLED :: 0; SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE :: -1; SDL_PROP_FILE_DIALOG_FILTERS_POINTER :: "SDL.filedialog.filters"; SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER :: "SDL.filedialog.nfilters"; SDL_PROP_FILE_DIALOG_WINDOW_POINTER :: "SDL.filedialog.window"; SDL_PROP_FILE_DIALOG_LOCATION_STRING :: "SDL.filedialog.location"; SDL_PROP_FILE_DIALOG_MANY_BOOLEAN :: "SDL.filedialog.many"; SDL_PROP_FILE_DIALOG_TITLE_STRING :: "SDL.filedialog.title"; SDL_PROP_FILE_DIALOG_ACCEPT_STRING :: "SDL.filedialog.accept"; SDL_PROP_FILE_DIALOG_CANCEL_STRING :: "SDL.filedialog.cancel"; SDL_STANDARD_GRAVITY :: 9.80665; SDL_JOYSTICK_AXIS_MAX :: 32767; SDL_JOYSTICK_AXIS_MIN :: -32768; SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN :: "SDL.joystick.cap.mono_led"; SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN :: "SDL.joystick.cap.rgb_led"; SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN :: "SDL.joystick.cap.player_led"; SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN :: "SDL.joystick.cap.rumble"; SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN :: "SDL.joystick.cap.trigger_rumble"; SDL_HAT_CENTERED :: 0x00; SDL_HAT_UP :: 0x01; SDL_HAT_RIGHT :: 0x02; SDL_HAT_DOWN :: 0x04; SDL_HAT_LEFT :: 0x08; SDL_HAT_RIGHTUP :: SDL_HAT_RIGHT|SDL_HAT_UP; SDL_HAT_RIGHTDOWN :: SDL_HAT_RIGHT|SDL_HAT_DOWN; SDL_HAT_LEFTUP :: SDL_HAT_LEFT|SDL_HAT_UP; SDL_HAT_LEFTDOWN :: SDL_HAT_LEFT|SDL_HAT_DOWN; SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN :: SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN; SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN :: SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN; SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN :: SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN; SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN :: SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN; SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN :: SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN; SDLK_EXTENDED_MASK :: 1 << 29; SDLK_SCANCODE_MASK :: 1 << 30; SDLK_UNKNOWN :: 0x00000000; SDLK_RETURN :: 0x0000000d; SDLK_ESCAPE :: 0x0000001b; SDLK_BACKSPACE :: 0x00000008; SDLK_TAB :: 0x00000009; SDLK_SPACE :: 0x00000020; SDLK_EXCLAIM :: 0x00000021; SDLK_DBLAPOSTROPHE :: 0x00000022; SDLK_HASH :: 0x00000023; SDLK_DOLLAR :: 0x00000024; SDLK_PERCENT :: 0x00000025; SDLK_AMPERSAND :: 0x00000026; SDLK_APOSTROPHE :: 0x00000027; SDLK_LEFTPAREN :: 0x00000028; SDLK_RIGHTPAREN :: 0x00000029; SDLK_ASTERISK :: 0x0000002a; SDLK_PLUS :: 0x0000002b; SDLK_COMMA :: 0x0000002c; SDLK_MINUS :: 0x0000002d; SDLK_PERIOD :: 0x0000002e; SDLK_SLASH :: 0x0000002f; SDLK_0 :: 0x00000030; SDLK_1 :: 0x00000031; SDLK_2 :: 0x00000032; SDLK_3 :: 0x00000033; SDLK_4 :: 0x00000034; SDLK_5 :: 0x00000035; SDLK_6 :: 0x00000036; SDLK_7 :: 0x00000037; SDLK_8 :: 0x00000038; SDLK_9 :: 0x00000039; SDLK_COLON :: 0x0000003a; SDLK_SEMICOLON :: 0x0000003b; SDLK_LESS :: 0x0000003c; SDLK_EQUALS :: 0x0000003d; SDLK_GREATER :: 0x0000003e; SDLK_QUESTION :: 0x0000003f; SDLK_AT :: 0x00000040; SDLK_LEFTBRACKET :: 0x0000005b; SDLK_BACKSLASH :: 0x0000005c; SDLK_RIGHTBRACKET :: 0x0000005d; SDLK_CARET :: 0x0000005e; SDLK_UNDERSCORE :: 0x0000005f; SDLK_GRAVE :: 0x00000060; SDLK_A :: 0x00000061; SDLK_B :: 0x00000062; SDLK_C :: 0x00000063; SDLK_D :: 0x00000064; SDLK_E :: 0x00000065; SDLK_F :: 0x00000066; SDLK_G :: 0x00000067; SDLK_H :: 0x00000068; SDLK_I :: 0x00000069; SDLK_J :: 0x0000006a; SDLK_K :: 0x0000006b; SDLK_L :: 0x0000006c; SDLK_M :: 0x0000006d; SDLK_N :: 0x0000006e; SDLK_O :: 0x0000006f; SDLK_P :: 0x00000070; SDLK_Q :: 0x00000071; SDLK_R :: 0x00000072; SDLK_S :: 0x00000073; SDLK_T :: 0x00000074; SDLK_U :: 0x00000075; SDLK_V :: 0x00000076; SDLK_W :: 0x00000077; SDLK_X :: 0x00000078; SDLK_Y :: 0x00000079; SDLK_Z :: 0x0000007a; SDLK_LEFTBRACE :: 0x0000007b; SDLK_PIPE :: 0x0000007c; SDLK_RIGHTBRACE :: 0x0000007d; SDLK_TILDE :: 0x0000007e; SDLK_DELETE :: 0x0000007f; SDLK_PLUSMINUS :: 0x000000b1; SDLK_CAPSLOCK :: 0x40000039; SDLK_F1 :: 0x4000003a; SDLK_F2 :: 0x4000003b; SDLK_F3 :: 0x4000003c; SDLK_F4 :: 0x4000003d; SDLK_F5 :: 0x4000003e; SDLK_F6 :: 0x4000003f; SDLK_F7 :: 0x40000040; SDLK_F8 :: 0x40000041; SDLK_F9 :: 0x40000042; SDLK_F10 :: 0x40000043; SDLK_F11 :: 0x40000044; SDLK_F12 :: 0x40000045; SDLK_PRINTSCREEN :: 0x40000046; SDLK_SCROLLLOCK :: 0x40000047; SDLK_PAUSE :: 0x40000048; SDLK_INSERT :: 0x40000049; SDLK_HOME :: 0x4000004a; SDLK_PAGEUP :: 0x4000004b; SDLK_END :: 0x4000004d; SDLK_PAGEDOWN :: 0x4000004e; SDLK_RIGHT :: 0x4000004f; SDLK_LEFT :: 0x40000050; SDLK_DOWN :: 0x40000051; SDLK_UP :: 0x40000052; SDLK_NUMLOCKCLEAR :: 0x40000053; SDLK_KP_DIVIDE :: 0x40000054; SDLK_KP_MULTIPLY :: 0x40000055; SDLK_KP_MINUS :: 0x40000056; SDLK_KP_PLUS :: 0x40000057; SDLK_KP_ENTER :: 0x40000058; SDLK_KP_1 :: 0x40000059; SDLK_KP_2 :: 0x4000005a; SDLK_KP_3 :: 0x4000005b; SDLK_KP_4 :: 0x4000005c; SDLK_KP_5 :: 0x4000005d; SDLK_KP_6 :: 0x4000005e; SDLK_KP_7 :: 0x4000005f; SDLK_KP_8 :: 0x40000060; SDLK_KP_9 :: 0x40000061; SDLK_KP_0 :: 0x40000062; SDLK_KP_PERIOD :: 0x40000063; SDLK_APPLICATION :: 0x40000065; SDLK_POWER :: 0x40000066; SDLK_KP_EQUALS :: 0x40000067; SDLK_F13 :: 0x40000068; SDLK_F14 :: 0x40000069; SDLK_F15 :: 0x4000006a; SDLK_F16 :: 0x4000006b; SDLK_F17 :: 0x4000006c; SDLK_F18 :: 0x4000006d; SDLK_F19 :: 0x4000006e; SDLK_F20 :: 0x4000006f; SDLK_F21 :: 0x40000070; SDLK_F22 :: 0x40000071; SDLK_F23 :: 0x40000072; SDLK_F24 :: 0x40000073; SDLK_EXECUTE :: 0x40000074; SDLK_HELP :: 0x40000075; SDLK_MENU :: 0x40000076; SDLK_SELECT :: 0x40000077; SDLK_STOP :: 0x40000078; SDLK_AGAIN :: 0x40000079; SDLK_UNDO :: 0x4000007a; SDLK_CUT :: 0x4000007b; SDLK_COPY :: 0x4000007c; SDLK_PASTE :: 0x4000007d; SDLK_FIND :: 0x4000007e; SDLK_MUTE :: 0x4000007f; SDLK_VOLUMEUP :: 0x40000080; SDLK_VOLUMEDOWN :: 0x40000081; SDLK_KP_COMMA :: 0x40000085; SDLK_KP_EQUALSAS400 :: 0x40000086; SDLK_ALTERASE :: 0x40000099; SDLK_SYSREQ :: 0x4000009a; SDLK_CANCEL :: 0x4000009b; SDLK_CLEAR :: 0x4000009c; SDLK_PRIOR :: 0x4000009d; SDLK_RETURN2 :: 0x4000009e; SDLK_SEPARATOR :: 0x4000009f; SDLK_OUT :: 0x400000a0; SDLK_OPER :: 0x400000a1; SDLK_CLEARAGAIN :: 0x400000a2; SDLK_CRSEL :: 0x400000a3; SDLK_EXSEL :: 0x400000a4; SDLK_KP_00 :: 0x400000b0; SDLK_KP_000 :: 0x400000b1; SDLK_THOUSANDSSEPARATOR :: 0x400000b2; SDLK_DECIMALSEPARATOR :: 0x400000b3; SDLK_CURRENCYUNIT :: 0x400000b4; SDLK_CURRENCYSUBUNIT :: 0x400000b5; SDLK_KP_LEFTPAREN :: 0x400000b6; SDLK_KP_RIGHTPAREN :: 0x400000b7; SDLK_KP_LEFTBRACE :: 0x400000b8; SDLK_KP_RIGHTBRACE :: 0x400000b9; SDLK_KP_TAB :: 0x400000ba; SDLK_KP_BACKSPACE :: 0x400000bb; SDLK_KP_A :: 0x400000bc; SDLK_KP_B :: 0x400000bd; SDLK_KP_C :: 0x400000be; SDLK_KP_D :: 0x400000bf; SDLK_KP_E :: 0x400000c0; SDLK_KP_F :: 0x400000c1; SDLK_KP_XOR :: 0x400000c2; SDLK_KP_POWER :: 0x400000c3; SDLK_KP_PERCENT :: 0x400000c4; SDLK_KP_LESS :: 0x400000c5; SDLK_KP_GREATER :: 0x400000c6; SDLK_KP_AMPERSAND :: 0x400000c7; SDLK_KP_DBLAMPERSAND :: 0x400000c8; SDLK_KP_VERTICALBAR :: 0x400000c9; SDLK_KP_DBLVERTICALBAR :: 0x400000ca; SDLK_KP_COLON :: 0x400000cb; SDLK_KP_HASH :: 0x400000cc; SDLK_KP_SPACE :: 0x400000cd; SDLK_KP_AT :: 0x400000ce; SDLK_KP_EXCLAM :: 0x400000cf; SDLK_KP_MEMSTORE :: 0x400000d0; SDLK_KP_MEMRECALL :: 0x400000d1; SDLK_KP_MEMCLEAR :: 0x400000d2; SDLK_KP_MEMADD :: 0x400000d3; SDLK_KP_MEMSUBTRACT :: 0x400000d4; SDLK_KP_MEMMULTIPLY :: 0x400000d5; SDLK_KP_MEMDIVIDE :: 0x400000d6; SDLK_KP_PLUSMINUS :: 0x400000d7; SDLK_KP_CLEAR :: 0x400000d8; SDLK_KP_CLEARENTRY :: 0x400000d9; SDLK_KP_BINARY :: 0x400000da; SDLK_KP_OCTAL :: 0x400000db; SDLK_KP_DECIMAL :: 0x400000dc; SDLK_KP_HEXADECIMAL :: 0x400000dd; SDLK_LCTRL :: 0x400000e0; SDLK_LSHIFT :: 0x400000e1; SDLK_LALT :: 0x400000e2; SDLK_LGUI :: 0x400000e3; SDLK_RCTRL :: 0x400000e4; SDLK_RSHIFT :: 0x400000e5; SDLK_RALT :: 0x400000e6; SDLK_RGUI :: 0x400000e7; SDLK_MODE :: 0x40000101; SDLK_SLEEP :: 0x40000102; SDLK_WAKE :: 0x40000103; SDLK_CHANNEL_INCREMENT :: 0x40000104; SDLK_CHANNEL_DECREMENT :: 0x40000105; SDLK_MEDIA_PLAY :: 0x40000106; SDLK_MEDIA_PAUSE :: 0x40000107; SDLK_MEDIA_RECORD :: 0x40000108; SDLK_MEDIA_FAST_FORWARD :: 0x40000109; SDLK_MEDIA_REWIND :: 0x4000010a; SDLK_MEDIA_NEXT_TRACK :: 0x4000010b; SDLK_MEDIA_PREVIOUS_TRACK :: 0x4000010c; SDLK_MEDIA_STOP :: 0x4000010d; SDLK_MEDIA_EJECT :: 0x4000010e; SDLK_MEDIA_PLAY_PAUSE :: 0x4000010f; SDLK_MEDIA_SELECT :: 0x40000110; SDLK_AC_NEW :: 0x40000111; SDLK_AC_OPEN :: 0x40000112; SDLK_AC_CLOSE :: 0x40000113; SDLK_AC_EXIT :: 0x40000114; SDLK_AC_SAVE :: 0x40000115; SDLK_AC_PRINT :: 0x40000116; SDLK_AC_PROPERTIES :: 0x40000117; SDLK_AC_SEARCH :: 0x40000118; SDLK_AC_HOME :: 0x40000119; SDLK_AC_BACK :: 0x4000011a; SDLK_AC_FORWARD :: 0x4000011b; SDLK_AC_STOP :: 0x4000011c; SDLK_AC_REFRESH :: 0x4000011d; SDLK_AC_BOOKMARKS :: 0x4000011e; SDLK_SOFTLEFT :: 0x4000011f; SDLK_SOFTRIGHT :: 0x40000120; SDLK_CALL :: 0x40000121; SDLK_ENDCALL :: 0x40000122; SDLK_LEFT_TAB :: 0x20000001; SDLK_LEVEL5_SHIFT :: 0x20000002; SDLK_MULTI_KEY_COMPOSE :: 0x20000003; SDLK_LMETA :: 0x20000004; SDLK_RMETA :: 0x20000005; SDLK_LHYPER :: 0x20000006; SDLK_RHYPER :: 0x20000007; SDL_KMOD_NONE :: 0x0000; SDL_KMOD_LSHIFT :: 0x0001; SDL_KMOD_RSHIFT :: 0x0002; SDL_KMOD_LEVEL5 :: 0x0004; SDL_KMOD_LCTRL :: 0x0040; SDL_KMOD_RCTRL :: 0x0080; SDL_KMOD_LALT :: 0x0100; SDL_KMOD_RALT :: 0x0200; SDL_KMOD_LGUI :: 0x0400; SDL_KMOD_RGUI :: 0x0800; SDL_KMOD_NUM :: 0x1000; SDL_KMOD_CAPS :: 0x2000; SDL_KMOD_MODE :: 0x4000; SDL_KMOD_SCROLL :: 0x8000; SDL_KMOD_CTRL :: SDL_KMOD_LCTRL | SDL_KMOD_RCTRL; SDL_KMOD_SHIFT :: SDL_KMOD_LSHIFT | SDL_KMOD_RSHIFT; SDL_KMOD_ALT :: SDL_KMOD_LALT | SDL_KMOD_RALT; SDL_KMOD_GUI :: SDL_KMOD_LGUI | SDL_KMOD_RGUI; SDL_PROP_TEXTINPUT_TYPE_NUMBER :: "SDL.textinput.type"; SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER :: "SDL.textinput.capitalization"; SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN :: "SDL.textinput.autocorrect"; SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN :: "SDL.textinput.multiline"; SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER :: "SDL.textinput.android.inputtype"; SDL_BUTTON_LEFT :: 1; SDL_BUTTON_MIDDLE :: 2; SDL_BUTTON_RIGHT :: 3; SDL_BUTTON_X1 :: 4; SDL_BUTTON_X2 :: 5; SDL_TOUCH_MOUSEID :: cast,trunc(SDL_MouseID) -1; SDL_MOUSE_TOUCHID :: cast,trunc(SDL_TouchID) -1; SDL_PEN_MOUSEID :: cast,trunc(SDL_MouseID) -2; SDL_PEN_TOUCHID :: cast,trunc(SDL_TouchID) -2; SDL_PEN_INPUT_DOWN :: 1 << 0; SDL_PEN_INPUT_BUTTON_1 :: 1 << 1; SDL_PEN_INPUT_BUTTON_2 :: 1 << 2; SDL_PEN_INPUT_BUTTON_3 :: 1 << 3; SDL_PEN_INPUT_BUTTON_4 :: 1 << 4; SDL_PEN_INPUT_BUTTON_5 :: 1 << 5; SDL_PEN_INPUT_ERASER_TIP :: 1 << 30; SDL_GLOB_CASEINSENSITIVE :: 1 << 0; SDL_GPU_TEXTUREUSAGE_SAMPLER :: 1 << 0; SDL_GPU_TEXTUREUSAGE_COLOR_TARGET :: 1 << 1; SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET :: 1 << 2; SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ :: 1 << 3; SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ :: 1 << 4; SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE :: 1 << 5; SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE :: 1 << 6; SDL_GPU_BUFFERUSAGE_VERTEX :: 1 << 0; SDL_GPU_BUFFERUSAGE_INDEX :: 1 << 1; SDL_GPU_BUFFERUSAGE_INDIRECT :: 1 << 2; SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ :: 1 << 3; SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ :: 1 << 4; SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE :: 1 << 5; SDL_GPU_SHADERFORMAT_INVALID :: 0; SDL_GPU_SHADERFORMAT_PRIVATE :: 1 << 0; SDL_GPU_SHADERFORMAT_SPIRV :: 1 << 1; SDL_GPU_SHADERFORMAT_DXBC :: 1 << 2; SDL_GPU_SHADERFORMAT_DXIL :: 1 << 3; SDL_GPU_SHADERFORMAT_MSL :: 1 << 4; SDL_GPU_SHADERFORMAT_METALLIB :: 1 << 5; SDL_GPU_COLORCOMPONENT_R :: 1 << 0; SDL_GPU_COLORCOMPONENT_G :: 1 << 1; SDL_GPU_COLORCOMPONENT_B :: 1 << 2; SDL_GPU_COLORCOMPONENT_A :: 1 << 3; SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN :: "SDL.gpu.device.create.debugmode"; SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN :: "SDL.gpu.device.create.preferlowpower"; SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING :: "SDL.gpu.device.create.name"; SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN :: "SDL.gpu.device.create.shaders.private"; SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN :: "SDL.gpu.device.create.shaders.spirv"; SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN :: "SDL.gpu.device.create.shaders.dxbc"; SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN :: "SDL.gpu.device.create.shaders.dxil"; SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN :: "SDL.gpu.device.create.shaders.msl"; SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN :: "SDL.gpu.device.create.shaders.metallib"; SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING :: "SDL.gpu.device.create.d3d12.semantic"; SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING :: "SDL.gpu.computepipeline.create.name"; SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING :: "SDL.gpu.graphicspipeline.create.name"; SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING :: "SDL.gpu.sampler.create.name"; SDL_PROP_GPU_SHADER_CREATE_NAME_STRING :: "SDL.gpu.shader.create.name"; SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT :: "SDL.gpu.texture.create.d3d12.clear.r"; SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT :: "SDL.gpu.texture.create.d3d12.clear.g"; SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT :: "SDL.gpu.texture.create.d3d12.clear.b"; SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT :: "SDL.gpu.texture.create.d3d12.clear.a"; SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT :: "SDL.gpu.texture.create.d3d12.clear.depth"; SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 :: "SDL.gpu.texture.create.d3d12.clear.stencil"; SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING :: "SDL.gpu.texture.create.name"; SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING :: "SDL.gpu.buffer.create.name"; SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING :: "SDL.gpu.transferbuffer.create.name"; SDL_HAPTIC_CONSTANT :: 1<<0; SDL_HAPTIC_SINE :: 1<<1; SDL_HAPTIC_SQUARE :: 1<<2; SDL_HAPTIC_TRIANGLE :: 1<<3; SDL_HAPTIC_SAWTOOTHUP :: 1<<4; SDL_HAPTIC_SAWTOOTHDOWN :: 1<<5; SDL_HAPTIC_RAMP :: 1<<6; SDL_HAPTIC_SPRING :: 1<<7; SDL_HAPTIC_DAMPER :: 1<<8; SDL_HAPTIC_INERTIA :: 1<<9; SDL_HAPTIC_FRICTION :: 1<<10; SDL_HAPTIC_LEFTRIGHT :: 1<<11; SDL_HAPTIC_RESERVED1 :: 1<<12; SDL_HAPTIC_RESERVED2 :: 1<<13; SDL_HAPTIC_RESERVED3 :: 1<<14; SDL_HAPTIC_CUSTOM :: 1<<15; SDL_HAPTIC_GAIN :: 1<<16; SDL_HAPTIC_AUTOCENTER :: 1<<17; SDL_HAPTIC_STATUS :: 1<<18; SDL_HAPTIC_PAUSE :: 1<<19; SDL_HAPTIC_POLAR :: 0; SDL_HAPTIC_CARTESIAN :: 1; SDL_HAPTIC_SPHERICAL :: 2; SDL_HAPTIC_STEERING_AXIS :: 3; SDL_HAPTIC_INFINITY :: 4294967295; SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED :: "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"; SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY :: "SDL_ANDROID_ALLOW_RECREATE_ACTIVITY"; SDL_HINT_ANDROID_BLOCK_ON_PAUSE :: "SDL_ANDROID_BLOCK_ON_PAUSE"; SDL_HINT_ANDROID_LOW_LATENCY_AUDIO :: "SDL_ANDROID_LOW_LATENCY_AUDIO"; SDL_HINT_ANDROID_TRAP_BACK_BUTTON :: "SDL_ANDROID_TRAP_BACK_BUTTON"; SDL_HINT_APP_ID :: "SDL_APP_ID"; SDL_HINT_APP_NAME :: "SDL_APP_NAME"; SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS :: "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"; SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION :: "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"; SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE :: "SDL_AUDIO_ALSA_DEFAULT_DEVICE"; SDL_HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE :: "SDL_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE"; SDL_HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE :: "SDL_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE"; SDL_HINT_AUDIO_CATEGORY :: "SDL_AUDIO_CATEGORY"; SDL_HINT_AUDIO_CHANNELS :: "SDL_AUDIO_CHANNELS"; SDL_HINT_AUDIO_DEVICE_APP_ICON_NAME :: "SDL_AUDIO_DEVICE_APP_ICON_NAME"; SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES :: "SDL_AUDIO_DEVICE_SAMPLE_FRAMES"; SDL_HINT_AUDIO_DEVICE_STREAM_NAME :: "SDL_AUDIO_DEVICE_STREAM_NAME"; SDL_HINT_AUDIO_DEVICE_STREAM_ROLE :: "SDL_AUDIO_DEVICE_STREAM_ROLE"; SDL_HINT_AUDIO_DISK_INPUT_FILE :: "SDL_AUDIO_DISK_INPUT_FILE"; SDL_HINT_AUDIO_DISK_OUTPUT_FILE :: "SDL_AUDIO_DISK_OUTPUT_FILE"; SDL_HINT_AUDIO_DISK_TIMESCALE :: "SDL_AUDIO_DISK_TIMESCALE"; SDL_HINT_AUDIO_DRIVER :: "SDL_AUDIO_DRIVER"; SDL_HINT_AUDIO_DUMMY_TIMESCALE :: "SDL_AUDIO_DUMMY_TIMESCALE"; SDL_HINT_AUDIO_FORMAT :: "SDL_AUDIO_FORMAT"; SDL_HINT_AUDIO_FREQUENCY :: "SDL_AUDIO_FREQUENCY"; SDL_HINT_AUDIO_INCLUDE_MONITORS :: "SDL_AUDIO_INCLUDE_MONITORS"; SDL_HINT_AUTO_UPDATE_JOYSTICKS :: "SDL_AUTO_UPDATE_JOYSTICKS"; SDL_HINT_AUTO_UPDATE_SENSORS :: "SDL_AUTO_UPDATE_SENSORS"; SDL_HINT_BMP_SAVE_LEGACY_FORMAT :: "SDL_BMP_SAVE_LEGACY_FORMAT"; SDL_HINT_CAMERA_DRIVER :: "SDL_CAMERA_DRIVER"; SDL_HINT_CPU_FEATURE_MASK :: "SDL_CPU_FEATURE_MASK"; SDL_HINT_JOYSTICK_DIRECTINPUT :: "SDL_JOYSTICK_DIRECTINPUT"; SDL_HINT_FILE_DIALOG_DRIVER :: "SDL_FILE_DIALOG_DRIVER"; SDL_HINT_DISPLAY_USABLE_BOUNDS :: "SDL_DISPLAY_USABLE_BOUNDS"; SDL_HINT_EMSCRIPTEN_ASYNCIFY :: "SDL_EMSCRIPTEN_ASYNCIFY"; SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR :: "SDL_EMSCRIPTEN_CANVAS_SELECTOR"; SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT :: "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"; SDL_HINT_ENABLE_SCREEN_KEYBOARD :: "SDL_ENABLE_SCREEN_KEYBOARD"; SDL_HINT_EVDEV_DEVICES :: "SDL_EVDEV_DEVICES"; SDL_HINT_EVENT_LOGGING :: "SDL_EVENT_LOGGING"; SDL_HINT_FORCE_RAISEWINDOW :: "SDL_FORCE_RAISEWINDOW"; SDL_HINT_FRAMEBUFFER_ACCELERATION :: "SDL_FRAMEBUFFER_ACCELERATION"; SDL_HINT_GAMECONTROLLERCONFIG :: "SDL_GAMECONTROLLERCONFIG"; SDL_HINT_GAMECONTROLLERCONFIG_FILE :: "SDL_GAMECONTROLLERCONFIG_FILE"; SDL_HINT_GAMECONTROLLERTYPE :: "SDL_GAMECONTROLLERTYPE"; SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES :: "SDL_GAMECONTROLLER_IGNORE_DEVICES"; SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT :: "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"; SDL_HINT_GAMECONTROLLER_SENSOR_FUSION :: "SDL_GAMECONTROLLER_SENSOR_FUSION"; SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT :: "SDL_GDK_TEXTINPUT_DEFAULT_TEXT"; SDL_HINT_GDK_TEXTINPUT_DESCRIPTION :: "SDL_GDK_TEXTINPUT_DESCRIPTION"; SDL_HINT_GDK_TEXTINPUT_MAX_LENGTH :: "SDL_GDK_TEXTINPUT_MAX_LENGTH"; SDL_HINT_GDK_TEXTINPUT_SCOPE :: "SDL_GDK_TEXTINPUT_SCOPE"; SDL_HINT_GDK_TEXTINPUT_TITLE :: "SDL_GDK_TEXTINPUT_TITLE"; SDL_HINT_HIDAPI_LIBUSB :: "SDL_HIDAPI_LIBUSB"; SDL_HINT_HIDAPI_LIBUSB_WHITELIST :: "SDL_HIDAPI_LIBUSB_WHITELIST"; SDL_HINT_HIDAPI_UDEV :: "SDL_HIDAPI_UDEV"; SDL_HINT_GPU_DRIVER :: "SDL_GPU_DRIVER"; SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS :: "SDL_HIDAPI_ENUMERATE_ONLY_CONTROLLERS"; SDL_HINT_HIDAPI_IGNORE_DEVICES :: "SDL_HIDAPI_IGNORE_DEVICES"; SDL_HINT_IME_IMPLEMENTED_UI :: "SDL_IME_IMPLEMENTED_UI"; SDL_HINT_IOS_HIDE_HOME_INDICATOR :: "SDL_IOS_HIDE_HOME_INDICATOR"; SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS :: "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"; SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES :: "SDL_JOYSTICK_ARCADESTICK_DEVICES"; SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED :: "SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED"; SDL_HINT_JOYSTICK_BLACKLIST_DEVICES :: "SDL_JOYSTICK_BLACKLIST_DEVICES"; SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED :: "SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED"; SDL_HINT_JOYSTICK_DEVICE :: "SDL_JOYSTICK_DEVICE"; SDL_HINT_JOYSTICK_ENHANCED_REPORTS :: "SDL_JOYSTICK_ENHANCED_REPORTS"; SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES :: "SDL_JOYSTICK_FLIGHTSTICK_DEVICES"; SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED :: "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED"; SDL_HINT_JOYSTICK_GAMEINPUT :: "SDL_JOYSTICK_GAMEINPUT"; SDL_HINT_JOYSTICK_GAMECUBE_DEVICES :: "SDL_JOYSTICK_GAMECUBE_DEVICES"; SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED :: "SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED"; SDL_HINT_JOYSTICK_HIDAPI :: "SDL_JOYSTICK_HIDAPI"; SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS :: "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS"; SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE :: "SDL_JOYSTICK_HIDAPI_GAMECUBE"; SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE :: "SDL_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE"; SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS :: "SDL_JOYSTICK_HIDAPI_JOY_CONS"; SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED :: "SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED"; SDL_HINT_JOYSTICK_HIDAPI_LUNA :: "SDL_JOYSTICK_HIDAPI_LUNA"; SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC :: "SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC"; SDL_HINT_JOYSTICK_HIDAPI_PS3 :: "SDL_JOYSTICK_HIDAPI_PS3"; SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER :: "SDL_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER"; SDL_HINT_JOYSTICK_HIDAPI_PS4 :: "SDL_JOYSTICK_HIDAPI_PS4"; SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL :: "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL"; SDL_HINT_JOYSTICK_HIDAPI_PS5 :: "SDL_JOYSTICK_HIDAPI_PS5"; SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED :: "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"; SDL_HINT_JOYSTICK_HIDAPI_SHIELD :: "SDL_JOYSTICK_HIDAPI_SHIELD"; SDL_HINT_JOYSTICK_HIDAPI_STADIA :: "SDL_JOYSTICK_HIDAPI_STADIA"; SDL_HINT_JOYSTICK_HIDAPI_STEAM :: "SDL_JOYSTICK_HIDAPI_STEAM"; SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED :: "SDL_JOYSTICK_HIDAPI_STEAM_HOME_LED"; SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK :: "SDL_JOYSTICK_HIDAPI_STEAMDECK"; SDL_HINT_JOYSTICK_HIDAPI_STEAM_HORI :: "SDL_JOYSTICK_HIDAPI_STEAM_HORI"; SDL_HINT_JOYSTICK_HIDAPI_SWITCH :: "SDL_JOYSTICK_HIDAPI_SWITCH"; SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED :: "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED"; SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED :: "SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED"; SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS :: "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS"; SDL_HINT_JOYSTICK_HIDAPI_WII :: "SDL_JOYSTICK_HIDAPI_WII"; SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED :: "SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED"; SDL_HINT_JOYSTICK_HIDAPI_XBOX :: "SDL_JOYSTICK_HIDAPI_XBOX"; SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 :: "SDL_JOYSTICK_HIDAPI_XBOX_360"; SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED :: "SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED"; SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS :: "SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS"; SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE :: "SDL_JOYSTICK_HIDAPI_XBOX_ONE"; SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED :: "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED"; SDL_HINT_JOYSTICK_IOKIT :: "SDL_JOYSTICK_IOKIT"; SDL_HINT_JOYSTICK_LINUX_CLASSIC :: "SDL_JOYSTICK_LINUX_CLASSIC"; SDL_HINT_JOYSTICK_LINUX_DEADZONES :: "SDL_JOYSTICK_LINUX_DEADZONES"; SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS :: "SDL_JOYSTICK_LINUX_DIGITAL_HATS"; SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES :: "SDL_JOYSTICK_LINUX_HAT_DEADZONES"; SDL_HINT_JOYSTICK_MFI :: "SDL_JOYSTICK_MFI"; SDL_HINT_JOYSTICK_RAWINPUT :: "SDL_JOYSTICK_RAWINPUT"; SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT :: "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT"; SDL_HINT_JOYSTICK_ROG_CHAKRAM :: "SDL_JOYSTICK_ROG_CHAKRAM"; SDL_HINT_JOYSTICK_THREAD :: "SDL_JOYSTICK_THREAD"; SDL_HINT_JOYSTICK_THROTTLE_DEVICES :: "SDL_JOYSTICK_THROTTLE_DEVICES"; SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED :: "SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED"; SDL_HINT_JOYSTICK_WGI :: "SDL_JOYSTICK_WGI"; SDL_HINT_JOYSTICK_WHEEL_DEVICES :: "SDL_JOYSTICK_WHEEL_DEVICES"; SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED :: "SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED"; SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES :: "SDL_JOYSTICK_ZERO_CENTERED_DEVICES"; SDL_HINT_KEYCODE_OPTIONS :: "SDL_KEYCODE_OPTIONS"; SDL_HINT_KMSDRM_DEVICE_INDEX :: "SDL_KMSDRM_DEVICE_INDEX"; SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER :: "SDL_KMSDRM_REQUIRE_DRM_MASTER"; SDL_HINT_LOGGING :: "SDL_LOGGING"; SDL_HINT_MAC_BACKGROUND_APP :: "SDL_MAC_BACKGROUND_APP"; SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK :: "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"; SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH :: "SDL_MAC_OPENGL_ASYNC_DISPATCH"; SDL_HINT_MAC_OPTION_AS_ALT :: "SDL_MAC_OPTION_AS_ALT"; SDL_HINT_MAC_SCROLL_MOMENTUM :: "SDL_MAC_SCROLL_MOMENTUM"; SDL_HINT_MAIN_CALLBACK_RATE :: "SDL_MAIN_CALLBACK_RATE"; SDL_HINT_MOUSE_AUTO_CAPTURE :: "SDL_MOUSE_AUTO_CAPTURE"; SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS :: "SDL_MOUSE_DOUBLE_CLICK_RADIUS"; SDL_HINT_MOUSE_DOUBLE_CLICK_TIME :: "SDL_MOUSE_DOUBLE_CLICK_TIME"; SDL_HINT_MOUSE_DEFAULT_SYSTEM_CURSOR :: "SDL_MOUSE_DEFAULT_SYSTEM_CURSOR"; SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE :: "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE"; SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH :: "SDL_MOUSE_FOCUS_CLICKTHROUGH"; SDL_HINT_MOUSE_NORMAL_SPEED_SCALE :: "SDL_MOUSE_NORMAL_SPEED_SCALE"; SDL_HINT_MOUSE_RELATIVE_MODE_CENTER :: "SDL_MOUSE_RELATIVE_MODE_CENTER"; SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE :: "SDL_MOUSE_RELATIVE_SPEED_SCALE"; SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE :: "SDL_MOUSE_RELATIVE_SYSTEM_SCALE"; SDL_HINT_MOUSE_RELATIVE_WARP_MOTION :: "SDL_MOUSE_RELATIVE_WARP_MOTION"; SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE :: "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE"; SDL_HINT_MOUSE_TOUCH_EVENTS :: "SDL_MOUSE_TOUCH_EVENTS"; SDL_HINT_MUTE_CONSOLE_KEYBOARD :: "SDL_MUTE_CONSOLE_KEYBOARD"; SDL_HINT_NO_SIGNAL_HANDLERS :: "SDL_NO_SIGNAL_HANDLERS"; SDL_HINT_OPENGL_LIBRARY :: "SDL_OPENGL_LIBRARY"; SDL_HINT_EGL_LIBRARY :: "SDL_EGL_LIBRARY"; SDL_HINT_OPENGL_ES_DRIVER :: "SDL_OPENGL_ES_DRIVER"; SDL_HINT_OPENVR_LIBRARY :: "SDL_OPENVR_LIBRARY"; SDL_HINT_ORIENTATIONS :: "SDL_ORIENTATIONS"; SDL_HINT_POLL_SENTINEL :: "SDL_POLL_SENTINEL"; SDL_HINT_PREFERRED_LOCALES :: "SDL_PREFERRED_LOCALES"; SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE :: "SDL_QUIT_ON_LAST_WINDOW_CLOSE"; SDL_HINT_RENDER_DIRECT3D_THREADSAFE :: "SDL_RENDER_DIRECT3D_THREADSAFE"; SDL_HINT_RENDER_DIRECT3D11_DEBUG :: "SDL_RENDER_DIRECT3D11_DEBUG"; SDL_HINT_RENDER_VULKAN_DEBUG :: "SDL_RENDER_VULKAN_DEBUG"; SDL_HINT_RENDER_GPU_DEBUG :: "SDL_RENDER_GPU_DEBUG"; SDL_HINT_RENDER_GPU_LOW_POWER :: "SDL_RENDER_GPU_LOW_POWER"; SDL_HINT_RENDER_DRIVER :: "SDL_RENDER_DRIVER"; SDL_HINT_RENDER_LINE_METHOD :: "SDL_RENDER_LINE_METHOD"; SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE :: "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE"; SDL_HINT_RENDER_VSYNC :: "SDL_RENDER_VSYNC"; SDL_HINT_RETURN_KEY_HIDES_IME :: "SDL_RETURN_KEY_HIDES_IME"; SDL_HINT_ROG_GAMEPAD_MICE :: "SDL_ROG_GAMEPAD_MICE"; SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED :: "SDL_ROG_GAMEPAD_MICE_EXCLUDED"; SDL_HINT_RPI_VIDEO_LAYER :: "SDL_RPI_VIDEO_LAYER"; SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME :: "SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME"; SDL_HINT_SHUTDOWN_DBUS_ON_QUIT :: "SDL_SHUTDOWN_DBUS_ON_QUIT"; SDL_HINT_STORAGE_TITLE_DRIVER :: "SDL_STORAGE_TITLE_DRIVER"; SDL_HINT_STORAGE_USER_DRIVER :: "SDL_STORAGE_USER_DRIVER"; SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL :: "SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL"; SDL_HINT_THREAD_PRIORITY_POLICY :: "SDL_THREAD_PRIORITY_POLICY"; SDL_HINT_TIMER_RESOLUTION :: "SDL_TIMER_RESOLUTION"; SDL_HINT_TOUCH_MOUSE_EVENTS :: "SDL_TOUCH_MOUSE_EVENTS"; SDL_HINT_TRACKPAD_IS_TOUCH_ONLY :: "SDL_TRACKPAD_IS_TOUCH_ONLY"; SDL_HINT_TV_REMOTE_AS_JOYSTICK :: "SDL_TV_REMOTE_AS_JOYSTICK"; SDL_HINT_VIDEO_ALLOW_SCREENSAVER :: "SDL_VIDEO_ALLOW_SCREENSAVER"; SDL_HINT_VIDEO_DISPLAY_PRIORITY :: "SDL_VIDEO_DISPLAY_PRIORITY"; SDL_HINT_VIDEO_DOUBLE_BUFFER :: "SDL_VIDEO_DOUBLE_BUFFER"; SDL_HINT_VIDEO_DRIVER :: "SDL_VIDEO_DRIVER"; SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES :: "SDL_VIDEO_DUMMY_SAVE_FRAMES"; SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK :: "SDL_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK"; SDL_HINT_VIDEO_FORCE_EGL :: "SDL_VIDEO_FORCE_EGL"; SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES :: "SDL_VIDEO_MAC_FULLSCREEN_SPACES"; SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY :: "SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY"; SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS :: "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"; SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES :: "SDL_VIDEO_OFFSCREEN_SAVE_FRAMES"; SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS :: "SDL_VIDEO_SYNC_WINDOW_OPERATIONS"; SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR :: "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR"; SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION :: "SDL_VIDEO_WAYLAND_MODE_EMULATION"; SDL_HINT_VIDEO_WAYLAND_MODE_SCALING :: "SDL_VIDEO_WAYLAND_MODE_SCALING"; SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR :: "SDL_VIDEO_WAYLAND_PREFER_LIBDECOR"; SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY :: "SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY"; SDL_HINT_VIDEO_WIN_D3DCOMPILER :: "SDL_VIDEO_WIN_D3DCOMPILER"; SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR :: "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"; SDL_HINT_VIDEO_X11_NET_WM_PING :: "SDL_VIDEO_X11_NET_WM_PING"; SDL_HINT_VIDEO_X11_NODIRECTCOLOR :: "SDL_VIDEO_X11_NODIRECTCOLOR"; SDL_HINT_VIDEO_X11_SCALING_FACTOR :: "SDL_VIDEO_X11_SCALING_FACTOR"; SDL_HINT_VIDEO_X11_VISUALID :: "SDL_VIDEO_X11_VISUALID"; SDL_HINT_VIDEO_X11_WINDOW_VISUALID :: "SDL_VIDEO_X11_WINDOW_VISUALID"; SDL_HINT_VIDEO_X11_XRANDR :: "SDL_VIDEO_X11_XRANDR"; SDL_HINT_VITA_ENABLE_BACK_TOUCH :: "SDL_VITA_ENABLE_BACK_TOUCH"; SDL_HINT_VITA_ENABLE_FRONT_TOUCH :: "SDL_VITA_ENABLE_FRONT_TOUCH"; SDL_HINT_VITA_MODULE_PATH :: "SDL_VITA_MODULE_PATH"; SDL_HINT_VITA_PVR_INIT :: "SDL_VITA_PVR_INIT"; SDL_HINT_VITA_RESOLUTION :: "SDL_VITA_RESOLUTION"; SDL_HINT_VITA_PVR_OPENGL :: "SDL_VITA_PVR_OPENGL"; SDL_HINT_VITA_TOUCH_MOUSE_DEVICE :: "SDL_VITA_TOUCH_MOUSE_DEVICE"; SDL_HINT_VULKAN_DISPLAY :: "SDL_VULKAN_DISPLAY"; SDL_HINT_VULKAN_LIBRARY :: "SDL_VULKAN_LIBRARY"; SDL_HINT_WAVE_FACT_CHUNK :: "SDL_WAVE_FACT_CHUNK"; SDL_HINT_WAVE_CHUNK_LIMIT :: "SDL_WAVE_CHUNK_LIMIT"; SDL_HINT_WAVE_RIFF_CHUNK_SIZE :: "SDL_WAVE_RIFF_CHUNK_SIZE"; SDL_HINT_WAVE_TRUNCATION :: "SDL_WAVE_TRUNCATION"; SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED :: "SDL_WINDOW_ACTIVATE_WHEN_RAISED"; SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN :: "SDL_WINDOW_ACTIVATE_WHEN_SHOWN"; SDL_HINT_WINDOW_ALLOW_TOPMOST :: "SDL_WINDOW_ALLOW_TOPMOST"; SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN :: "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"; SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4 :: "SDL_WINDOWS_CLOSE_ON_ALT_F4"; SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS :: "SDL_WINDOWS_ENABLE_MENU_MNEMONICS"; SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP :: "SDL_WINDOWS_ENABLE_MESSAGELOOP"; SDL_HINT_WINDOWS_GAMEINPUT :: "SDL_WINDOWS_GAMEINPUT"; SDL_HINT_WINDOWS_RAW_KEYBOARD :: "SDL_WINDOWS_RAW_KEYBOARD"; SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL :: "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL"; SDL_HINT_WINDOWS_INTRESOURCE_ICON :: "SDL_WINDOWS_INTRESOURCE_ICON"; SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL :: "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"; SDL_HINT_WINDOWS_USE_D3D9EX :: "SDL_WINDOWS_USE_D3D9EX"; SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE :: "SDL_WINDOWS_ERASE_BACKGROUND_MODE"; SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT :: "SDL_X11_FORCE_OVERRIDE_REDIRECT"; SDL_HINT_X11_WINDOW_TYPE :: "SDL_X11_WINDOW_TYPE"; SDL_HINT_X11_XCB_LIBRARY :: "SDL_X11_XCB_LIBRARY"; SDL_HINT_XINPUT_ENABLED :: "SDL_XINPUT_ENABLED"; SDL_HINT_ASSERT :: "SDL_ASSERT"; SDL_HINT_PEN_MOUSE_EVENTS :: "SDL_PEN_MOUSE_EVENTS"; SDL_HINT_PEN_TOUCH_EVENTS :: "SDL_PEN_TOUCH_EVENTS"; SDL_INIT_AUDIO :: 0x00000010; SDL_INIT_VIDEO :: 0x00000020; SDL_INIT_JOYSTICK :: 0x00000200; SDL_INIT_HAPTIC :: 0x00001000; SDL_INIT_GAMEPAD :: 0x00002000; SDL_INIT_EVENTS :: 0x00004000; SDL_INIT_SENSOR :: 0x00008000; SDL_INIT_CAMERA :: 0x00010000; SDL_PROP_APP_METADATA_NAME_STRING :: "SDL.app.metadata.name"; SDL_PROP_APP_METADATA_VERSION_STRING :: "SDL.app.metadata.version"; SDL_PROP_APP_METADATA_IDENTIFIER_STRING :: "SDL.app.metadata.identifier"; SDL_PROP_APP_METADATA_CREATOR_STRING :: "SDL.app.metadata.creator"; SDL_PROP_APP_METADATA_COPYRIGHT_STRING :: "SDL.app.metadata.copyright"; SDL_PROP_APP_METADATA_URL_STRING :: "SDL.app.metadata.url"; SDL_PROP_APP_METADATA_TYPE_STRING :: "SDL.app.metadata.type"; SDL_MESSAGEBOX_ERROR :: 0x00000010; SDL_MESSAGEBOX_WARNING :: 0x00000020; SDL_MESSAGEBOX_INFORMATION :: 0x00000040; SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT :: 0x00000080; SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT :: 0x00000100; SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT :: 0x00000001; SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT :: 0x00000002; SDL_PROP_PROCESS_CREATE_ARGS_POINTER :: "SDL.process.create.args"; SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER :: "SDL.process.create.environment"; SDL_PROP_PROCESS_CREATE_STDIN_NUMBER :: "SDL.process.create.stdin_option"; SDL_PROP_PROCESS_CREATE_STDIN_POINTER :: "SDL.process.create.stdin_source"; SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER :: "SDL.process.create.stdout_option"; SDL_PROP_PROCESS_CREATE_STDOUT_POINTER :: "SDL.process.create.stdout_source"; SDL_PROP_PROCESS_CREATE_STDERR_NUMBER :: "SDL.process.create.stderr_option"; SDL_PROP_PROCESS_CREATE_STDERR_POINTER :: "SDL.process.create.stderr_source"; SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN :: "SDL.process.create.stderr_to_stdout"; SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN :: "SDL.process.create.background"; SDL_PROP_PROCESS_PID_NUMBER :: "SDL.process.pid"; SDL_PROP_PROCESS_STDIN_POINTER :: "SDL.process.stdin"; SDL_PROP_PROCESS_STDOUT_POINTER :: "SDL.process.stdout"; SDL_PROP_PROCESS_STDERR_POINTER :: "SDL.process.stderr"; SDL_PROP_PROCESS_BACKGROUND_BOOLEAN :: "SDL.process.background"; SDL_SOFTWARE_RENDERER :: "software"; SDL_PROP_RENDERER_CREATE_NAME_STRING :: "SDL.renderer.create.name"; SDL_PROP_RENDERER_CREATE_WINDOW_POINTER :: "SDL.renderer.create.window"; SDL_PROP_RENDERER_CREATE_SURFACE_POINTER :: "SDL.renderer.create.surface"; SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER :: "SDL.renderer.create.output_colorspace"; SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER :: "SDL.renderer.create.present_vsync"; SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER :: "SDL.renderer.create.vulkan.instance"; SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER :: "SDL.renderer.create.vulkan.surface"; SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER :: "SDL.renderer.create.vulkan.physical_device"; SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER :: "SDL.renderer.create.vulkan.device"; SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER :: "SDL.renderer.create.vulkan.graphics_queue_family_index"; SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER :: "SDL.renderer.create.vulkan.present_queue_family_index"; SDL_PROP_RENDERER_NAME_STRING :: "SDL.renderer.name"; SDL_PROP_RENDERER_WINDOW_POINTER :: "SDL.renderer.window"; SDL_PROP_RENDERER_SURFACE_POINTER :: "SDL.renderer.surface"; SDL_PROP_RENDERER_VSYNC_NUMBER :: "SDL.renderer.vsync"; SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER :: "SDL.renderer.max_texture_size"; SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER :: "SDL.renderer.texture_formats"; SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER :: "SDL.renderer.output_colorspace"; SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN :: "SDL.renderer.HDR_enabled"; SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT :: "SDL.renderer.SDR_white_point"; SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT :: "SDL.renderer.HDR_headroom"; SDL_PROP_RENDERER_D3D9_DEVICE_POINTER :: "SDL.renderer.d3d9.device"; SDL_PROP_RENDERER_D3D11_DEVICE_POINTER :: "SDL.renderer.d3d11.device"; SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER :: "SDL.renderer.d3d11.swap_chain"; SDL_PROP_RENDERER_D3D12_DEVICE_POINTER :: "SDL.renderer.d3d12.device"; SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER :: "SDL.renderer.d3d12.swap_chain"; SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER :: "SDL.renderer.d3d12.command_queue"; SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER :: "SDL.renderer.vulkan.instance"; SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER :: "SDL.renderer.vulkan.surface"; SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER :: "SDL.renderer.vulkan.physical_device"; SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER :: "SDL.renderer.vulkan.device"; SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER :: "SDL.renderer.vulkan.graphics_queue_family_index"; SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER :: "SDL.renderer.vulkan.present_queue_family_index"; SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER :: "SDL.renderer.vulkan.swapchain_image_count"; SDL_PROP_RENDERER_GPU_DEVICE_POINTER :: "SDL.renderer.gpu.device"; SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER :: "SDL.texture.create.colorspace"; SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER :: "SDL.texture.create.format"; SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER :: "SDL.texture.create.access"; SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER :: "SDL.texture.create.width"; SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER :: "SDL.texture.create.height"; SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT :: "SDL.texture.create.SDR_white_point"; SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT :: "SDL.texture.create.HDR_headroom"; SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER :: "SDL.texture.create.d3d11.texture"; SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER :: "SDL.texture.create.d3d11.texture_u"; SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER :: "SDL.texture.create.d3d11.texture_v"; SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER :: "SDL.texture.create.d3d12.texture"; SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER :: "SDL.texture.create.d3d12.texture_u"; SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER :: "SDL.texture.create.d3d12.texture_v"; SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER :: "SDL.texture.create.metal.pixelbuffer"; SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER :: "SDL.texture.create.opengl.texture"; SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER :: "SDL.texture.create.opengl.texture_uv"; SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER :: "SDL.texture.create.opengl.texture_u"; SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER :: "SDL.texture.create.opengl.texture_v"; SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER :: "SDL.texture.create.opengles2.texture"; SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER :: "SDL.texture.create.opengles2.texture_uv"; SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER :: "SDL.texture.create.opengles2.texture_u"; SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER :: "SDL.texture.create.opengles2.texture_v"; SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER :: "SDL.texture.create.vulkan.texture"; SDL_PROP_TEXTURE_COLORSPACE_NUMBER :: "SDL.texture.colorspace"; SDL_PROP_TEXTURE_FORMAT_NUMBER :: "SDL.texture.format"; SDL_PROP_TEXTURE_ACCESS_NUMBER :: "SDL.texture.access"; SDL_PROP_TEXTURE_WIDTH_NUMBER :: "SDL.texture.width"; SDL_PROP_TEXTURE_HEIGHT_NUMBER :: "SDL.texture.height"; SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT :: "SDL.texture.SDR_white_point"; SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT :: "SDL.texture.HDR_headroom"; SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER :: "SDL.texture.d3d11.texture"; SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER :: "SDL.texture.d3d11.texture_u"; SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER :: "SDL.texture.d3d11.texture_v"; SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER :: "SDL.texture.d3d12.texture"; SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER :: "SDL.texture.d3d12.texture_u"; SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER :: "SDL.texture.d3d12.texture_v"; SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER :: "SDL.texture.opengl.texture"; SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER :: "SDL.texture.opengl.texture_uv"; SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER :: "SDL.texture.opengl.texture_u"; SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER :: "SDL.texture.opengl.texture_v"; SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER :: "SDL.texture.opengl.target"; SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT :: "SDL.texture.opengl.tex_w"; SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT :: "SDL.texture.opengl.tex_h"; SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER :: "SDL.texture.opengles2.texture"; SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER :: "SDL.texture.opengles2.texture_uv"; SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER :: "SDL.texture.opengles2.texture_u"; SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER :: "SDL.texture.opengles2.texture_v"; SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER :: "SDL.texture.opengles2.target"; SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER :: "SDL.texture.vulkan.texture"; SDL_RENDERER_VSYNC_DISABLED :: 0; SDL_RENDERER_VSYNC_ADAPTIVE :: -1; SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE :: 8; SDL_MS_PER_SECOND :: 1000; SDL_US_PER_SECOND :: 1000000; SDL_NS_PER_SECOND :: 1000000000; SDL_NS_PER_MS :: 1000000; SDL_NS_PER_US :: 1000; SDL_TRAYENTRY_BUTTON :: 0x00000001; SDL_TRAYENTRY_CHECKBOX :: 0x00000002; SDL_TRAYENTRY_SUBMENU :: 0x00000004; SDL_TRAYENTRY_DISABLED :: 0x80000000; SDL_TRAYENTRY_CHECKED :: 0x40000000; SDL_MAJOR_VERSION :: 3; SDL_MINOR_VERSION :: 2; SDL_MICRO_VERSION :: 0; /** * A signed 8-bit integer type. * * \since This macro is available since SDL 3.2.0. */ Sint8 :: s8; /** * An unsigned 8-bit integer type. * * \since This macro is available since SDL 3.2.0. */ Uint8 :: u8; /** * A signed 16-bit integer type. * * \since This macro is available since SDL 3.2.0. */ Sint16 :: s16; /** * An unsigned 16-bit integer type. * * \since This macro is available since SDL 3.2.0. */ Uint16 :: u16; /** * A signed 32-bit integer type. * * \since This macro is available since SDL 3.2.0. */ Sint32 :: s32; /** * An unsigned 32-bit integer type. * * \since This macro is available since SDL 3.2.0. */ Uint32 :: u32; /** * A signed 64-bit integer type. * * \since This macro is available since SDL 3.2.0. * * \sa SDL_SINT64_C */ Sint64 :: s64; /** * An unsigned 64-bit integer type. * * \since This macro is available since SDL 3.2.0. * * \sa SDL_UINT64_C */ Uint64 :: u64; /** * SDL times are signed, 64-bit integers representing nanoseconds since the * Unix epoch (Jan 1, 1970). * * They can be converted between POSIX time_t values with SDL_NS_TO_SECONDS() * and SDL_SECONDS_TO_NS(), and between Windows FILETIME values with * SDL_TimeToWindows() and SDL_TimeFromWindows(). * * \since This macro is available since SDL 3.2.0. * * \sa SDL_MAX_SINT64 * \sa SDL_MIN_SINT64 */ SDL_Time :: Sint64; SDL_alignment_test :: struct { a: Uint8; b: *void; } /* TODO: include/SDL_stdinc.h:390: error: size of array 'SDL_dummy_enum' is negative */ using SDL_DUMMY_ENUM :: enum u32 { DUMMY_ENUM_VALUE :: 0; } /** * Allocate uninitialized memory. * * The allocated memory returned by this function must be freed with * SDL_free(). * * If `size` is 0, it will be set to 1. * * If you want to allocate memory aligned to a specific alignment, consider * using SDL_aligned_alloc(). * * \param size the size to allocate. * \returns a pointer to the allocated memory, or NULL if allocation failed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_calloc * \sa SDL_realloc * \sa SDL_aligned_alloc */ SDL_malloc :: (size: u64) -> *void #foreign libsdl3; /** * Allocate a zero-initialized array. * * The memory returned by this function must be freed with SDL_free(). * * If either of `nmemb` or `size` is 0, they will both be set to 1. * * \param nmemb the number of elements in the array. * \param size the size of each element of the array. * \returns a pointer to the allocated array, or NULL if allocation failed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_malloc * \sa SDL_realloc */ SDL_calloc :: (nmemb: u64, size: u64) -> *void #foreign libsdl3; /** * Change the size of allocated memory. * * The memory returned by this function must be freed with SDL_free(). * * If `size` is 0, it will be set to 1. Note that this is unlike some other C * runtime `realloc` implementations, which may treat `realloc(mem, 0)` the * same way as `free(mem)`. * * If `mem` is NULL, the behavior of this function is equivalent to * SDL_malloc(). Otherwise, the function can have one of three possible * outcomes: * * - If it returns the same pointer as `mem`, it means that `mem` was resized * in place without freeing. * - If it returns a different non-NULL pointer, it means that `mem` was freed * and cannot be dereferenced anymore. * - If it returns NULL (indicating failure), then `mem` will remain valid and * must still be freed with SDL_free(). * * \param mem a pointer to allocated memory to reallocate, or NULL. * \param size the new size of the memory. * \returns a pointer to the newly allocated memory, or NULL if allocation * failed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_malloc * \sa SDL_calloc */ SDL_realloc :: (mem: *void, size: u64) -> *void #foreign libsdl3; /** * Free allocated memory. * * The pointer is no longer valid after this call and cannot be dereferenced * anymore. * * If `mem` is NULL, this function does nothing. * * \param mem a pointer to allocated memory, or NULL. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_malloc * \sa SDL_calloc * \sa SDL_realloc */ SDL_free :: (mem: *void) -> void #foreign libsdl3; /** * A callback used to implement SDL_malloc(). * * SDL will always ensure that the passed `size` is greater than 0. * * \param size the size to allocate. * \returns a pointer to the allocated memory, or NULL if allocation failed. * * \threadsafety It should be safe to call this callback from any thread. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_malloc * \sa SDL_GetOriginalMemoryFunctions * \sa SDL_GetMemoryFunctions * \sa SDL_SetMemoryFunctions */ SDL_malloc_func :: #type (size: u64) -> *void #c_call; /** * A callback used to implement SDL_calloc(). * * SDL will always ensure that the passed `nmemb` and `size` are both greater * than 0. * * \param nmemb the number of elements in the array. * \param size the size of each element of the array. * \returns a pointer to the allocated array, or NULL if allocation failed. * * \threadsafety It should be safe to call this callback from any thread. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_calloc * \sa SDL_GetOriginalMemoryFunctions * \sa SDL_GetMemoryFunctions * \sa SDL_SetMemoryFunctions */ SDL_calloc_func :: #type (nmemb: u64, size: u64) -> *void #c_call; /** * A callback used to implement SDL_realloc(). * * SDL will always ensure that the passed `size` is greater than 0. * * \param mem a pointer to allocated memory to reallocate, or NULL. * \param size the new size of the memory. * \returns a pointer to the newly allocated memory, or NULL if allocation * failed. * * \threadsafety It should be safe to call this callback from any thread. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_realloc * \sa SDL_GetOriginalMemoryFunctions * \sa SDL_GetMemoryFunctions * \sa SDL_SetMemoryFunctions */ SDL_realloc_func :: #type (mem: *void, size: u64) -> *void #c_call; /** * A callback used to implement SDL_free(). * * SDL will always ensure that the passed `mem` is a non-NULL pointer. * * \param mem a pointer to allocated memory. * * \threadsafety It should be safe to call this callback from any thread. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_GetOriginalMemoryFunctions * \sa SDL_GetMemoryFunctions * \sa SDL_SetMemoryFunctions */ SDL_free_func :: #type (mem: *void) -> void #c_call; /** * Get the original set of SDL memory functions. * * This is what SDL_malloc and friends will use by default, if there has been * no call to SDL_SetMemoryFunctions. This is not necessarily using the C * runtime's `malloc` functions behind the scenes! Different platforms and * build configurations might do any number of unexpected things. * * \param malloc_func filled with malloc function. * \param calloc_func filled with calloc function. * \param realloc_func filled with realloc function. * \param free_func filled with free function. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetOriginalMemoryFunctions :: (malloc_func: *SDL_malloc_func, calloc_func: *SDL_calloc_func, realloc_func: *SDL_realloc_func, free_func: *SDL_free_func) -> void #foreign libsdl3; /** * Get the current set of SDL memory functions. * * \param malloc_func filled with malloc function. * \param calloc_func filled with calloc function. * \param realloc_func filled with realloc function. * \param free_func filled with free function. * * \threadsafety This does not hold a lock, so do not call this in the * unlikely event of a background thread calling * SDL_SetMemoryFunctions simultaneously. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetMemoryFunctions * \sa SDL_GetOriginalMemoryFunctions */ SDL_GetMemoryFunctions :: (malloc_func: *SDL_malloc_func, calloc_func: *SDL_calloc_func, realloc_func: *SDL_realloc_func, free_func: *SDL_free_func) -> void #foreign libsdl3; /** * Replace SDL's memory allocation functions with a custom set. * * It is not safe to call this function once any allocations have been made, * as future calls to SDL_free will use the new allocator, even if they came * from an SDL_malloc made with the old one! * * If used, usually this needs to be the first call made into the SDL library, * if not the very first thing done at program startup time. * * \param malloc_func custom malloc function. * \param calloc_func custom calloc function. * \param realloc_func custom realloc function. * \param free_func custom free function. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, but one * should not replace the memory functions once any allocations * are made! * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMemoryFunctions * \sa SDL_GetOriginalMemoryFunctions */ SDL_SetMemoryFunctions :: (malloc_func: SDL_malloc_func, calloc_func: SDL_calloc_func, realloc_func: SDL_realloc_func, free_func: SDL_free_func) -> bool #foreign libsdl3; /** * Allocate memory aligned to a specific alignment. * * The memory returned by this function must be freed with SDL_aligned_free(), * _not_ SDL_free(). * * If `alignment` is less than the size of `void *`, it will be increased to * match that. * * The returned memory address will be a multiple of the alignment value, and * the size of the memory allocated will be a multiple of the alignment value. * * \param alignment the alignment of the memory. * \param size the size to allocate. * \returns a pointer to the aligned memory, or NULL if allocation failed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_aligned_free */ SDL_aligned_alloc :: (alignment: u64, size: u64) -> *void #foreign libsdl3; /** * Free memory allocated by SDL_aligned_alloc(). * * The pointer is no longer valid after this call and cannot be dereferenced * anymore. * * If `mem` is NULL, this function does nothing. * * \param mem a pointer previously returned by SDL_aligned_alloc(), or NULL. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_aligned_alloc */ SDL_aligned_free :: (mem: *void) -> void #foreign libsdl3; /** * Get the number of outstanding (unfreed) allocations. * * \returns the number of allocations or -1 if allocation counting is * disabled. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetNumAllocations :: () -> s32 #foreign libsdl3; SDL_Environment :: struct {} /** * Get the process environment. * * This is initialized at application start and is not affected by setenv() * and unsetenv() calls after that point. Use SDL_SetEnvironmentVariable() and * SDL_UnsetEnvironmentVariable() if you want to modify this environment, or * SDL_setenv_unsafe() or SDL_unsetenv_unsafe() if you want changes to persist * in the C runtime environment after SDL_Quit(). * * \returns a pointer to the environment for the process or NULL on failure; * call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironmentVariable * \sa SDL_GetEnvironmentVariables * \sa SDL_SetEnvironmentVariable * \sa SDL_UnsetEnvironmentVariable */ SDL_GetEnvironment :: () -> *SDL_Environment #foreign libsdl3; /** * Create a set of environment variables * * \param populated true to initialize it from the C runtime environment, * false to create an empty environment. * \returns a pointer to the new environment or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety If `populated` is false, it is safe to call this function * from any thread, otherwise it is safe if no other threads are * calling setenv() or unsetenv() * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironmentVariable * \sa SDL_GetEnvironmentVariables * \sa SDL_SetEnvironmentVariable * \sa SDL_UnsetEnvironmentVariable * \sa SDL_DestroyEnvironment */ SDL_CreateEnvironment :: (populated: bool) -> *SDL_Environment #foreign libsdl3; /** * Get the value of a variable in the environment. * * \param env the environment to query. * \param name the name of the variable to get. * \returns a pointer to the value of the variable or NULL if it can't be * found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment * \sa SDL_GetEnvironmentVariables * \sa SDL_SetEnvironmentVariable * \sa SDL_UnsetEnvironmentVariable */ SDL_GetEnvironmentVariable :: (env: *SDL_Environment, name: *u8) -> *u8 #foreign libsdl3; /** * Get all variables in the environment. * * \param env the environment to query. * \returns a NULL terminated array of pointers to environment variables in * the form "variable=value" or NULL on failure; call SDL_GetError() * for more information. This is a single allocation that should be * freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment * \sa SDL_GetEnvironmentVariables * \sa SDL_SetEnvironmentVariable * \sa SDL_UnsetEnvironmentVariable */ SDL_GetEnvironmentVariables :: (env: *SDL_Environment) -> **u8 #foreign libsdl3; /** * Set the value of a variable in the environment. * * \param env the environment to modify. * \param name the name of the variable to set. * \param value the value of the variable to set. * \param overwrite true to overwrite the variable if it exists, false to * return success without setting the variable if it already * exists. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment * \sa SDL_GetEnvironmentVariable * \sa SDL_GetEnvironmentVariables * \sa SDL_UnsetEnvironmentVariable */ SDL_SetEnvironmentVariable :: (env: *SDL_Environment, name: *u8, value: *u8, overwrite: bool) -> bool #foreign libsdl3; /** * Clear a variable from the environment. * * \param env the environment to modify. * \param name the name of the variable to unset. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEnvironment * \sa SDL_CreateEnvironment * \sa SDL_GetEnvironmentVariable * \sa SDL_GetEnvironmentVariables * \sa SDL_SetEnvironmentVariable * \sa SDL_UnsetEnvironmentVariable */ SDL_UnsetEnvironmentVariable :: (env: *SDL_Environment, name: *u8) -> bool #foreign libsdl3; /** * Destroy a set of environment variables. * * \param env the environment to destroy. * * \threadsafety It is safe to call this function from any thread, as long as * the environment is no longer in use. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateEnvironment */ SDL_DestroyEnvironment :: (env: *SDL_Environment) -> void #foreign libsdl3; /** * Get the value of a variable in the environment. * * This function uses SDL's cached copy of the environment and is thread-safe. * * \param name the name of the variable to get. * \returns a pointer to the value of the variable or NULL if it can't be * found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_getenv :: (name: *u8) -> *u8 #foreign libsdl3; /** * Get the value of a variable in the environment. * * This function bypasses SDL's cached copy of the environment and is not * thread-safe. * * \param name the name of the variable to get. * \returns a pointer to the value of the variable or NULL if it can't be * found. * * \threadsafety This function is not thread safe, consider using SDL_getenv() * instead. * * \since This function is available since SDL 3.2.0. * * \sa SDL_getenv */ SDL_getenv_unsafe :: (name: *u8) -> *u8 #foreign libsdl3; /** * Set the value of a variable in the environment. * * \param name the name of the variable to set. * \param value the value of the variable to set. * \param overwrite 1 to overwrite the variable if it exists, 0 to return * success without setting the variable if it already exists. * \returns 0 on success, -1 on error. * * \threadsafety This function is not thread safe, consider using * SDL_SetEnvironmentVariable() instead. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetEnvironmentVariable */ SDL_setenv_unsafe :: (name: *u8, value: *u8, overwrite: s32) -> s32 #foreign libsdl3; /** * Clear a variable from the environment. * * \param name the name of the variable to unset. * \returns 0 on success, -1 on error. * * \threadsafety This function is not thread safe, consider using * SDL_UnsetEnvironmentVariable() instead. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UnsetEnvironmentVariable */ SDL_unsetenv_unsafe :: (name: *u8) -> s32 #foreign libsdl3; /** * A callback used with SDL sorting and binary search functions. * * \param a a pointer to the first element being compared. * \param b a pointer to the second element being compared. * \returns -1 if `a` should be sorted before `b`, 1 if `b` should be sorted * before `a`, 0 if they are equal. If two elements are equal, their * order in the sorted array is undefined. * * \since This callback is available since SDL 3.2.0. * * \sa SDL_bsearch * \sa SDL_qsort */ SDL_CompareCallback :: #type (a: *void, b: *void) -> s32 #c_call; /** * Sort an array. * * For example: * * ```c * typedef struct { * int key; * const char *string; * } data; * * int SDLCALL compare(const void *a, const void *b) * { * const data *A = (const data *)a; * const data *B = (const data *)b; * * if (A->n < B->n) { * return -1; * } else if (B->n < A->n) { * return 1; * } else { * return 0; * } * } * * data values[] = { * { 3, "third" }, { 1, "first" }, { 2, "second" } * }; * * SDL_qsort(values, SDL_arraysize(values), sizeof(values[0]), compare); * ``` * * \param base a pointer to the start of the array. * \param nmemb the number of elements in the array. * \param size the size of the elements in the array. * \param compare a function used to compare elements in the array. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_bsearch * \sa SDL_qsort_r */ SDL_qsort :: (base: *void, nmemb: u64, size: u64, compare: SDL_CompareCallback) -> void #foreign libsdl3; /** * Perform a binary search on a previously sorted array. * * For example: * * ```c * typedef struct { * int key; * const char *string; * } data; * * int SDLCALL compare(const void *a, const void *b) * { * const data *A = (const data *)a; * const data *B = (const data *)b; * * if (A->n < B->n) { * return -1; * } else if (B->n < A->n) { * return 1; * } else { * return 0; * } * } * * data values[] = { * { 1, "first" }, { 2, "second" }, { 3, "third" } * }; * data key = { 2, NULL }; * * data *result = SDL_bsearch(&key, values, SDL_arraysize(values), sizeof(values[0]), compare); * ``` * * \param key a pointer to a key equal to the element being searched for. * \param base a pointer to the start of the array. * \param nmemb the number of elements in the array. * \param size the size of the elements in the array. * \param compare a function used to compare elements in the array. * \returns a pointer to the matching element in the array, or NULL if not * found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_bsearch_r * \sa SDL_qsort */ SDL_bsearch :: (key: *void, base: *void, nmemb: u64, size: u64, compare: SDL_CompareCallback) -> *void #foreign libsdl3; /** * A callback used with SDL sorting and binary search functions. * * \param userdata the `userdata` pointer passed to the sort function. * \param a a pointer to the first element being compared. * \param b a pointer to the second element being compared. * \returns -1 if `a` should be sorted before `b`, 1 if `b` should be sorted * before `a`, 0 if they are equal. If two elements are equal, their * order in the sorted array is undefined. * * \since This callback is available since SDL 3.2.0. * * \sa SDL_qsort_r * \sa SDL_bsearch_r */ SDL_CompareCallback_r :: #type (userdata: *void, a: *void, b: *void) -> s32 #c_call; /** * Sort an array, passing a userdata pointer to the compare function. * * For example: * * ```c * typedef enum { * sort_increasing, * sort_decreasing, * } sort_method; * * typedef struct { * int key; * const char *string; * } data; * * int SDLCALL compare(const void *userdata, const void *a, const void *b) * { * sort_method method = (sort_method)(uintptr_t)userdata; * const data *A = (const data *)a; * const data *B = (const data *)b; * * if (A->key < B->key) { * return (method == sort_increasing) ? -1 : 1; * } else if (B->key < A->key) { * return (method == sort_increasing) ? 1 : -1; * } else { * return 0; * } * } * * data values[] = { * { 3, "third" }, { 1, "first" }, { 2, "second" } * }; * * SDL_qsort_r(values, SDL_arraysize(values), sizeof(values[0]), compare, (const void *)(uintptr_t)sort_increasing); * ``` * * \param base a pointer to the start of the array. * \param nmemb the number of elements in the array. * \param size the size of the elements in the array. * \param compare a function used to compare elements in the array. * \param userdata a pointer to pass to the compare function. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_bsearch_r * \sa SDL_qsort */ SDL_qsort_r :: (base: *void, nmemb: u64, size: u64, compare: SDL_CompareCallback_r, userdata: *void) -> void #foreign libsdl3; /** * Perform a binary search on a previously sorted array, passing a userdata * pointer to the compare function. * * For example: * * ```c * typedef enum { * sort_increasing, * sort_decreasing, * } sort_method; * * typedef struct { * int key; * const char *string; * } data; * * int SDLCALL compare(const void *userdata, const void *a, const void *b) * { * sort_method method = (sort_method)(uintptr_t)userdata; * const data *A = (const data *)a; * const data *B = (const data *)b; * * if (A->key < B->key) { * return (method == sort_increasing) ? -1 : 1; * } else if (B->key < A->key) { * return (method == sort_increasing) ? 1 : -1; * } else { * return 0; * } * } * * data values[] = { * { 1, "first" }, { 2, "second" }, { 3, "third" } * }; * data key = { 2, NULL }; * * data *result = SDL_bsearch_r(&key, values, SDL_arraysize(values), sizeof(values[0]), compare, (const void *)(uintptr_t)sort_increasing); * ``` * * \param key a pointer to a key equal to the element being searched for. * \param base a pointer to the start of the array. * \param nmemb the number of elements in the array. * \param size the size of the elements in the array. * \param compare a function used to compare elements in the array. * \param userdata a pointer to pass to the compare function. * \returns a pointer to the matching element in the array, or NULL if not * found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_bsearch * \sa SDL_qsort_r */ SDL_bsearch_r :: (key: *void, base: *void, nmemb: u64, size: u64, compare: SDL_CompareCallback_r, userdata: *void) -> *void #foreign libsdl3; /** * Compute the absolute value of `x`. * * \param x an integer value. * \returns the absolute value of x. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_abs :: (x: s32) -> s32 #foreign libsdl3; /** * Query if a character is alphabetic (a letter). * * **WARNING**: Regardless of system locale, this will only treat ASCII values * for English 'a-z' and 'A-Z' as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_isalpha :: (x: s32) -> s32 #foreign libsdl3; /** * Query if a character is alphabetic (a letter) or a number. * * **WARNING**: Regardless of system locale, this will only treat ASCII values * for English 'a-z', 'A-Z', and '0-9' as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_isalnum :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is blank (a space or tab). * * **WARNING**: Regardless of system locale, this will only treat ASCII values * 0x20 (space) or 0x9 (tab) as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_isblank :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is a control character. * * **WARNING**: Regardless of system locale, this will only treat ASCII values * 0 through 0x1F, and 0x7F, as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_iscntrl :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is a numeric digit. * * **WARNING**: Regardless of system locale, this will only treat ASCII values * '0' (0x30) through '9' (0x39), as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_isdigit :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is a hexadecimal digit. * * **WARNING**: Regardless of system locale, this will only treat ASCII values * 'A' through 'F', 'a' through 'f', and '0' through '9', as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_isxdigit :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is a punctuation mark. * * **WARNING**: Regardless of system locale, this is equivalent to * `((SDL_isgraph(x)) && (!SDL_isalnum(x)))`. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_isgraph * \sa SDL_isalnum */ SDL_ispunct :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is whitespace. * * **WARNING**: Regardless of system locale, this will only treat the * following ASCII values as true: * * - space (0x20) * - tab (0x09) * - newline (0x0A) * - vertical tab (0x0B) * - form feed (0x0C) * - return (0x0D) * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_isspace :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is upper case. * * **WARNING**: Regardless of system locale, this will only treat ASCII values * 'A' through 'Z' as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_isupper :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is lower case. * * **WARNING**: Regardless of system locale, this will only treat ASCII values * 'a' through 'z' as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_islower :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is "printable". * * Be advised that "printable" has a definition that goes back to text * terminals from the dawn of computing, making this a sort of special case * function that is not suitable for Unicode (or most any) text management. * * **WARNING**: Regardless of system locale, this will only treat ASCII values * ' ' (0x20) through '~' (0x7E) as true. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_isprint :: (x: s32) -> s32 #foreign libsdl3; /** * Report if a character is any "printable" except space. * * Be advised that "printable" has a definition that goes back to text * terminals from the dawn of computing, making this a sort of special case * function that is not suitable for Unicode (or most any) text management. * * **WARNING**: Regardless of system locale, this is equivalent to * `(SDL_isprint(x)) && ((x) != ' ')`. * * \param x character value to check. * \returns non-zero if x falls within the character class, zero otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_isprint */ SDL_isgraph :: (x: s32) -> s32 #foreign libsdl3; /** * Convert low-ASCII English letters to uppercase. * * **WARNING**: Regardless of system locale, this will only convert ASCII * values 'a' through 'z' to uppercase. * * This function returns the uppercase equivalent of `x`. If a character * cannot be converted, or is already uppercase, this function returns `x`. * * \param x character value to check. * \returns capitalized version of x, or x if no conversion available. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_toupper :: (x: s32) -> s32 #foreign libsdl3; /** * Convert low-ASCII English letters to lowercase. * * **WARNING**: Regardless of system locale, this will only convert ASCII * values 'A' through 'Z' to lowercase. * * This function returns the lowercase equivalent of `x`. If a character * cannot be converted, or is already lowercase, this function returns `x`. * * \param x character value to check. * \returns lowercase version of x, or x if no conversion available. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_tolower :: (x: s32) -> s32 #foreign libsdl3; /** * Calculate a CRC-16 value. * * https://en.wikipedia.org/wiki/Cyclic_redundancy_check * * This function can be called multiple times, to stream data to be * checksummed in blocks. Each call must provide the previous CRC-16 return * value to be updated with the next block. The first call to this function * for a set of blocks should pass in a zero CRC value. * * \param crc the current checksum for this data set, or 0 for a new data set. * \param data a new block of data to add to the checksum. * \param len the size, in bytes, of the new block of data. * \returns a CRC-16 checksum value of all blocks in the data set. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_crc16 :: (crc: Uint16, data: *void, len: u64) -> Uint16 #foreign libsdl3; /** * Calculate a CRC-32 value. * * https://en.wikipedia.org/wiki/Cyclic_redundancy_check * * This function can be called multiple times, to stream data to be * checksummed in blocks. Each call must provide the previous CRC-32 return * value to be updated with the next block. The first call to this function * for a set of blocks should pass in a zero CRC value. * * \param crc the current checksum for this data set, or 0 for a new data set. * \param data a new block of data to add to the checksum. * \param len the size, in bytes, of the new block of data. * \returns a CRC-32 checksum value of all blocks in the data set. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_crc32 :: (crc: Uint32, data: *void, len: u64) -> Uint32 #foreign libsdl3; /** * Calculate a 32-bit MurmurHash3 value for a block of data. * * https://en.wikipedia.org/wiki/MurmurHash * * A seed may be specified, which changes the final results consistently, but * this does not work like SDL_crc16 and SDL_crc32: you can't feed a previous * result from this function back into itself as the next seed value to * calculate a hash in chunks; it won't produce the same hash as it would if * the same data was provided in a single call. * * If you aren't sure what to provide for a seed, zero is fine. Murmur3 is not * cryptographically secure, so it shouldn't be used for hashing top-secret * data. * * \param data the data to be hashed. * \param len the size of data, in bytes. * \param seed a value that alters the final hash value. * \returns a Murmur3 32-bit hash value. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_murmur3_32 :: (data: *void, len: u64, seed: Uint32) -> Uint32 #foreign libsdl3; /** * Copy non-overlapping memory. * * The memory regions must not overlap. If they do, use SDL_memmove() instead. * * \param dst The destination memory region. Must not be NULL, and must not * overlap with `src`. * \param src The source memory region. Must not be NULL, and must not overlap * with `dst`. * \param len The length in bytes of both `dst` and `src`. * \returns `dst`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_memmove */ SDL_memcpy :: (dst: *void, src: *void, len: u64) -> *void #foreign libsdl3; /** * Copy memory ranges that might overlap. * * It is okay for the memory regions to overlap. If you are confident that the * regions never overlap, using SDL_memcpy() may improve performance. * * \param dst The destination memory region. Must not be NULL. * \param src The source memory region. Must not be NULL. * \param len The length in bytes of both `dst` and `src`. * \returns `dst`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_memcpy */ SDL_memmove :: (dst: *void, src: *void, len: u64) -> *void #foreign libsdl3; /** * Initialize all bytes of buffer of memory to a specific value. * * This function will set `len` bytes, pointed to by `dst`, to the value * specified in `c`. * * Despite `c` being an `int` instead of a `char`, this only operates on * bytes; `c` must be a value between 0 and 255, inclusive. * * \param dst the destination memory region. Must not be NULL. * \param c the byte value to set. * \param len the length, in bytes, to set in `dst`. * \returns `dst`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_memset :: (dst: *void, c: s32, len: u64) -> *void #foreign libsdl3; /** * Initialize all 32-bit words of buffer of memory to a specific value. * * This function will set a buffer of `dwords` Uint32 values, pointed to by * `dst`, to the value specified in `val`. * * Unlike SDL_memset, this sets 32-bit values, not bytes, so it's not limited * to a range of 0-255. * * \param dst the destination memory region. Must not be NULL. * \param val the Uint32 value to set. * \param dwords the number of Uint32 values to set in `dst`. * \returns `dst`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_memset4 :: (dst: *void, val: Uint32, dwords: u64) -> *void #foreign libsdl3; /** * Compare two buffers of memory. * * \param s1 the first buffer to compare. NULL is not permitted! * \param s2 the second buffer to compare. NULL is not permitted! * \param len the number of bytes to compare between the buffers. * \returns less than zero if s1 is "less than" s2, greater than zero if s1 is * "greater than" s2, and zero if the buffers match exactly for `len` * bytes. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_memcmp :: (s1: *void, s2: *void, len: u64) -> s32 #foreign libsdl3; /** * This works exactly like wcslen() but doesn't require access to a C runtime. * * Counts the number of wchar_t values in `wstr`, excluding the null * terminator. * * Like SDL_strlen only counts bytes and not codepoints in a UTF-8 string, * this counts wchar_t values in a string, even if the string's encoding is of * variable width, like UTF-16. * * Also be aware that wchar_t is different sizes on different platforms (4 * bytes on Linux, 2 on Windows, etc). * * \param wstr The null-terminated wide string to read. Must not be NULL. * \returns the length (in wchar_t values, excluding the null terminator) of * `wstr`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_wcsnlen * \sa SDL_utf8strlen * \sa SDL_utf8strnlen */ SDL_wcslen :: (wstr: *s32) -> u64 #foreign libsdl3; /** * This works exactly like wcsnlen() but doesn't require access to a C * runtime. * * Counts up to a maximum of `maxlen` wchar_t values in `wstr`, excluding the * null terminator. * * Like SDL_strnlen only counts bytes and not codepoints in a UTF-8 string, * this counts wchar_t values in a string, even if the string's encoding is of * variable width, like UTF-16. * * Also be aware that wchar_t is different sizes on different platforms (4 * bytes on Linux, 2 on Windows, etc). * * Also, `maxlen` is a count of wide characters, not bytes! * * \param wstr The null-terminated wide string to read. Must not be NULL. * \param maxlen The maximum amount of wide characters to count. * \returns the length (in wide characters, excluding the null terminator) of * `wstr` but never more than `maxlen`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_wcslen * \sa SDL_utf8strlen * \sa SDL_utf8strnlen */ SDL_wcsnlen :: (wstr: *s32, maxlen: u64) -> u64 #foreign libsdl3; /** * Copy a wide string. * * This function copies `maxlen` - 1 wide characters from `src` to `dst`, then * appends a null terminator. * * `src` and `dst` must not overlap. * * If `maxlen` is 0, no wide characters are copied and no null terminator is * written. * * \param dst The destination buffer. Must not be NULL, and must not overlap * with `src`. * \param src The null-terminated wide string to copy. Must not be NULL, and * must not overlap with `dst`. * \param maxlen The length (in wide characters) of the destination buffer. * \returns the length (in wide characters, excluding the null terminator) of * `src`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_wcslcat */ SDL_wcslcpy :: (dst: *s32, src: *s32, maxlen: u64) -> u64 #foreign libsdl3; /** * Concatenate wide strings. * * This function appends up to `maxlen` - SDL_wcslen(dst) - 1 wide characters * from `src` to the end of the wide string in `dst`, then appends a null * terminator. * * `src` and `dst` must not overlap. * * If `maxlen` - SDL_wcslen(dst) - 1 is less than or equal to 0, then `dst` is * unmodified. * * \param dst The destination buffer already containing the first * null-terminated wide string. Must not be NULL and must not * overlap with `src`. * \param src The second null-terminated wide string. Must not be NULL, and * must not overlap with `dst`. * \param maxlen The length (in wide characters) of the destination buffer. * \returns the length (in wide characters, excluding the null terminator) of * the string in `dst` plus the length of `src`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_wcslcpy */ SDL_wcslcat :: (dst: *s32, src: *s32, maxlen: u64) -> u64 #foreign libsdl3; /** * Allocate a copy of a wide string. * * This allocates enough space for a null-terminated copy of `wstr`, using * SDL_malloc, and then makes a copy of the string into this space. * * The returned string is owned by the caller, and should be passed to * SDL_free when no longer needed. * * \param wstr the string to copy. * \returns a pointer to the newly-allocated wide string. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_wcsdup :: (wstr: *s32) -> *s32 #foreign libsdl3; /** * Search a wide string for the first instance of a specific substring. * * The search ends once it finds the requested substring, or a null terminator * byte to end the string. * * Note that this looks for strings of _wide characters_, not _codepoints_, so * it's legal to search for malformed and incomplete UTF-16 sequences. * * \param haystack the wide string to search. Must not be NULL. * \param needle the wide string to search for. Must not be NULL. * \returns a pointer to the first instance of `needle` in the string, or NULL * if not found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_wcsstr :: (haystack: *s32, needle: *s32) -> *s32 #foreign libsdl3; /** * Search a wide string, up to n wide chars, for the first instance of a * specific substring. * * The search ends once it finds the requested substring, or a null terminator * value to end the string, or `maxlen` wide character have been examined. It * is possible to use this function on a wide string without a null * terminator. * * Note that this looks for strings of _wide characters_, not _codepoints_, so * it's legal to search for malformed and incomplete UTF-16 sequences. * * \param haystack the wide string to search. Must not be NULL. * \param needle the wide string to search for. Must not be NULL. * \param maxlen the maximum number of wide characters to search in * `haystack`. * \returns a pointer to the first instance of `needle` in the string, or NULL * if not found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_wcsnstr :: (haystack: *s32, needle: *s32, maxlen: u64) -> *s32 #foreign libsdl3; /** * Compare two null-terminated wide strings. * * This only compares wchar_t values until it hits a null-terminating * character; it does not care if the string is well-formed UTF-16 (or UTF-32, * depending on your platform's wchar_t size), or uses valid Unicode values. * * \param str1 the first string to compare. NULL is not permitted! * \param str2 the second string to compare. NULL is not permitted! * \returns less than zero if str1 is "less than" str2, greater than zero if * str1 is "greater than" str2, and zero if the strings match * exactly. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_wcscmp :: (str1: *s32, str2: *s32) -> s32 #foreign libsdl3; /** * Compare two wide strings up to a number of wchar_t values. * * This only compares wchar_t values; it does not care if the string is * well-formed UTF-16 (or UTF-32, depending on your platform's wchar_t size), * or uses valid Unicode values. * * Note that while this function is intended to be used with UTF-16 (or * UTF-32, depending on your platform's definition of wchar_t), it is * comparing raw wchar_t values and not Unicode codepoints: `maxlen` specifies * a wchar_t limit! If the limit lands in the middle of a multi-wchar UTF-16 * sequence, it will only compare a portion of the final character. * * `maxlen` specifies a maximum number of wchar_t to compare; if the strings * match to this number of wide chars (or both have matched to a * null-terminator character before this count), they will be considered * equal. * * \param str1 the first string to compare. NULL is not permitted! * \param str2 the second string to compare. NULL is not permitted! * \param maxlen the maximum number of wchar_t to compare. * \returns less than zero if str1 is "less than" str2, greater than zero if * str1 is "greater than" str2, and zero if the strings match * exactly. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_wcsncmp :: (str1: *s32, str2: *s32, maxlen: u64) -> s32 #foreign libsdl3; /** * Compare two null-terminated wide strings, case-insensitively. * * This will work with Unicode strings, using a technique called * "case-folding" to handle the vast majority of case-sensitive human * languages regardless of system locale. It can deal with expanding values: a * German Eszett character can compare against two ASCII 's' chars and be * considered a match, for example. A notable exception: it does not handle * the Turkish 'i' character; human language is complicated! * * Depending on your platform, "wchar_t" might be 2 bytes, and expected to be * UTF-16 encoded (like Windows), or 4 bytes in UTF-32 format. Since this * handles Unicode, it expects the string to be well-formed and not a * null-terminated string of arbitrary bytes. Characters that are not valid * UTF-16 (or UTF-32) are treated as Unicode character U+FFFD (REPLACEMENT * CHARACTER), which is to say two strings of random bits may turn out to * match if they convert to the same amount of replacement characters. * * \param str1 the first string to compare. NULL is not permitted! * \param str2 the second string to compare. NULL is not permitted! * \returns less than zero if str1 is "less than" str2, greater than zero if * str1 is "greater than" str2, and zero if the strings match * exactly. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_wcscasecmp :: (str1: *s32, str2: *s32) -> s32 #foreign libsdl3; /** * Compare two wide strings, case-insensitively, up to a number of wchar_t. * * This will work with Unicode strings, using a technique called * "case-folding" to handle the vast majority of case-sensitive human * languages regardless of system locale. It can deal with expanding values: a * German Eszett character can compare against two ASCII 's' chars and be * considered a match, for example. A notable exception: it does not handle * the Turkish 'i' character; human language is complicated! * * Depending on your platform, "wchar_t" might be 2 bytes, and expected to be * UTF-16 encoded (like Windows), or 4 bytes in UTF-32 format. Since this * handles Unicode, it expects the string to be well-formed and not a * null-terminated string of arbitrary bytes. Characters that are not valid * UTF-16 (or UTF-32) are treated as Unicode character U+FFFD (REPLACEMENT * CHARACTER), which is to say two strings of random bits may turn out to * match if they convert to the same amount of replacement characters. * * Note that while this function might deal with variable-sized characters, * `maxlen` specifies a _wchar_ limit! If the limit lands in the middle of a * multi-byte UTF-16 sequence, it may convert a portion of the final character * to one or more Unicode character U+FFFD (REPLACEMENT CHARACTER) so as not * to overflow a buffer. * * `maxlen` specifies a maximum number of wchar_t values to compare; if the * strings match to this number of wchar_t (or both have matched to a * null-terminator character before this number of bytes), they will be * considered equal. * * \param str1 the first string to compare. NULL is not permitted! * \param str2 the second string to compare. NULL is not permitted! * \param maxlen the maximum number of wchar_t values to compare. * \returns less than zero if str1 is "less than" str2, greater than zero if * str1 is "greater than" str2, and zero if the strings match * exactly. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_wcsncasecmp :: (str1: *s32, str2: *s32, maxlen: u64) -> s32 #foreign libsdl3; /** * Parse a `long` from a wide string. * * If `str` starts with whitespace, then those whitespace characters are * skipped before attempting to parse the number. * * If the parsed number does not fit inside a `long`, the result is clamped to * the minimum and maximum representable `long` values. * * \param str The null-terminated wide string to read. Must not be NULL. * \param endp If not NULL, the address of the first invalid wide character * (i.e. the next character after the parsed number) will be * written to this pointer. * \param base The base of the integer to read. Supported values are 0 and 2 * to 36 inclusive. If 0, the base will be inferred from the * number's prefix (0x for hexadecimal, 0 for octal, decimal * otherwise). * \returns the parsed `long`, or 0 if no number could be parsed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_strtol */ SDL_wcstol :: (str: *s32, endp: **s32, base: s32) -> s64 #foreign libsdl3; /** * This works exactly like strlen() but doesn't require access to a C runtime. * * Counts the bytes in `str`, excluding the null terminator. * * If you need the length of a UTF-8 string, consider using SDL_utf8strlen(). * * \param str The null-terminated string to read. Must not be NULL. * \returns the length (in bytes, excluding the null terminator) of `src`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_strnlen * \sa SDL_utf8strlen * \sa SDL_utf8strnlen */ SDL_strlen :: (str: *u8) -> u64 #foreign libsdl3; /** * This works exactly like strnlen() but doesn't require access to a C * runtime. * * Counts up to a maximum of `maxlen` bytes in `str`, excluding the null * terminator. * * If you need the length of a UTF-8 string, consider using SDL_utf8strnlen(). * * \param str The null-terminated string to read. Must not be NULL. * \param maxlen The maximum amount of bytes to count. * \returns the length (in bytes, excluding the null terminator) of `src` but * never more than `maxlen`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_strlen * \sa SDL_utf8strlen * \sa SDL_utf8strnlen */ SDL_strnlen :: (str: *u8, maxlen: u64) -> u64 #foreign libsdl3; /** * Copy a string. * * This function copies up to `maxlen` - 1 characters from `src` to `dst`, * then appends a null terminator. * * If `maxlen` is 0, no characters are copied and no null terminator is * written. * * If you want to copy an UTF-8 string but need to ensure that multi-byte * sequences are not truncated, consider using SDL_utf8strlcpy(). * * \param dst The destination buffer. Must not be NULL, and must not overlap * with `src`. * \param src The null-terminated string to copy. Must not be NULL, and must * not overlap with `dst`. * \param maxlen The length (in characters) of the destination buffer. * \returns the length (in characters, excluding the null terminator) of * `src`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_strlcat * \sa SDL_utf8strlcpy */ SDL_strlcpy :: (dst: *u8, src: *u8, maxlen: u64) -> u64 #foreign libsdl3; /** * Copy an UTF-8 string. * * This function copies up to `dst_bytes` - 1 bytes from `src` to `dst` while * also ensuring that the string written to `dst` does not end in a truncated * multi-byte sequence. Finally, it appends a null terminator. * * `src` and `dst` must not overlap. * * Note that unlike SDL_strlcpy(), this function returns the number of bytes * written, not the length of `src`. * * \param dst The destination buffer. Must not be NULL, and must not overlap * with `src`. * \param src The null-terminated UTF-8 string to copy. Must not be NULL, and * must not overlap with `dst`. * \param dst_bytes The length (in bytes) of the destination buffer. Must not * be 0. * \returns the number of bytes written, excluding the null terminator. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_strlcpy */ SDL_utf8strlcpy :: (dst: *u8, src: *u8, dst_bytes: u64) -> u64 #foreign libsdl3; /** * Concatenate strings. * * This function appends up to `maxlen` - SDL_strlen(dst) - 1 characters from * `src` to the end of the string in `dst`, then appends a null terminator. * * `src` and `dst` must not overlap. * * If `maxlen` - SDL_strlen(dst) - 1 is less than or equal to 0, then `dst` is * unmodified. * * \param dst The destination buffer already containing the first * null-terminated string. Must not be NULL and must not overlap * with `src`. * \param src The second null-terminated string. Must not be NULL, and must * not overlap with `dst`. * \param maxlen The length (in characters) of the destination buffer. * \returns the length (in characters, excluding the null terminator) of the * string in `dst` plus the length of `src`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_strlcpy */ SDL_strlcat :: (dst: *u8, src: *u8, maxlen: u64) -> u64 #foreign libsdl3; /** * Allocate a copy of a string. * * This allocates enough space for a null-terminated copy of `str`, using * SDL_malloc, and then makes a copy of the string into this space. * * The returned string is owned by the caller, and should be passed to * SDL_free when no longer needed. * * \param str the string to copy. * \returns a pointer to the newly-allocated string. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strdup :: (str: *u8) -> *u8 #foreign libsdl3; /** * Allocate a copy of a string, up to n characters. * * This allocates enough space for a null-terminated copy of `str`, up to * `maxlen` bytes, using SDL_malloc, and then makes a copy of the string into * this space. * * If the string is longer than `maxlen` bytes, the returned string will be * `maxlen` bytes long, plus a null-terminator character that isn't included * in the count. * * The returned string is owned by the caller, and should be passed to * SDL_free when no longer needed. * * \param str the string to copy. * \param maxlen the maximum length of the copied string, not counting the * null-terminator character. * \returns a pointer to the newly-allocated string. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strndup :: (str: *u8, maxlen: u64) -> *u8 #foreign libsdl3; /** * Reverse a string's contents. * * This reverses a null-terminated string in-place. Only the content of the * string is reversed; the null-terminator character remains at the end of the * reversed string. * * **WARNING**: This function reverses the _bytes_ of the string, not the * codepoints. If `str` is a UTF-8 string with Unicode codepoints > 127, this * will ruin the string data. You should only use this function on strings * that are completely comprised of low ASCII characters. * * \param str the string to reverse. * \returns `str`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strrev :: (str: *u8) -> *u8 #foreign libsdl3; /** * Convert a string to uppercase. * * **WARNING**: Regardless of system locale, this will only convert ASCII * values 'A' through 'Z' to uppercase. * * This function operates on a null-terminated string of bytes--even if it is * malformed UTF-8!--and converts ASCII characters 'a' through 'z' to their * uppercase equivalents in-place, returning the original `str` pointer. * * \param str the string to convert in-place. Can not be NULL. * \returns the `str` pointer passed into this function. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_strlwr */ SDL_strupr :: (str: *u8) -> *u8 #foreign libsdl3; /** * Convert a string to lowercase. * * **WARNING**: Regardless of system locale, this will only convert ASCII * values 'A' through 'Z' to lowercase. * * This function operates on a null-terminated string of bytes--even if it is * malformed UTF-8!--and converts ASCII characters 'A' through 'Z' to their * lowercase equivalents in-place, returning the original `str` pointer. * * \param str the string to convert in-place. Can not be NULL. * \returns the `str` pointer passed into this function. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_strupr */ SDL_strlwr :: (str: *u8) -> *u8 #foreign libsdl3; /** * Search a string for the first instance of a specific byte. * * The search ends once it finds the requested byte value, or a null * terminator byte to end the string. * * Note that this looks for _bytes_, not _characters_, so you cannot match * against a Unicode codepoint > 255, regardless of character encoding. * * \param str the string to search. Must not be NULL. * \param c the byte value to search for. * \returns a pointer to the first instance of `c` in the string, or NULL if * not found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strchr :: (str: *u8, c: s32) -> *u8 #foreign libsdl3; /** * Search a string for the last instance of a specific byte. * * The search must go until it finds a null terminator byte to end the string. * * Note that this looks for _bytes_, not _characters_, so you cannot match * against a Unicode codepoint > 255, regardless of character encoding. * * \param str the string to search. Must not be NULL. * \param c the byte value to search for. * \returns a pointer to the last instance of `c` in the string, or NULL if * not found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strrchr :: (str: *u8, c: s32) -> *u8 #foreign libsdl3; /** * Search a string for the first instance of a specific substring. * * The search ends once it finds the requested substring, or a null terminator * byte to end the string. * * Note that this looks for strings of _bytes_, not _characters_, so it's * legal to search for malformed and incomplete UTF-8 sequences. * * \param haystack the string to search. Must not be NULL. * \param needle the string to search for. Must not be NULL. * \returns a pointer to the first instance of `needle` in the string, or NULL * if not found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strstr :: (haystack: *u8, needle: *u8) -> *u8 #foreign libsdl3; /** * Search a string, up to n bytes, for the first instance of a specific * substring. * * The search ends once it finds the requested substring, or a null terminator * byte to end the string, or `maxlen` bytes have been examined. It is * possible to use this function on a string without a null terminator. * * Note that this looks for strings of _bytes_, not _characters_, so it's * legal to search for malformed and incomplete UTF-8 sequences. * * \param haystack the string to search. Must not be NULL. * \param needle the string to search for. Must not be NULL. * \param maxlen the maximum number of bytes to search in `haystack`. * \returns a pointer to the first instance of `needle` in the string, or NULL * if not found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strnstr :: (haystack: *u8, needle: *u8, maxlen: u64) -> *u8 #foreign libsdl3; /** * Search a UTF-8 string for the first instance of a specific substring, * case-insensitively. * * This will work with Unicode strings, using a technique called * "case-folding" to handle the vast majority of case-sensitive human * languages regardless of system locale. It can deal with expanding values: a * German Eszett character can compare against two ASCII 's' chars and be * considered a match, for example. A notable exception: it does not handle * the Turkish 'i' character; human language is complicated! * * Since this handles Unicode, it expects the strings to be well-formed UTF-8 * and not a null-terminated string of arbitrary bytes. Bytes that are not * valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT * CHARACTER), which is to say two strings of random bits may turn out to * match if they convert to the same amount of replacement characters. * * \param haystack the string to search. Must not be NULL. * \param needle the string to search for. Must not be NULL. * \returns a pointer to the first instance of `needle` in the string, or NULL * if not found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strcasestr :: (haystack: *u8, needle: *u8) -> *u8 #foreign libsdl3; /** * This works exactly like strtok_r() but doesn't require access to a C * runtime. * * Break a string up into a series of tokens. * * To start tokenizing a new string, `str` should be the non-NULL address of * the string to start tokenizing. Future calls to get the next token from the * same string should specify a NULL. * * Note that this function will overwrite pieces of `str` with null chars to * split it into tokens. This function cannot be used with const/read-only * strings! * * `saveptr` just needs to point to a `char *` that can be overwritten; SDL * will use this to save tokenizing state between calls. It is initialized if * `str` is non-NULL, and used to resume tokenizing when `str` is NULL. * * \param str the string to tokenize, or NULL to continue tokenizing. * \param delim the delimiter string that separates tokens. * \param saveptr pointer to a char *, used for ongoing state. * \returns A pointer to the next token, or NULL if no tokens remain. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strtok_r :: (str: *u8, delim: *u8, saveptr: **u8) -> *u8 #foreign libsdl3; /** * Count the number of codepoints in a UTF-8 string. * * Counts the _codepoints_, not _bytes_, in `str`, excluding the null * terminator. * * If you need to count the bytes in a string instead, consider using * SDL_strlen(). * * Since this handles Unicode, it expects the strings to be well-formed UTF-8 * and not a null-terminated string of arbitrary bytes. Bytes that are not * valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT * CHARACTER), so a malformed or incomplete UTF-8 sequence might increase the * count by several replacement characters. * * \param str The null-terminated UTF-8 string to read. Must not be NULL. * \returns The length (in codepoints, excluding the null terminator) of * `src`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_utf8strnlen * \sa SDL_strlen */ SDL_utf8strlen :: (str: *u8) -> u64 #foreign libsdl3; /** * Count the number of codepoints in a UTF-8 string, up to n bytes. * * Counts the _codepoints_, not _bytes_, in `str`, excluding the null * terminator. * * If you need to count the bytes in a string instead, consider using * SDL_strnlen(). * * The counting stops at `bytes` bytes (not codepoints!). This seems * counterintuitive, but makes it easy to express the total size of the * string's buffer. * * Since this handles Unicode, it expects the strings to be well-formed UTF-8 * and not a null-terminated string of arbitrary bytes. Bytes that are not * valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT * CHARACTER), so a malformed or incomplete UTF-8 sequence might increase the * count by several replacement characters. * * \param str The null-terminated UTF-8 string to read. Must not be NULL. * \param bytes The maximum amount of bytes to count. * \returns The length (in codepoints, excluding the null terminator) of `src` * but never more than `maxlen`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_utf8strlen * \sa SDL_strnlen */ SDL_utf8strnlen :: (str: *u8, bytes: u64) -> u64 #foreign libsdl3; /** * Convert an integer into a string. * * This requires a radix to specified for string format. Specifying 10 * produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2 * to 36. * * Note that this function will overflow a buffer if `str` is not large enough * to hold the output! It may be safer to use SDL_snprintf to clamp output, or * SDL_asprintf to allocate a buffer. Otherwise, it doesn't hurt to allocate * much more space than you expect to use (and don't forget possible negative * signs, null terminator bytes, etc). * * \param value the integer to convert. * \param str the buffer to write the string into. * \param radix the radix to use for string generation. * \returns `str`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_uitoa * \sa SDL_ltoa * \sa SDL_lltoa */ SDL_itoa :: (value: s32, str: *u8, radix: s32) -> *u8 #foreign libsdl3; /** * Convert an unsigned integer into a string. * * This requires a radix to specified for string format. Specifying 10 * produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2 * to 36. * * Note that this function will overflow a buffer if `str` is not large enough * to hold the output! It may be safer to use SDL_snprintf to clamp output, or * SDL_asprintf to allocate a buffer. Otherwise, it doesn't hurt to allocate * much more space than you expect to use (and don't forget null terminator * bytes, etc). * * \param value the unsigned integer to convert. * \param str the buffer to write the string into. * \param radix the radix to use for string generation. * \returns `str`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_itoa * \sa SDL_ultoa * \sa SDL_ulltoa */ SDL_uitoa :: (value: u32, str: *u8, radix: s32) -> *u8 #foreign libsdl3; /** * Convert a long integer into a string. * * This requires a radix to specified for string format. Specifying 10 * produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2 * to 36. * * Note that this function will overflow a buffer if `str` is not large enough * to hold the output! It may be safer to use SDL_snprintf to clamp output, or * SDL_asprintf to allocate a buffer. Otherwise, it doesn't hurt to allocate * much more space than you expect to use (and don't forget possible negative * signs, null terminator bytes, etc). * * \param value the long integer to convert. * \param str the buffer to write the string into. * \param radix the radix to use for string generation. * \returns `str`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ultoa * \sa SDL_itoa * \sa SDL_lltoa */ SDL_ltoa :: (value: s64, str: *u8, radix: s32) -> *u8 #foreign libsdl3; /** * Convert an unsigned long integer into a string. * * This requires a radix to specified for string format. Specifying 10 * produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2 * to 36. * * Note that this function will overflow a buffer if `str` is not large enough * to hold the output! It may be safer to use SDL_snprintf to clamp output, or * SDL_asprintf to allocate a buffer. Otherwise, it doesn't hurt to allocate * much more space than you expect to use (and don't forget null terminator * bytes, etc). * * \param value the unsigned long integer to convert. * \param str the buffer to write the string into. * \param radix the radix to use for string generation. * \returns `str`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ltoa * \sa SDL_uitoa * \sa SDL_ulltoa */ SDL_ultoa :: (value: u64, str: *u8, radix: s32) -> *u8 #foreign libsdl3; /** * Convert a long long integer into a string. * * This requires a radix to specified for string format. Specifying 10 * produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2 * to 36. * * Note that this function will overflow a buffer if `str` is not large enough * to hold the output! It may be safer to use SDL_snprintf to clamp output, or * SDL_asprintf to allocate a buffer. Otherwise, it doesn't hurt to allocate * much more space than you expect to use (and don't forget possible negative * signs, null terminator bytes, etc). * * \param value the long long integer to convert. * \param str the buffer to write the string into. * \param radix the radix to use for string generation. * \returns `str`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ulltoa * \sa SDL_itoa * \sa SDL_ltoa */ SDL_lltoa :: (value: s64, str: *u8, radix: s32) -> *u8 #foreign libsdl3; /** * Convert an unsigned long long integer into a string. * * This requires a radix to specified for string format. Specifying 10 * produces a decimal number, 16 hexidecimal, etc. Must be in the range of 2 * to 36. * * Note that this function will overflow a buffer if `str` is not large enough * to hold the output! It may be safer to use SDL_snprintf to clamp output, or * SDL_asprintf to allocate a buffer. Otherwise, it doesn't hurt to allocate * much more space than you expect to use (and don't forget null terminator * bytes, etc). * * \param value the unsigned long long integer to convert. * \param str the buffer to write the string into. * \param radix the radix to use for string generation. * \returns `str`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_lltoa * \sa SDL_uitoa * \sa SDL_ultoa */ SDL_ulltoa :: (value: u64, str: *u8, radix: s32) -> *u8 #foreign libsdl3; /** * Parse an `int` from a string. * * The result of calling `SDL_atoi(str)` is equivalent to * `(int)SDL_strtol(str, NULL, 10)`. * * \param str The null-terminated string to read. Must not be NULL. * \returns the parsed `int`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atof * \sa SDL_strtol * \sa SDL_strtoul * \sa SDL_strtoll * \sa SDL_strtoull * \sa SDL_strtod * \sa SDL_itoa */ SDL_atoi :: (str: *u8) -> s32 #foreign libsdl3; /** * Parse a `double` from a string. * * The result of calling `SDL_atof(str)` is equivalent to `SDL_strtod(str, * NULL)`. * * \param str The null-terminated string to read. Must not be NULL. * \returns the parsed `double`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_strtol * \sa SDL_strtoul * \sa SDL_strtoll * \sa SDL_strtoull * \sa SDL_strtod */ SDL_atof :: (str: *u8) -> float64 #foreign libsdl3; /** * Parse a `long` from a string. * * If `str` starts with whitespace, then those whitespace characters are * skipped before attempting to parse the number. * * If the parsed number does not fit inside a `long`, the result is clamped to * the minimum and maximum representable `long` values. * * \param str The null-terminated string to read. Must not be NULL. * \param endp If not NULL, the address of the first invalid character (i.e. * the next character after the parsed number) will be written to * this pointer. * \param base The base of the integer to read. Supported values are 0 and 2 * to 36 inclusive. If 0, the base will be inferred from the * number's prefix (0x for hexadecimal, 0 for octal, decimal * otherwise). * \returns the parsed `long`, or 0 if no number could be parsed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof * \sa SDL_strtoul * \sa SDL_strtoll * \sa SDL_strtoull * \sa SDL_strtod * \sa SDL_ltoa * \sa SDL_wcstol */ SDL_strtol :: (str: *u8, endp: **u8, base: s32) -> s64 #foreign libsdl3; /** * Parse an `unsigned long` from a string. * * If `str` starts with whitespace, then those whitespace characters are * skipped before attempting to parse the number. * * If the parsed number does not fit inside an `unsigned long`, the result is * clamped to the maximum representable `unsigned long` value. * * \param str The null-terminated string to read. Must not be NULL. * \param endp If not NULL, the address of the first invalid character (i.e. * the next character after the parsed number) will be written to * this pointer. * \param base The base of the integer to read. Supported values are 0 and 2 * to 36 inclusive. If 0, the base will be inferred from the * number's prefix (0x for hexadecimal, 0 for octal, decimal * otherwise). * \returns the parsed `unsigned long`, or 0 if no number could be parsed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof * \sa SDL_strtol * \sa SDL_strtoll * \sa SDL_strtoull * \sa SDL_strtod * \sa SDL_ultoa */ SDL_strtoul :: (str: *u8, endp: **u8, base: s32) -> u64 #foreign libsdl3; /** * Parse a `long long` from a string. * * If `str` starts with whitespace, then those whitespace characters are * skipped before attempting to parse the number. * * If the parsed number does not fit inside a `long long`, the result is * clamped to the minimum and maximum representable `long long` values. * * \param str The null-terminated string to read. Must not be NULL. * \param endp If not NULL, the address of the first invalid character (i.e. * the next character after the parsed number) will be written to * this pointer. * \param base The base of the integer to read. Supported values are 0 and 2 * to 36 inclusive. If 0, the base will be inferred from the * number's prefix (0x for hexadecimal, 0 for octal, decimal * otherwise). * \returns the parsed `long long`, or 0 if no number could be parsed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof * \sa SDL_strtol * \sa SDL_strtoul * \sa SDL_strtoull * \sa SDL_strtod * \sa SDL_lltoa */ SDL_strtoll :: (str: *u8, endp: **u8, base: s32) -> s64 #foreign libsdl3; /** * Parse an `unsigned long long` from a string. * * If `str` starts with whitespace, then those whitespace characters are * skipped before attempting to parse the number. * * If the parsed number does not fit inside an `unsigned long long`, the * result is clamped to the maximum representable `unsigned long long` value. * * \param str The null-terminated string to read. Must not be NULL. * \param endp If not NULL, the address of the first invalid character (i.e. * the next character after the parsed number) will be written to * this pointer. * \param base The base of the integer to read. Supported values are 0 and 2 * to 36 inclusive. If 0, the base will be inferred from the * number's prefix (0x for hexadecimal, 0 for octal, decimal * otherwise). * \returns the parsed `unsigned long long`, or 0 if no number could be * parsed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof * \sa SDL_strtol * \sa SDL_strtoll * \sa SDL_strtoul * \sa SDL_strtod * \sa SDL_ulltoa */ SDL_strtoull :: (str: *u8, endp: **u8, base: s32) -> u64 #foreign libsdl3; /** * Parse a `double` from a string. * * This function makes fewer guarantees than the C runtime `strtod`: * * - Only decimal notation is guaranteed to be supported. The handling of * scientific and hexadecimal notation is unspecified. * - Whether or not INF and NAN can be parsed is unspecified. * - The precision of the result is unspecified. * * \param str the null-terminated string to read. Must not be NULL. * \param endp if not NULL, the address of the first invalid character (i.e. * the next character after the parsed number) will be written to * this pointer. * \returns the parsed `double`, or 0 if no number could be parsed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atoi * \sa SDL_atof * \sa SDL_strtol * \sa SDL_strtoll * \sa SDL_strtoul * \sa SDL_strtoull */ SDL_strtod :: (str: *u8, endp: **u8) -> float64 #foreign libsdl3; /** * Compare two null-terminated UTF-8 strings. * * Due to the nature of UTF-8 encoding, this will work with Unicode strings, * since effectively this function just compares bytes until it hits a * null-terminating character. Also due to the nature of UTF-8, this can be * used with SDL_qsort() to put strings in (roughly) alphabetical order. * * \param str1 the first string to compare. NULL is not permitted! * \param str2 the second string to compare. NULL is not permitted! * \returns less than zero if str1 is "less than" str2, greater than zero if * str1 is "greater than" str2, and zero if the strings match * exactly. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strcmp :: (str1: *u8, str2: *u8) -> s32 #foreign libsdl3; /** * Compare two UTF-8 strings up to a number of bytes. * * Due to the nature of UTF-8 encoding, this will work with Unicode strings, * since effectively this function just compares bytes until it hits a * null-terminating character. Also due to the nature of UTF-8, this can be * used with SDL_qsort() to put strings in (roughly) alphabetical order. * * Note that while this function is intended to be used with UTF-8, it is * doing a bytewise comparison, and `maxlen` specifies a _byte_ limit! If the * limit lands in the middle of a multi-byte UTF-8 sequence, it will only * compare a portion of the final character. * * `maxlen` specifies a maximum number of bytes to compare; if the strings * match to this number of bytes (or both have matched to a null-terminator * character before this number of bytes), they will be considered equal. * * \param str1 the first string to compare. NULL is not permitted! * \param str2 the second string to compare. NULL is not permitted! * \param maxlen the maximum number of _bytes_ to compare. * \returns less than zero if str1 is "less than" str2, greater than zero if * str1 is "greater than" str2, and zero if the strings match * exactly. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strncmp :: (str1: *u8, str2: *u8, maxlen: u64) -> s32 #foreign libsdl3; /** * Compare two null-terminated UTF-8 strings, case-insensitively. * * This will work with Unicode strings, using a technique called * "case-folding" to handle the vast majority of case-sensitive human * languages regardless of system locale. It can deal with expanding values: a * German Eszett character can compare against two ASCII 's' chars and be * considered a match, for example. A notable exception: it does not handle * the Turkish 'i' character; human language is complicated! * * Since this handles Unicode, it expects the string to be well-formed UTF-8 * and not a null-terminated string of arbitrary bytes. Bytes that are not * valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT * CHARACTER), which is to say two strings of random bits may turn out to * match if they convert to the same amount of replacement characters. * * \param str1 the first string to compare. NULL is not permitted! * \param str2 the second string to compare. NULL is not permitted! * \returns less than zero if str1 is "less than" str2, greater than zero if * str1 is "greater than" str2, and zero if the strings match * exactly. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strcasecmp :: (str1: *u8, str2: *u8) -> s32 #foreign libsdl3; /** * Compare two UTF-8 strings, case-insensitively, up to a number of bytes. * * This will work with Unicode strings, using a technique called * "case-folding" to handle the vast majority of case-sensitive human * languages regardless of system locale. It can deal with expanding values: a * German Eszett character can compare against two ASCII 's' chars and be * considered a match, for example. A notable exception: it does not handle * the Turkish 'i' character; human language is complicated! * * Since this handles Unicode, it expects the string to be well-formed UTF-8 * and not a null-terminated string of arbitrary bytes. Bytes that are not * valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT * CHARACTER), which is to say two strings of random bits may turn out to * match if they convert to the same amount of replacement characters. * * Note that while this function is intended to be used with UTF-8, `maxlen` * specifies a _byte_ limit! If the limit lands in the middle of a multi-byte * UTF-8 sequence, it may convert a portion of the final character to one or * more Unicode character U+FFFD (REPLACEMENT CHARACTER) so as not to overflow * a buffer. * * `maxlen` specifies a maximum number of bytes to compare; if the strings * match to this number of bytes (or both have matched to a null-terminator * character before this number of bytes), they will be considered equal. * * \param str1 the first string to compare. NULL is not permitted! * \param str2 the second string to compare. NULL is not permitted! * \param maxlen the maximum number of bytes to compare. * \returns less than zero if str1 is "less than" str2, greater than zero if * str1 is "greater than" str2, and zero if the strings match * exactly. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strncasecmp :: (str1: *u8, str2: *u8, maxlen: u64) -> s32 #foreign libsdl3; /** * Searches a string for the first occurence of any character contained in a * breakset, and returns a pointer from the string to that character. * * \param str The null-terminated string to be searched. Must not be NULL, and * must not overlap with `breakset`. * \param breakset A null-terminated string containing the list of characters * to look for. Must not be NULL, and must not overlap with * `str`. * \returns A pointer to the location, in str, of the first occurence of a * character present in the breakset, or NULL if none is found. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_strpbrk :: (str: *u8, breakset: *u8) -> *u8 #foreign libsdl3; /** * Decode a UTF-8 string, one Unicode codepoint at a time. * * This will return the first Unicode codepoint in the UTF-8 encoded string in * `*pstr`, and then advance `*pstr` past any consumed bytes before returning. * * It will not access more than `*pslen` bytes from the string. `*pslen` will * be adjusted, as well, subtracting the number of bytes consumed. * * `pslen` is allowed to be NULL, in which case the string _must_ be * NULL-terminated, as the function will blindly read until it sees the NULL * char. * * if `*pslen` is zero, it assumes the end of string is reached and returns a * zero codepoint regardless of the contents of the string buffer. * * If the resulting codepoint is zero (a NULL terminator), or `*pslen` is * zero, it will not advance `*pstr` or `*pslen` at all. * * Generally this function is called in a loop until it returns zero, * adjusting its parameters each iteration. * * If an invalid UTF-8 sequence is encountered, this function returns * SDL_INVALID_UNICODE_CODEPOINT and advances the string/length by one byte * (which is to say, a multibyte sequence might produce several * SDL_INVALID_UNICODE_CODEPOINT returns before it syncs to the next valid * UTF-8 sequence). * * Several things can generate invalid UTF-8 sequences, including overlong * encodings, the use of UTF-16 surrogate values, and truncated data. Please * refer to * [RFC3629](https://www.ietf.org/rfc/rfc3629.txt) * for details. * * \param pstr a pointer to a UTF-8 string pointer to be read and adjusted. * \param pslen a pointer to the number of bytes in the string, to be read and * adjusted. NULL is allowed. * \returns the first Unicode codepoint in the string. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_StepUTF8 :: (pstr: **u8, pslen: *u64) -> Uint32 #foreign libsdl3; /** * Decode a UTF-8 string in reverse, one Unicode codepoint at a time. * * This will go to the start of the previous Unicode codepoint in the string, * move `*pstr` to that location and return that codepoint. * * If `*pstr` is already at the start of the string), it will not advance * `*pstr` at all. * * Generally this function is called in a loop until it returns zero, * adjusting its parameter each iteration. * * If an invalid UTF-8 sequence is encountered, this function returns * SDL_INVALID_UNICODE_CODEPOINT. * * Several things can generate invalid UTF-8 sequences, including overlong * encodings, the use of UTF-16 surrogate values, and truncated data. Please * refer to * [RFC3629](https://www.ietf.org/rfc/rfc3629.txt) * for details. * * \param start a pointer to the beginning of the UTF-8 string. * \param pstr a pointer to a UTF-8 string pointer to be read and adjusted. * \returns the previous Unicode codepoint in the string. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_StepBackUTF8 :: (start: *u8, pstr: **u8) -> Uint32 #foreign libsdl3; /** * Convert a single Unicode codepoint to UTF-8. * * The buffer pointed to by `dst` must be at least 4 bytes long, as this * function may generate between 1 and 4 bytes of output. * * This function returns the first byte _after_ the newly-written UTF-8 * sequence, which is useful for encoding multiple codepoints in a loop, or * knowing where to write a NULL-terminator character to end the string (in * either case, plan to have a buffer of _more_ than 4 bytes!). * * If `codepoint` is an invalid value (outside the Unicode range, or a UTF-16 * surrogate value, etc), this will use U+FFFD (REPLACEMENT CHARACTER) for the * codepoint instead, and not set an error. * * If `dst` is NULL, this returns NULL immediately without writing to the * pointer and without setting an error. * * \param codepoint a Unicode codepoint to convert to UTF-8. * \param dst the location to write the encoded UTF-8. Must point to at least * 4 bytes! * \returns the first byte past the newly-written UTF-8 sequence. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_UCS4ToUTF8 :: (codepoint: Uint32, dst: *u8) -> *u8 #foreign libsdl3; /** * This works exactly like sscanf() but doesn't require access to a C runtime. * * Scan a string, matching a format string, converting each '%' item and * storing it to pointers provided through variable arguments. * * \param text the string to scan. Must not be NULL. * \param fmt a printf-style format string. Must not be NULL. * \param ... a list of pointers to values to be filled in with scanned items. * \returns the number of items that matched the format string. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_sscanf_CFormat :: (text: *u8, fmt: *u8, __args: ..Any) -> s32 #foreign libsdl3 "SDL_sscanf"; SDL_sscanf :: (text: *u8, fmt: string, __args: ..Any) -> s32 { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); return SDL_sscanf_CFormat(text, "%s", formatted_text.data); } @PrintLike /** * This works exactly like snprintf() but doesn't require access to a C * runtime. * * Format a string of up to `maxlen`-1 bytes, converting each '%' item with * values provided through variable arguments. * * While some C runtimes differ on how to deal with too-large strings, this * function null-terminates the output, by treating the null-terminator as * part of the `maxlen` count. Note that if `maxlen` is zero, however, no * bytes will be written at all. * * This function returns the number of _bytes_ (not _characters_) that should * be written, excluding the null-terminator character. If this returns a * number >= `maxlen`, it means the output string was truncated. A negative * return value means an error occurred. * * Referencing the output string's pointer with a format item is undefined * behavior. * * \param text the buffer to write the string into. Must not be NULL. * \param maxlen the maximum bytes to write, including the null-terminator. * \param fmt a printf-style format string. Must not be NULL. * \param ... a list of values to be used with the format string. * \returns the number of bytes that should be written, not counting the * null-terminator char, or a negative value on error. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_snprintf_CFormat :: (text: *u8, maxlen: u64, fmt: *u8, __args: ..Any) -> s32 #foreign libsdl3 "SDL_snprintf"; SDL_snprintf :: (text: *u8, maxlen: u64, fmt: string, __args: ..Any) -> s32 { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); return SDL_snprintf_CFormat(text, maxlen, "%s", formatted_text.data); } @PrintLike /** * This works exactly like swprintf() but doesn't require access to a C * runtime. * * Format a wide string of up to `maxlen`-1 wchar_t values, converting each * '%' item with values provided through variable arguments. * * While some C runtimes differ on how to deal with too-large strings, this * function null-terminates the output, by treating the null-terminator as * part of the `maxlen` count. Note that if `maxlen` is zero, however, no wide * characters will be written at all. * * This function returns the number of _wide characters_ (not _codepoints_) * that should be written, excluding the null-terminator character. If this * returns a number >= `maxlen`, it means the output string was truncated. A * negative return value means an error occurred. * * Referencing the output string's pointer with a format item is undefined * behavior. * * \param text the buffer to write the wide string into. Must not be NULL. * \param maxlen the maximum wchar_t values to write, including the * null-terminator. * \param fmt a printf-style format string. Must not be NULL. * \param ... a list of values to be used with the format string. * \returns the number of wide characters that should be written, not counting * the null-terminator char, or a negative value on error. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_swprintf :: (text: *s32, maxlen: u64, fmt: *s32, __args: ..Any) -> s32 #foreign libsdl3; /** * This works exactly like asprintf() but doesn't require access to a C * runtime. * * Functions identically to SDL_snprintf(), except it allocates a buffer large * enough to hold the output string on behalf of the caller. * * On success, this function returns the number of bytes (not characters) * comprising the output string, not counting the null-terminator character, * and sets `*strp` to the newly-allocated string. * * On error, this function returns a negative number, and the value of `*strp` * is undefined. * * The returned string is owned by the caller, and should be passed to * SDL_free when no longer needed. * * \param strp on output, is set to the new string. Must not be NULL. * \param fmt a printf-style format string. Must not be NULL. * \param ... a list of values to be used with the format string. * \returns the number of bytes in the newly-allocated string, not counting * the null-terminator char, or a negative value on error. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_asprintf_CFormat :: (strp: **u8, fmt: *u8, __args: ..Any) -> s32 #foreign libsdl3 "SDL_asprintf"; SDL_asprintf :: (strp: **u8, fmt: string, __args: ..Any) -> s32 { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); return SDL_asprintf_CFormat(strp, "%s", formatted_text.data); } @PrintLike /** * Seeds the pseudo-random number generator. * * Reusing the seed number will cause SDL_rand_*() to repeat the same stream * of 'random' numbers. * * \param seed the value to use as a random number seed, or 0 to use * SDL_GetPerformanceCounter(). * * \threadsafety This should be called on the same thread that calls * SDL_rand*() * * \since This function is available since SDL 3.2.0. * * \sa SDL_rand * \sa SDL_rand_bits * \sa SDL_randf */ SDL_srand :: (seed: Uint64) -> void #foreign libsdl3; /** * Generate a pseudo-random number less than n for positive n * * The method used is faster and of better quality than `rand() % n`. Odds are * roughly 99.9% even for n = 1 million. Evenness is better for smaller n, and * much worse as n gets bigger. * * Example: to simulate a d6 use `SDL_rand(6) + 1` The +1 converts 0..5 to * 1..6 * * If you want to generate a pseudo-random number in the full range of Sint32, * you should use: (Sint32)SDL_rand_bits() * * If you want reproducible output, be sure to initialize with SDL_srand() * first. * * There are no guarantees as to the quality of the random sequence produced, * and this should not be used for security (cryptography, passwords) or where * money is on the line (loot-boxes, casinos). There are many random number * libraries available with different characteristics and you should pick one * of those to meet any serious needs. * * \param n the number of possible outcomes. n must be positive. * \returns a random value in the range of [0 .. n-1]. * * \threadsafety All calls should be made from a single thread * * \since This function is available since SDL 3.2.0. * * \sa SDL_srand * \sa SDL_randf */ SDL_rand :: (n: Sint32) -> Sint32 #foreign libsdl3; /** * Generate a uniform pseudo-random floating point number less than 1.0 * * If you want reproducible output, be sure to initialize with SDL_srand() * first. * * There are no guarantees as to the quality of the random sequence produced, * and this should not be used for security (cryptography, passwords) or where * money is on the line (loot-boxes, casinos). There are many random number * libraries available with different characteristics and you should pick one * of those to meet any serious needs. * * \returns a random value in the range of [0.0, 1.0). * * \threadsafety All calls should be made from a single thread * * \since This function is available since SDL 3.2.0. * * \sa SDL_srand * \sa SDL_rand */ SDL_randf :: () -> float #foreign libsdl3; /** * Generate 32 pseudo-random bits. * * You likely want to use SDL_rand() to get a psuedo-random number instead. * * There are no guarantees as to the quality of the random sequence produced, * and this should not be used for security (cryptography, passwords) or where * money is on the line (loot-boxes, casinos). There are many random number * libraries available with different characteristics and you should pick one * of those to meet any serious needs. * * \returns a random value in the range of [0-SDL_MAX_UINT32]. * * \threadsafety All calls should be made from a single thread * * \since This function is available since SDL 3.2.0. * * \sa SDL_rand * \sa SDL_randf * \sa SDL_srand */ SDL_rand_bits :: () -> Uint32 #foreign libsdl3; /** * Generate a pseudo-random number less than n for positive n * * The method used is faster and of better quality than `rand() % n`. Odds are * roughly 99.9% even for n = 1 million. Evenness is better for smaller n, and * much worse as n gets bigger. * * Example: to simulate a d6 use `SDL_rand_r(state, 6) + 1` The +1 converts * 0..5 to 1..6 * * If you want to generate a pseudo-random number in the full range of Sint32, * you should use: (Sint32)SDL_rand_bits_r(state) * * There are no guarantees as to the quality of the random sequence produced, * and this should not be used for security (cryptography, passwords) or where * money is on the line (loot-boxes, casinos). There are many random number * libraries available with different characteristics and you should pick one * of those to meet any serious needs. * * \param state a pointer to the current random number state, this may not be * NULL. * \param n the number of possible outcomes. n must be positive. * \returns a random value in the range of [0 .. n-1]. * * \threadsafety This function is thread-safe, as long as the state pointer * isn't shared between threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_rand * \sa SDL_rand_bits_r * \sa SDL_randf_r */ SDL_rand_r :: (state: *Uint64, n: Sint32) -> Sint32 #foreign libsdl3; /** * Generate a uniform pseudo-random floating point number less than 1.0 * * If you want reproducible output, be sure to initialize with SDL_srand() * first. * * There are no guarantees as to the quality of the random sequence produced, * and this should not be used for security (cryptography, passwords) or where * money is on the line (loot-boxes, casinos). There are many random number * libraries available with different characteristics and you should pick one * of those to meet any serious needs. * * \param state a pointer to the current random number state, this may not be * NULL. * \returns a random value in the range of [0.0, 1.0). * * \threadsafety This function is thread-safe, as long as the state pointer * isn't shared between threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_rand_bits_r * \sa SDL_rand_r * \sa SDL_randf */ SDL_randf_r :: (state: *Uint64) -> float #foreign libsdl3; /** * Generate 32 pseudo-random bits. * * You likely want to use SDL_rand_r() to get a psuedo-random number instead. * * There are no guarantees as to the quality of the random sequence produced, * and this should not be used for security (cryptography, passwords) or where * money is on the line (loot-boxes, casinos). There are many random number * libraries available with different characteristics and you should pick one * of those to meet any serious needs. * * \param state a pointer to the current random number state, this may not be * NULL. * \returns a random value in the range of [0-SDL_MAX_UINT32]. * * \threadsafety This function is thread-safe, as long as the state pointer * isn't shared between threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_rand_r * \sa SDL_randf_r */ SDL_rand_bits_r :: (state: *Uint64) -> Uint32 #foreign libsdl3; /** * Compute the arc cosine of `x`. * * The definition of `y = acos(x)` is `x = cos(y)`. * * Domain: `-1 <= x <= 1` * * Range: `0 <= y <= Pi` * * This function operates on double-precision floating point values, use * SDL_acosf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. * \returns arc cosine of `x`, in radians. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_acosf * \sa SDL_asin * \sa SDL_cos */ SDL_acos :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the arc cosine of `x`. * * The definition of `y = acos(x)` is `x = cos(y)`. * * Domain: `-1 <= x <= 1` * * Range: `0 <= y <= Pi` * * This function operates on single-precision floating point values, use * SDL_acos for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. * \returns arc cosine of `x`, in radians. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_acos * \sa SDL_asinf * \sa SDL_cosf */ SDL_acosf :: (x: float) -> float #foreign libsdl3; /** * Compute the arc sine of `x`. * * The definition of `y = asin(x)` is `x = sin(y)`. * * Domain: `-1 <= x <= 1` * * Range: `-Pi/2 <= y <= Pi/2` * * This function operates on double-precision floating point values, use * SDL_asinf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. * \returns arc sine of `x`, in radians. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_asinf * \sa SDL_acos * \sa SDL_sin */ SDL_asin :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the arc sine of `x`. * * The definition of `y = asin(x)` is `x = sin(y)`. * * Domain: `-1 <= x <= 1` * * Range: `-Pi/2 <= y <= Pi/2` * * This function operates on single-precision floating point values, use * SDL_asin for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. * \returns arc sine of `x`, in radians. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_asin * \sa SDL_acosf * \sa SDL_sinf */ SDL_asinf :: (x: float) -> float #foreign libsdl3; /** * Compute the arc tangent of `x`. * * The definition of `y = atan(x)` is `x = tan(y)`. * * Domain: `-INF <= x <= INF` * * Range: `-Pi/2 <= y <= Pi/2` * * This function operates on double-precision floating point values, use * SDL_atanf for single-precision floats. * * To calculate the arc tangent of y / x, use SDL_atan2. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. * \returns arc tangent of of `x` in radians, or 0 if `x = 0`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atanf * \sa SDL_atan2 * \sa SDL_tan */ SDL_atan :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the arc tangent of `x`. * * The definition of `y = atan(x)` is `x = tan(y)`. * * Domain: `-INF <= x <= INF` * * Range: `-Pi/2 <= y <= Pi/2` * * This function operates on single-precision floating point values, use * SDL_atan for dboule-precision floats. * * To calculate the arc tangent of y / x, use SDL_atan2f. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. * \returns arc tangent of of `x` in radians, or 0 if `x = 0`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atan * \sa SDL_atan2f * \sa SDL_tanf */ SDL_atanf :: (x: float) -> float #foreign libsdl3; /** * Compute the arc tangent of `y / x`, using the signs of x and y to adjust * the result's quadrant. * * The definition of `z = atan2(x, y)` is `y = x tan(z)`, where the quadrant * of z is determined based on the signs of x and y. * * Domain: `-INF <= x <= INF`, `-INF <= y <= INF` * * Range: `-Pi/2 <= y <= Pi/2` * * This function operates on double-precision floating point values, use * SDL_atan2f for single-precision floats. * * To calculate the arc tangent of a single value, use SDL_atan. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param y floating point value of the numerator (y coordinate). * \param x floating point value of the denominator (x coordinate). * \returns arc tangent of of `y / x` in radians, or, if `x = 0`, either * `-Pi/2`, `0`, or `Pi/2`, depending on the value of `y`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atan2f * \sa SDL_atan * \sa SDL_tan */ SDL_atan2 :: (y: float64, x: float64) -> float64 #foreign libsdl3; /** * Compute the arc tangent of `y / x`, using the signs of x and y to adjust * the result's quadrant. * * The definition of `z = atan2(x, y)` is `y = x tan(z)`, where the quadrant * of z is determined based on the signs of x and y. * * Domain: `-INF <= x <= INF`, `-INF <= y <= INF` * * Range: `-Pi/2 <= y <= Pi/2` * * This function operates on single-precision floating point values, use * SDL_atan2 for double-precision floats. * * To calculate the arc tangent of a single value, use SDL_atanf. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param y floating point value of the numerator (y coordinate). * \param x floating point value of the denominator (x coordinate). * \returns arc tangent of of `y / x` in radians, or, if `x = 0`, either * `-Pi/2`, `0`, or `Pi/2`, depending on the value of `y`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_atan2f * \sa SDL_atan * \sa SDL_tan */ SDL_atan2f :: (y: float, x: float) -> float #foreign libsdl3; /** * Compute the ceiling of `x`. * * The ceiling of `x` is the smallest integer `y` such that `y > x`, i.e `x` * rounded up to the nearest integer. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF`, y integer * * This function operates on double-precision floating point values, use * SDL_ceilf for single-precision floats. * * \param x floating point value. * \returns the ceiling of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ceilf * \sa SDL_floor * \sa SDL_trunc * \sa SDL_round * \sa SDL_lround */ SDL_ceil :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the ceiling of `x`. * * The ceiling of `x` is the smallest integer `y` such that `y > x`, i.e `x` * rounded up to the nearest integer. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF`, y integer * * This function operates on single-precision floating point values, use * SDL_ceil for double-precision floats. * * \param x floating point value. * \returns the ceiling of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ceil * \sa SDL_floorf * \sa SDL_truncf * \sa SDL_roundf * \sa SDL_lroundf */ SDL_ceilf :: (x: float) -> float #foreign libsdl3; /** * Copy the sign of one floating-point value to another. * * The definition of copysign is that ``copysign(x, y) = abs(x) * sign(y)``. * * Domain: `-INF <= x <= INF`, ``-INF <= y <= f`` * * Range: `-INF <= z <= INF` * * This function operates on double-precision floating point values, use * SDL_copysignf for single-precision floats. * * \param x floating point value to use as the magnitude. * \param y floating point value to use as the sign. * \returns the floating point value with the sign of y and the magnitude of * x. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_copysignf * \sa SDL_fabs */ SDL_copysign :: (x: float64, y: float64) -> float64 #foreign libsdl3; /** * Copy the sign of one floating-point value to another. * * The definition of copysign is that ``copysign(x, y) = abs(x) * sign(y)``. * * Domain: `-INF <= x <= INF`, ``-INF <= y <= f`` * * Range: `-INF <= z <= INF` * * This function operates on single-precision floating point values, use * SDL_copysign for double-precision floats. * * \param x floating point value to use as the magnitude. * \param y floating point value to use as the sign. * \returns the floating point value with the sign of y and the magnitude of * x. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_copysignf * \sa SDL_fabsf */ SDL_copysignf :: (x: float, y: float) -> float #foreign libsdl3; /** * Compute the cosine of `x`. * * Domain: `-INF <= x <= INF` * * Range: `-1 <= y <= 1` * * This function operates on double-precision floating point values, use * SDL_cosf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value, in radians. * \returns cosine of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_cosf * \sa SDL_acos * \sa SDL_sin */ SDL_cos :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the cosine of `x`. * * Domain: `-INF <= x <= INF` * * Range: `-1 <= y <= 1` * * This function operates on single-precision floating point values, use * SDL_cos for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value, in radians. * \returns cosine of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_cos * \sa SDL_acosf * \sa SDL_sinf */ SDL_cosf :: (x: float) -> float #foreign libsdl3; /** * Compute the exponential of `x`. * * The definition of `y = exp(x)` is `y = e^x`, where `e` is the base of the * natural logarithm. The inverse is the natural logarithm, SDL_log. * * Domain: `-INF <= x <= INF` * * Range: `0 <= y <= INF` * * The output will overflow if `exp(x)` is too large to be represented. * * This function operates on double-precision floating point values, use * SDL_expf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. * \returns value of `e^x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_expf * \sa SDL_log */ SDL_exp :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the exponential of `x`. * * The definition of `y = exp(x)` is `y = e^x`, where `e` is the base of the * natural logarithm. The inverse is the natural logarithm, SDL_logf. * * Domain: `-INF <= x <= INF` * * Range: `0 <= y <= INF` * * The output will overflow if `exp(x)` is too large to be represented. * * This function operates on single-precision floating point values, use * SDL_exp for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. * \returns value of `e^x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_exp * \sa SDL_logf */ SDL_expf :: (x: float) -> float #foreign libsdl3; /** * Compute the absolute value of `x` * * Domain: `-INF <= x <= INF` * * Range: `0 <= y <= INF` * * This function operates on double-precision floating point values, use * SDL_copysignf for single-precision floats. * * \param x floating point value to use as the magnitude. * \returns the absolute value of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_fabsf */ SDL_fabs :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the absolute value of `x` * * Domain: `-INF <= x <= INF` * * Range: `0 <= y <= INF` * * This function operates on single-precision floating point values, use * SDL_copysignf for double-precision floats. * * \param x floating point value to use as the magnitude. * \returns the absolute value of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_fabs */ SDL_fabsf :: (x: float) -> float #foreign libsdl3; /** * Compute the floor of `x`. * * The floor of `x` is the largest integer `y` such that `y > x`, i.e `x` * rounded down to the nearest integer. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF`, y integer * * This function operates on double-precision floating point values, use * SDL_floorf for single-precision floats. * * \param x floating point value. * \returns the floor of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_floorf * \sa SDL_ceil * \sa SDL_trunc * \sa SDL_round * \sa SDL_lround */ SDL_floor :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the floor of `x`. * * The floor of `x` is the largest integer `y` such that `y > x`, i.e `x` * rounded down to the nearest integer. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF`, y integer * * This function operates on single-precision floating point values, use * SDL_floorf for double-precision floats. * * \param x floating point value. * \returns the floor of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_floor * \sa SDL_ceilf * \sa SDL_truncf * \sa SDL_roundf * \sa SDL_lroundf */ SDL_floorf :: (x: float) -> float #foreign libsdl3; /** * Truncate `x` to an integer. * * Rounds `x` to the next closest integer to 0. This is equivalent to removing * the fractional part of `x`, leaving only the integer part. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF`, y integer * * This function operates on double-precision floating point values, use * SDL_truncf for single-precision floats. * * \param x floating point value. * \returns `x` truncated to an integer. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_truncf * \sa SDL_fmod * \sa SDL_ceil * \sa SDL_floor * \sa SDL_round * \sa SDL_lround */ SDL_trunc :: (x: float64) -> float64 #foreign libsdl3; /** * Truncate `x` to an integer. * * Rounds `x` to the next closest integer to 0. This is equivalent to removing * the fractional part of `x`, leaving only the integer part. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF`, y integer * * This function operates on single-precision floating point values, use * SDL_truncf for double-precision floats. * * \param x floating point value. * \returns `x` truncated to an integer. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_trunc * \sa SDL_fmodf * \sa SDL_ceilf * \sa SDL_floorf * \sa SDL_roundf * \sa SDL_lroundf */ SDL_truncf :: (x: float) -> float #foreign libsdl3; /** * Return the floating-point remainder of `x / y` * * Divides `x` by `y`, and returns the remainder. * * Domain: `-INF <= x <= INF`, `-INF <= y <= INF`, `y != 0` * * Range: `-y <= z <= y` * * This function operates on double-precision floating point values, use * SDL_fmodf for single-precision floats. * * \param x the numerator. * \param y the denominator. Must not be 0. * \returns the remainder of `x / y`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_fmodf * \sa SDL_modf * \sa SDL_trunc * \sa SDL_ceil * \sa SDL_floor * \sa SDL_round * \sa SDL_lround */ SDL_fmod :: (x: float64, y: float64) -> float64 #foreign libsdl3; /** * Return the floating-point remainder of `x / y` * * Divides `x` by `y`, and returns the remainder. * * Domain: `-INF <= x <= INF`, `-INF <= y <= INF`, `y != 0` * * Range: `-y <= z <= y` * * This function operates on single-precision floating point values, use * SDL_fmod for single-precision floats. * * \param x the numerator. * \param y the denominator. Must not be 0. * \returns the remainder of `x / y`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_fmod * \sa SDL_truncf * \sa SDL_modff * \sa SDL_ceilf * \sa SDL_floorf * \sa SDL_roundf * \sa SDL_lroundf */ SDL_fmodf :: (x: float, y: float) -> float #foreign libsdl3; /** * Return whether the value is infinity. * * \param x double-precision floating point value. * \returns non-zero if the value is infinity, 0 otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_isinff */ SDL_isinf :: (x: float64) -> s32 #foreign libsdl3; /** * Return whether the value is infinity. * * \param x floating point value. * \returns non-zero if the value is infinity, 0 otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_isinf */ SDL_isinff :: (x: float) -> s32 #foreign libsdl3; /** * Return whether the value is NaN. * * \param x double-precision floating point value. * \returns non-zero if the value is NaN, 0 otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_isnanf */ SDL_isnan :: (x: float64) -> s32 #foreign libsdl3; /** * Return whether the value is NaN. * * \param x floating point value. * \returns non-zero if the value is NaN, 0 otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_isnan */ SDL_isnanf :: (x: float) -> s32 #foreign libsdl3; /** * Compute the natural logarithm of `x`. * * Domain: `0 < x <= INF` * * Range: `-INF <= y <= INF` * * It is an error for `x` to be less than or equal to 0. * * This function operates on double-precision floating point values, use * SDL_logf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. Must be greater than 0. * \returns the natural logarithm of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_logf * \sa SDL_log10 * \sa SDL_exp */ SDL_log :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the natural logarithm of `x`. * * Domain: `0 < x <= INF` * * Range: `-INF <= y <= INF` * * It is an error for `x` to be less than or equal to 0. * * This function operates on single-precision floating point values, use * SDL_log for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. Must be greater than 0. * \returns the natural logarithm of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_log * \sa SDL_expf */ SDL_logf :: (x: float) -> float #foreign libsdl3; /** * Compute the base-10 logarithm of `x`. * * Domain: `0 < x <= INF` * * Range: `-INF <= y <= INF` * * It is an error for `x` to be less than or equal to 0. * * This function operates on double-precision floating point values, use * SDL_log10f for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. Must be greater than 0. * \returns the logarithm of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_log10f * \sa SDL_log * \sa SDL_pow */ SDL_log10 :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the base-10 logarithm of `x`. * * Domain: `0 < x <= INF` * * Range: `-INF <= y <= INF` * * It is an error for `x` to be less than or equal to 0. * * This function operates on single-precision floating point values, use * SDL_log10 for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. Must be greater than 0. * \returns the logarithm of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_log10 * \sa SDL_logf * \sa SDL_powf */ SDL_log10f :: (x: float) -> float #foreign libsdl3; /** * Split `x` into integer and fractional parts * * This function operates on double-precision floating point values, use * SDL_modff for single-precision floats. * * \param x floating point value. * \param y output pointer to store the integer part of `x`. * \returns the fractional part of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_modff * \sa SDL_trunc * \sa SDL_fmod */ SDL_modf :: (x: float64, y: *float64) -> float64 #foreign libsdl3; /** * Split `x` into integer and fractional parts * * This function operates on single-precision floating point values, use * SDL_modf for double-precision floats. * * \param x floating point value. * \param y output pointer to store the integer part of `x`. * \returns the fractional part of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_modf * \sa SDL_truncf * \sa SDL_fmodf */ SDL_modff :: (x: float, y: *float) -> float #foreign libsdl3; /** * Raise `x` to the power `y` * * Domain: `-INF <= x <= INF`, `-INF <= y <= INF` * * Range: `-INF <= z <= INF` * * If `y` is the base of the natural logarithm (e), consider using SDL_exp * instead. * * This function operates on double-precision floating point values, use * SDL_powf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x the base. * \param y the exponent. * \returns `x` raised to the power `y`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_powf * \sa SDL_exp * \sa SDL_log */ SDL_pow :: (x: float64, y: float64) -> float64 #foreign libsdl3; /** * Raise `x` to the power `y` * * Domain: `-INF <= x <= INF`, `-INF <= y <= INF` * * Range: `-INF <= z <= INF` * * If `y` is the base of the natural logarithm (e), consider using SDL_exp * instead. * * This function operates on single-precision floating point values, use * SDL_powf for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x the base. * \param y the exponent. * \returns `x` raised to the power `y`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_pow * \sa SDL_expf * \sa SDL_logf */ SDL_powf :: (x: float, y: float) -> float #foreign libsdl3; /** * Round `x` to the nearest integer. * * Rounds `x` to the nearest integer. Values halfway between integers will be * rounded away from zero. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF`, y integer * * This function operates on double-precision floating point values, use * SDL_roundf for single-precision floats. To get the result as an integer * type, use SDL_lround. * * \param x floating point value. * \returns the nearest integer to `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_roundf * \sa SDL_lround * \sa SDL_floor * \sa SDL_ceil * \sa SDL_trunc */ SDL_round :: (x: float64) -> float64 #foreign libsdl3; /** * Round `x` to the nearest integer. * * Rounds `x` to the nearest integer. Values halfway between integers will be * rounded away from zero. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF`, y integer * * This function operates on double-precision floating point values, use * SDL_roundf for single-precision floats. To get the result as an integer * type, use SDL_lroundf. * * \param x floating point value. * \returns the nearest integer to `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_round * \sa SDL_lroundf * \sa SDL_floorf * \sa SDL_ceilf * \sa SDL_truncf */ SDL_roundf :: (x: float) -> float #foreign libsdl3; /** * Round `x` to the nearest integer representable as a long * * Rounds `x` to the nearest integer. Values halfway between integers will be * rounded away from zero. * * Domain: `-INF <= x <= INF` * * Range: `MIN_LONG <= y <= MAX_LONG` * * This function operates on double-precision floating point values, use * SDL_lround for single-precision floats. To get the result as a * floating-point type, use SDL_round. * * \param x floating point value. * \returns the nearest integer to `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_lroundf * \sa SDL_round * \sa SDL_floor * \sa SDL_ceil * \sa SDL_trunc */ SDL_lround :: (x: float64) -> s64 #foreign libsdl3; /** * Round `x` to the nearest integer representable as a long * * Rounds `x` to the nearest integer. Values halfway between integers will be * rounded away from zero. * * Domain: `-INF <= x <= INF` * * Range: `MIN_LONG <= y <= MAX_LONG` * * This function operates on single-precision floating point values, use * SDL_lroundf for double-precision floats. To get the result as a * floating-point type, use SDL_roundf, * * \param x floating point value. * \returns the nearest integer to `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_lround * \sa SDL_roundf * \sa SDL_floorf * \sa SDL_ceilf * \sa SDL_truncf */ SDL_lroundf :: (x: float) -> s64 #foreign libsdl3; /** * Scale `x` by an integer power of two. * * Multiplies `x` by the `n`th power of the floating point radix (always 2). * * Domain: `-INF <= x <= INF`, `n` integer * * Range: `-INF <= y <= INF` * * This function operates on double-precision floating point values, use * SDL_scalbnf for single-precision floats. * * \param x floating point value to be scaled. * \param n integer exponent. * \returns `x * 2^n`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_scalbnf * \sa SDL_pow */ SDL_scalbn :: (x: float64, n: s32) -> float64 #foreign libsdl3; /** * Scale `x` by an integer power of two. * * Multiplies `x` by the `n`th power of the floating point radix (always 2). * * Domain: `-INF <= x <= INF`, `n` integer * * Range: `-INF <= y <= INF` * * This function operates on single-precision floating point values, use * SDL_scalbn for double-precision floats. * * \param x floating point value to be scaled. * \param n integer exponent. * \returns `x * 2^n`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_scalbn * \sa SDL_powf */ SDL_scalbnf :: (x: float, n: s32) -> float #foreign libsdl3; /** * Compute the sine of `x`. * * Domain: `-INF <= x <= INF` * * Range: `-1 <= y <= 1` * * This function operates on double-precision floating point values, use * SDL_sinf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value, in radians. * \returns sine of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_sinf * \sa SDL_asin * \sa SDL_cos */ SDL_sin :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the sine of `x`. * * Domain: `-INF <= x <= INF` * * Range: `-1 <= y <= 1` * * This function operates on single-precision floating point values, use * SDL_sin for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value, in radians. * \returns sine of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_sin * \sa SDL_asinf * \sa SDL_cosf */ SDL_sinf :: (x: float) -> float #foreign libsdl3; /** * Compute the square root of `x`. * * Domain: `0 <= x <= INF` * * Range: `0 <= y <= INF` * * This function operates on double-precision floating point values, use * SDL_sqrtf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. Must be greater than or equal to 0. * \returns square root of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_sqrtf */ SDL_sqrt :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the square root of `x`. * * Domain: `0 <= x <= INF` * * Range: `0 <= y <= INF` * * This function operates on single-precision floating point values, use * SDL_sqrt for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value. Must be greater than or equal to 0. * \returns square root of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_sqrt */ SDL_sqrtf :: (x: float) -> float #foreign libsdl3; /** * Compute the tangent of `x`. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF` * * This function operates on double-precision floating point values, use * SDL_tanf for single-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value, in radians. * \returns tangent of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_tanf * \sa SDL_sin * \sa SDL_cos * \sa SDL_atan * \sa SDL_atan2 */ SDL_tan :: (x: float64) -> float64 #foreign libsdl3; /** * Compute the tangent of `x`. * * Domain: `-INF <= x <= INF` * * Range: `-INF <= y <= INF` * * This function operates on single-precision floating point values, use * SDL_tanf for double-precision floats. * * This function may use a different approximation across different versions, * platforms and configurations. i.e, it can return a different value given * the same input on different machines or operating systems, or if SDL is * updated. * * \param x floating point value, in radians. * \returns tangent of `x`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_tan * \sa SDL_sinf * \sa SDL_cosf * \sa SDL_atanf * \sa SDL_atan2f */ SDL_tanf :: (x: float) -> float #foreign libsdl3; SDL_iconv_data_t :: struct {} /** * An opaque handle representing string encoding conversion state. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_iconv_open */ SDL_iconv_t :: *SDL_iconv_data_t; /** * This function allocates a context for the specified character set * conversion. * * \param tocode The target character encoding, must not be NULL. * \param fromcode The source character encoding, must not be NULL. * \returns a handle that must be freed with SDL_iconv_close, or * SDL_ICONV_ERROR on failure. * * \since This function is available since SDL 3.2.0. * * \sa SDL_iconv * \sa SDL_iconv_close * \sa SDL_iconv_string */ SDL_iconv_open :: (tocode: *u8, fromcode: *u8) -> SDL_iconv_t #foreign libsdl3; /** * This function frees a context used for character set conversion. * * \param cd The character set conversion handle. * \returns 0 on success, or -1 on failure. * * \since This function is available since SDL 3.2.0. * * \sa SDL_iconv * \sa SDL_iconv_open * \sa SDL_iconv_string */ SDL_iconv_close :: (cd: SDL_iconv_t) -> s32 #foreign libsdl3; /** * This function converts text between encodings, reading from and writing to * a buffer. * * It returns the number of succesful conversions on success. On error, * SDL_ICONV_E2BIG is returned when the output buffer is too small, or * SDL_ICONV_EILSEQ is returned when an invalid input sequence is encountered, * or SDL_ICONV_EINVAL is returned when an incomplete input sequence is * encountered. * * On exit: * * - inbuf will point to the beginning of the next multibyte sequence. On * error, this is the location of the problematic input sequence. On * success, this is the end of the input sequence. * - inbytesleft will be set to the number of bytes left to convert, which * will be 0 on success. * - outbuf will point to the location where to store the next output byte. * - outbytesleft will be set to the number of bytes left in the output * buffer. * * \param cd The character set conversion context, created in * SDL_iconv_open(). * \param inbuf Address of variable that points to the first character of the * input sequence. * \param inbytesleft The number of bytes in the input buffer. * \param outbuf Address of variable that points to the output buffer. * \param outbytesleft The number of bytes in the output buffer. * \returns the number of conversions on success, or a negative error code. * * \since This function is available since SDL 3.2.0. * * \sa SDL_iconv_open * \sa SDL_iconv_close * \sa SDL_iconv_string */ SDL_iconv :: (cd: SDL_iconv_t, inbuf: **u8, inbytesleft: *u64, outbuf: **u8, outbytesleft: *u64) -> u64 #foreign libsdl3; /** * Helper function to convert a string's encoding in one call. * * This function converts a buffer or string between encodings in one pass. * * The string does not need to be NULL-terminated; this function operates on * the number of bytes specified in `inbytesleft` whether there is a NULL * character anywhere in the buffer. * * The returned string is owned by the caller, and should be passed to * SDL_free when no longer needed. * * \param tocode the character encoding of the output string. Examples are * "UTF-8", "UCS-4", etc. * \param fromcode the character encoding of data in `inbuf`. * \param inbuf the string to convert to a different encoding. * \param inbytesleft the size of the input string _in bytes_. * \returns a new string, converted to the new encoding, or NULL on error. * * \since This function is available since SDL 3.2.0. * * \sa SDL_iconv_open * \sa SDL_iconv_close * \sa SDL_iconv */ SDL_iconv_string :: (tocode: *u8, fromcode: *u8, inbuf: *u8, inbytesleft: u64) -> *u8 #foreign libsdl3; SDL_FunctionPointer :: #type () -> void #c_call; /** * Possible outcomes from a triggered assertion. * * When an enabled assertion triggers, it may call the assertion handler * (possibly one provided by the app via SDL_SetAssertionHandler), which will * return one of these values, possibly after asking the user. * * Then SDL will respond based on this outcome (loop around to retry the * condition, try to break in a debugger, kill the program, or ignore the * problem). * * \since This enum is available since SDL 3.2.0. */ using SDL_AssertState :: enum u32 { SDL_ASSERTION_RETRY :: 0; SDL_ASSERTION_BREAK :: 1; SDL_ASSERTION_ABORT :: 2; SDL_ASSERTION_IGNORE :: 3; SDL_ASSERTION_ALWAYS_IGNORE :: 4; } /** * Information about an assertion failure. * * This structure is filled in with information about a triggered assertion, * used by the assertion handler, then added to the assertion report. This is * returned as a linked list from SDL_GetAssertionReport(). * * \since This struct is available since SDL 3.2.0. */ SDL_AssertData :: struct { always_ignore: bool; /**< true if app should always continue when assertion is triggered. */ trigger_count: u32; /**< Number of times this assertion has been triggered. */ condition: *u8; /**< A string of this assert's test code. */ filename: *u8; /**< The source file where this assert lives. */ linenum: s32; /**< The line in `filename` where this assert lives. */ function: *u8; /**< The name of the function where this assert lives. */ next: *SDL_AssertData; /**< next item in the linked list. */ } /** * Never call this directly. * * Use the SDL_assert macros instead. * * \param data assert data structure. * \param func function name. * \param file file name. * \param line line number. * \returns assert state. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_ReportAssertion :: (data: *SDL_AssertData, func: *u8, file: *u8, line: s32) -> SDL_AssertState #foreign libsdl3; /** * A callback that fires when an SDL assertion fails. * * \param data a pointer to the SDL_AssertData structure corresponding to the * current assertion. * \param userdata what was passed as `userdata` to SDL_SetAssertionHandler(). * \returns an SDL_AssertState value indicating how to handle the failure. * * \threadsafety This callback may be called from any thread that triggers an * assert at any time. * * \since This datatype is available since SDL 3.2.0. */ SDL_AssertionHandler :: #type (data: *SDL_AssertData, userdata: *void) -> SDL_AssertState #c_call; /** * Set an application-defined assertion handler. * * This function allows an application to show its own assertion UI and/or * force the response to an assertion failure. If the application doesn't * provide this, SDL will try to do the right thing, popping up a * system-specific GUI dialog, and probably minimizing any fullscreen windows. * * This callback may fire from any thread, but it runs wrapped in a mutex, so * it will only fire from one thread at a time. * * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * * \param handler the SDL_AssertionHandler function to call when an assertion * fails or NULL for the default handler. * \param userdata a pointer that is passed to `handler`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAssertionHandler */ SDL_SetAssertionHandler :: (handler: SDL_AssertionHandler, userdata: *void) -> void #foreign libsdl3; /** * Get the default assertion handler. * * This returns the function pointer that is called by default when an * assertion is triggered. This is an internal function provided by SDL, that * is used for assertions when SDL_SetAssertionHandler() hasn't been used to * provide a different function. * * \returns the default SDL_AssertionHandler that is called when an assert * triggers. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAssertionHandler */ SDL_GetDefaultAssertionHandler :: () -> SDL_AssertionHandler #foreign libsdl3; /** * Get the current assertion handler. * * This returns the function pointer that is called when an assertion is * triggered. This is either the value last passed to * SDL_SetAssertionHandler(), or if no application-specified function is set, * is equivalent to calling SDL_GetDefaultAssertionHandler(). * * The parameter `puserdata` is a pointer to a void*, which will store the * "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value * will always be NULL for the default handler. If you don't care about this * data, it is safe to pass a NULL pointer to this function to ignore it. * * \param puserdata pointer which is filled with the "userdata" pointer that * was passed to SDL_SetAssertionHandler(). * \returns the SDL_AssertionHandler that is called when an assert triggers. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAssertionHandler */ SDL_GetAssertionHandler :: (puserdata: **void) -> SDL_AssertionHandler #foreign libsdl3; /** * Get a list of all assertion failures. * * This function gets all assertions triggered since the last call to * SDL_ResetAssertionReport(), or the start of the program. * * The proper way to examine this data looks something like this: * * ```c * const SDL_AssertData *item = SDL_GetAssertionReport(); * while (item) { * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", * item->condition, item->function, item->filename, * item->linenum, item->trigger_count, * item->always_ignore ? "yes" : "no"); * item = item->next; * } * ``` * * \returns a list of all failed assertions or NULL if the list is empty. This * memory should not be modified or freed by the application. This * pointer remains valid until the next call to SDL_Quit() or * SDL_ResetAssertionReport(). * * \threadsafety This function is not thread safe. Other threads calling * SDL_ResetAssertionReport() simultaneously, may render the * returned pointer invalid. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ResetAssertionReport */ SDL_GetAssertionReport :: () -> *SDL_AssertData #foreign libsdl3; /** * Clear the list of all assertion failures. * * This function will clear the list of all assertions triggered up to that * point. Immediately following this call, SDL_GetAssertionReport will return * no items. In addition, any previously-triggered assertions will be reset to * a trigger_count of zero, and their always_ignore state will be false. * * \threadsafety This function is not thread safe. Other threads triggering an * assertion, or simultaneously calling this function may cause * memory leaks or crashes. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAssertionReport */ SDL_ResetAssertionReport :: () -> void #foreign libsdl3; SDL_AsyncIO :: struct {} /** * Types of asynchronous I/O tasks. * * \since This enum is available since SDL 3.2.0. */ using SDL_AsyncIOTaskType :: enum u32 { SDL_ASYNCIO_TASK_READ :: 0; SDL_ASYNCIO_TASK_WRITE :: 1; SDL_ASYNCIO_TASK_CLOSE :: 2; } /** * Possible outcomes of an asynchronous I/O task. * * \since This enum is available since SDL 3.2.0. */ using SDL_AsyncIOResult :: enum u32 { SDL_ASYNCIO_COMPLETE :: 0; SDL_ASYNCIO_FAILURE :: 1; SDL_ASYNCIO_CANCELED :: 2; } /** * Information about a completed asynchronous I/O request. * * \since This struct is available since SDL 3.2.0. */ SDL_AsyncIOOutcome :: struct { asyncio: *SDL_AsyncIO; /**< what generated this task. This pointer will be invalid if it was closed! */ type: SDL_AsyncIOTaskType; /**< What sort of task was this? Read, write, etc? */ result: SDL_AsyncIOResult; /**< the result of the work (success, failure, cancellation). */ buffer: *void; /**< buffer where data was read/written. */ offset: Uint64; /**< offset in the SDL_AsyncIO where data was read/written. */ bytes_requested: Uint64; /**< number of bytes the task was to read/write. */ bytes_transferred: Uint64; /**< actual number of bytes that were read/written. */ userdata: *void; /**< pointer provided by the app when starting the task */ } SDL_AsyncIOQueue :: struct {} /** * Use this function to create a new SDL_AsyncIO object for reading from * and/or writing to a named file. * * The `mode` string understands the following values: * * - "r": Open a file for reading only. It must exist. * - "w": Open a file for writing only. It will create missing files or * truncate existing ones. * - "r+": Open a file for update both reading and writing. The file must * exist. * - "w+": Create an empty file for both reading and writing. If a file with * the same name already exists its content is erased and the file is * treated as a new empty file. * * There is no "b" mode, as there is only "binary" style I/O, and no "a" mode * for appending, since you specify the position when starting a task. * * This function supports Unicode filenames, but they must be encoded in UTF-8 * format, regardless of the underlying operating system. * * This call is _not_ asynchronous; it will open the file before returning, * under the assumption that doing so is generally a fast operation. Future * reads and writes to the opened file will be async, however. * * \param file a UTF-8 string representing the filename to open. * \param mode an ASCII string representing the mode to be used for opening * the file. * \returns a pointer to the SDL_AsyncIO structure that is created or NULL on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseAsyncIO * \sa SDL_ReadAsyncIO * \sa SDL_WriteAsyncIO */ SDL_AsyncIOFromFile :: (file: *u8, mode: *u8) -> *SDL_AsyncIO #foreign libsdl3; /** * Use this function to get the size of the data stream in an SDL_AsyncIO. * * This call is _not_ asynchronous; it assumes that obtaining this info is a * non-blocking operation in most reasonable cases. * * \param asyncio the SDL_AsyncIO to get the size of the data stream from. * \returns the size of the data stream in the SDL_IOStream on success or a * negative error code on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetAsyncIOSize :: (asyncio: *SDL_AsyncIO) -> Sint64 #foreign libsdl3; /** * Start an async read. * * This function reads up to `size` bytes from `offset` position in the data * source to the area pointed at by `ptr`. This function may read less bytes * than requested. * * This function returns as quickly as possible; it does not wait for the read * to complete. On a successful return, this work will continue in the * background. If the work begins, even failure is asynchronous: a failing * return value from this function only means the work couldn't start at all. * * `ptr` must remain available until the work is done, and may be accessed by * the system at any time until then. Do not allocate it on the stack, as this * might take longer than the life of the calling function to complete! * * An SDL_AsyncIOQueue must be specified. The newly-created task will be added * to it when it completes its work. * * \param asyncio a pointer to an SDL_AsyncIO structure. * \param ptr a pointer to a buffer to read data into. * \param offset the position to start reading in the data source. * \param size the number of bytes to read from the data source. * \param queue a queue to add the new SDL_AsyncIO to. * \param userdata an app-defined pointer that will be provided with the task * results. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WriteAsyncIO * \sa SDL_CreateAsyncIOQueue */ SDL_ReadAsyncIO :: (asyncio: *SDL_AsyncIO, ptr: *void, offset: Uint64, size: Uint64, queue: *SDL_AsyncIOQueue, userdata: *void) -> bool #foreign libsdl3; /** * Start an async write. * * This function writes `size` bytes from `offset` position in the data source * to the area pointed at by `ptr`. * * This function returns as quickly as possible; it does not wait for the * write to complete. On a successful return, this work will continue in the * background. If the work begins, even failure is asynchronous: a failing * return value from this function only means the work couldn't start at all. * * `ptr` must remain available until the work is done, and may be accessed by * the system at any time until then. Do not allocate it on the stack, as this * might take longer than the life of the calling function to complete! * * An SDL_AsyncIOQueue must be specified. The newly-created task will be added * to it when it completes its work. * * \param asyncio a pointer to an SDL_AsyncIO structure. * \param ptr a pointer to a buffer to write data from. * \param offset the position to start writing to the data source. * \param size the number of bytes to write to the data source. * \param queue a queue to add the new SDL_AsyncIO to. * \param userdata an app-defined pointer that will be provided with the task * results. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ReadAsyncIO * \sa SDL_CreateAsyncIOQueue */ SDL_WriteAsyncIO :: (asyncio: *SDL_AsyncIO, ptr: *void, offset: Uint64, size: Uint64, queue: *SDL_AsyncIOQueue, userdata: *void) -> bool #foreign libsdl3; /** * Close and free any allocated resources for an async I/O object. * * Closing a file is _also_ an asynchronous task! If a write failure were to * happen during the closing process, for example, the task results will * report it as usual. * * Closing a file that has been written to does not guarantee the data has * made it to physical media; it may remain in the operating system's file * cache, for later writing to disk. This means that a successfully-closed * file can be lost if the system crashes or loses power in this small window. * To prevent this, call this function with the `flush` parameter set to true. * This will make the operation take longer, and perhaps increase system load * in general, but a successful result guarantees that the data has made it to * physical storage. Don't use this for temporary files, caches, and * unimportant data, and definitely use it for crucial irreplaceable files, * like game saves. * * This function guarantees that the close will happen after any other pending * tasks to `asyncio`, so it's safe to open a file, start several operations, * close the file immediately, then check for all results later. This function * will not block until the tasks have completed. * * Once this function returns true, `asyncio` is no longer valid, regardless * of any future outcomes. Any completed tasks might still contain this * pointer in their SDL_AsyncIOOutcome data, in case the app was using this * value to track information, but it should not be used again. * * If this function returns false, the close wasn't started at all, and it's * safe to attempt to close again later. * * An SDL_AsyncIOQueue must be specified. The newly-created task will be added * to it when it completes its work. * * \param asyncio a pointer to an SDL_AsyncIO structure to close. * \param flush true if data should sync to disk before the task completes. * \param queue a queue to add the new SDL_AsyncIO to. * \param userdata an app-defined pointer that will be provided with the task * results. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, but two * threads should not attempt to close the same object. * * \since This function is available since SDL 3.2.0. */ SDL_CloseAsyncIO :: (asyncio: *SDL_AsyncIO, flush: bool, queue: *SDL_AsyncIOQueue, userdata: *void) -> bool #foreign libsdl3; /** * Create a task queue for tracking multiple I/O operations. * * Async I/O operations are assigned to a queue when started. The queue can be * checked for completed tasks thereafter. * * \returns a new task queue object or NULL if there was an error; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyAsyncIOQueue * \sa SDL_GetAsyncIOResult * \sa SDL_WaitAsyncIOResult */ SDL_CreateAsyncIOQueue :: () -> *SDL_AsyncIOQueue #foreign libsdl3; /** * Destroy a previously-created async I/O task queue. * * If there are still tasks pending for this queue, this call will block until * those tasks are finished. All those tasks will be deallocated. Their * results will be lost to the app. * * Any pending reads from SDL_LoadFileAsync() that are still in this queue * will have their buffers deallocated by this function, to prevent a memory * leak. * * Once this function is called, the queue is no longer valid and should not * be used, including by other threads that might access it while destruction * is blocking on pending tasks. * * Do not destroy a queue that still has threads waiting on it through * SDL_WaitAsyncIOResult(). You can call SDL_SignalAsyncIOQueue() first to * unblock those threads, and take measures (such as SDL_WaitThread()) to make * sure they have finished their wait and won't wait on the queue again. * * \param queue the task queue to destroy. * * \threadsafety It is safe to call this function from any thread, so long as * no other thread is waiting on the queue with * SDL_WaitAsyncIOResult. * * \since This function is available since SDL 3.2.0. */ SDL_DestroyAsyncIOQueue :: (queue: *SDL_AsyncIOQueue) -> void #foreign libsdl3; /** * Query an async I/O task queue for completed tasks. * * If a task assigned to this queue has finished, this will return true and * fill in `outcome` with the details of the task. If no task in the queue has * finished, this function will return false. This function does not block. * * If a task has completed, this function will free its resources and the task * pointer will no longer be valid. The task will be removed from the queue. * * It is safe for multiple threads to call this function on the same queue at * once; a completed task will only go to one of the threads. * * \param queue the async I/O task queue to query. * \param outcome details of a finished task will be written here. May not be * NULL. * \returns true if a task has completed, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitAsyncIOResult */ SDL_GetAsyncIOResult :: (queue: *SDL_AsyncIOQueue, outcome: *SDL_AsyncIOOutcome) -> bool #foreign libsdl3; /** * Block until an async I/O task queue has a completed task. * * This function puts the calling thread to sleep until there a task assigned * to the queue that has finished. * * If a task assigned to the queue has finished, this will return true and * fill in `outcome` with the details of the task. If no task in the queue has * finished, this function will return false. * * If a task has completed, this function will free its resources and the task * pointer will no longer be valid. The task will be removed from the queue. * * It is safe for multiple threads to call this function on the same queue at * once; a completed task will only go to one of the threads. * * Note that by the nature of various platforms, more than one waiting thread * may wake to handle a single task, but only one will obtain it, so * `timeoutMS` is a _maximum_ wait time, and this function may return false * sooner. * * This function may return false if there was a system error, the OS * inadvertently awoke multiple threads, or if SDL_SignalAsyncIOQueue() was * called to wake up all waiting threads without a finished task. * * A timeout can be used to specify a maximum wait time, but rather than * polling, it is possible to have a timeout of -1 to wait forever, and use * SDL_SignalAsyncIOQueue() to wake up the waiting threads later. * * \param queue the async I/O task queue to wait on. * \param outcome details of a finished task will be written here. May not be * NULL. * \param timeoutMS the maximum time to wait, in milliseconds, or -1 to wait * indefinitely. * \returns true if task has completed, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalAsyncIOQueue */ SDL_WaitAsyncIOResult :: (queue: *SDL_AsyncIOQueue, outcome: *SDL_AsyncIOOutcome, timeoutMS: Sint32) -> bool #foreign libsdl3; /** * Wake up any threads that are blocking in SDL_WaitAsyncIOResult(). * * This will unblock any threads that are sleeping in a call to * SDL_WaitAsyncIOResult for the specified queue, and cause them to return * from that function. * * This can be useful when destroying a queue to make sure nothing is touching * it indefinitely. In this case, once this call completes, the caller should * take measures to make sure any previously-blocked threads have returned * from their wait and will not touch the queue again (perhaps by setting a * flag to tell the threads to terminate and then using SDL_WaitThread() to * make sure they've done so). * * \param queue the async I/O task queue to signal. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitAsyncIOResult */ SDL_SignalAsyncIOQueue :: (queue: *SDL_AsyncIOQueue) -> void #foreign libsdl3; /** * Load all the data from a file path, asynchronously. * * This function returns as quickly as possible; it does not wait for the read * to complete. On a successful return, this work will continue in the * background. If the work begins, even failure is asynchronous: a failing * return value from this function only means the work couldn't start at all. * * The data is allocated with a zero byte at the end (null terminated) for * convenience. This extra byte is not included in SDL_AsyncIOOutcome's * bytes_transferred value. * * This function will allocate the buffer to contain the file. It must be * deallocated by calling SDL_free() on SDL_AsyncIOOutcome's buffer field * after completion. * * An SDL_AsyncIOQueue must be specified. The newly-created task will be added * to it when it completes its work. * * \param file the path to read all available data from. * \param queue a queue to add the new SDL_AsyncIO to. * \param userdata an app-defined pointer that will be provided with the task * results. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadFile_IO */ SDL_LoadFileAsync :: (file: *u8, queue: *SDL_AsyncIOQueue, userdata: *void) -> bool #foreign libsdl3; /** * An atomic spinlock. * * The atomic locks are efficient spinlocks using CPU instructions, but are * vulnerable to starvation and can spin forever if a thread holding a lock * has been terminated. For this reason you should minimize the code executed * inside an atomic lock and never do expensive things like API or system * calls while holding them. * * They are also vulnerable to starvation if the thread holding the lock is * lower priority than other threads and doesn't get scheduled. In general you * should use mutexes instead, since they have better performance and * contention behavior. * * The atomic locks are not safe to lock recursively. * * Porting Note: The spin lock functions and type are required and can not be * emulated because they are used in the atomic emulation code. */ SDL_SpinLock :: s32; /** * Try to lock a spin lock by setting it to a non-zero value. * * ***Please note that spinlocks are dangerous if you don't know what you're * doing. Please be careful using any sort of spinlock!*** * * \param lock a pointer to a lock variable. * \returns true if the lock succeeded, false if the lock is already held. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockSpinlock * \sa SDL_UnlockSpinlock */ SDL_TryLockSpinlock :: (lock: *SDL_SpinLock) -> bool #foreign libsdl3; /** * Lock a spin lock by setting it to a non-zero value. * * ***Please note that spinlocks are dangerous if you don't know what you're * doing. Please be careful using any sort of spinlock!*** * * \param lock a pointer to a lock variable. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_TryLockSpinlock * \sa SDL_UnlockSpinlock */ SDL_LockSpinlock :: (lock: *SDL_SpinLock) -> void #foreign libsdl3; /** * Unlock a spin lock by setting it to 0. * * Always returns immediately. * * ***Please note that spinlocks are dangerous if you don't know what you're * doing. Please be careful using any sort of spinlock!*** * * \param lock a pointer to a lock variable. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockSpinlock * \sa SDL_TryLockSpinlock */ SDL_UnlockSpinlock :: (lock: *SDL_SpinLock) -> void #foreign libsdl3; /** * Insert a memory release barrier (function version). * * Please refer to SDL_MemoryBarrierRelease for details. This is a function * version, which might be useful if you need to use this functionality from a * scripting language, etc. Also, some of the macro versions call this * function behind the scenes, where more heavy lifting can happen inside of * SDL. Generally, though, an app written in C/C++/etc should use the macro * version, as it will be more efficient. * * \threadsafety Obviously this function is safe to use from any thread at any * time, but if you find yourself needing this, you are probably * dealing with some very sensitive code; be careful! * * \since This function is available since SDL 3.2.0. * * \sa SDL_MemoryBarrierRelease */ SDL_MemoryBarrierReleaseFunction :: () -> void #foreign libsdl3; /** * Insert a memory acquire barrier (function version). * * Please refer to SDL_MemoryBarrierRelease for details. This is a function * version, which might be useful if you need to use this functionality from a * scripting language, etc. Also, some of the macro versions call this * function behind the scenes, where more heavy lifting can happen inside of * SDL. Generally, though, an app written in C/C++/etc should use the macro * version, as it will be more efficient. * * \threadsafety Obviously this function is safe to use from any thread at any * time, but if you find yourself needing this, you are probably * dealing with some very sensitive code; be careful! * * \since This function is available since SDL 3.2.0. * * \sa SDL_MemoryBarrierAcquire */ SDL_MemoryBarrierAcquireFunction :: () -> void #foreign libsdl3; /** * A type representing an atomic integer value. * * This can be used to manage a value that is synchronized across multiple * CPUs without a race condition; when an app sets a value with * SDL_SetAtomicInt all other threads, regardless of the CPU it is running on, * will see that value when retrieved with SDL_GetAtomicInt, regardless of CPU * caches, etc. * * This is also useful for atomic compare-and-swap operations: a thread can * change the value as long as its current value matches expectations. When * done in a loop, one can guarantee data consistency across threads without a * lock (but the usual warnings apply: if you don't know what you're doing, or * you don't do it carefully, you can confidently cause any number of * disasters with this, so in most cases, you _should_ use a mutex instead of * this!). * * This is a struct so people don't accidentally use numeric operations on it * directly. You have to use SDL atomic functions. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicInt * \sa SDL_GetAtomicInt * \sa SDL_SetAtomicInt * \sa SDL_AddAtomicInt */ SDL_AtomicInt :: struct { value: s32; } /** * Set an atomic variable to a new value if it is currently an old value. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to an SDL_AtomicInt variable to be modified. * \param oldval the old value. * \param newval the new value. * \returns true if the atomic variable was set, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAtomicInt * \sa SDL_SetAtomicInt */ SDL_CompareAndSwapAtomicInt :: (a: *SDL_AtomicInt, oldval: s32, newval: s32) -> bool #foreign libsdl3; /** * Set an atomic variable to a value. * * This function also acts as a full memory barrier. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to an SDL_AtomicInt variable to be modified. * \param v the desired value. * \returns the previous value of the atomic variable. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAtomicInt */ SDL_SetAtomicInt :: (a: *SDL_AtomicInt, v: s32) -> s32 #foreign libsdl3; /** * Get the value of an atomic variable. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to an SDL_AtomicInt variable. * \returns the current value of an atomic variable. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAtomicInt */ SDL_GetAtomicInt :: (a: *SDL_AtomicInt) -> s32 #foreign libsdl3; /** * Add to an atomic variable. * * This function also acts as a full memory barrier. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to an SDL_AtomicInt variable to be modified. * \param v the desired value to add. * \returns the previous value of the atomic variable. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AtomicDecRef * \sa SDL_AtomicIncRef */ SDL_AddAtomicInt :: (a: *SDL_AtomicInt, v: s32) -> s32 #foreign libsdl3; /** * A type representing an atomic unsigned 32-bit value. * * This can be used to manage a value that is synchronized across multiple * CPUs without a race condition; when an app sets a value with * SDL_SetAtomicU32 all other threads, regardless of the CPU it is running on, * will see that value when retrieved with SDL_GetAtomicU32, regardless of CPU * caches, etc. * * This is also useful for atomic compare-and-swap operations: a thread can * change the value as long as its current value matches expectations. When * done in a loop, one can guarantee data consistency across threads without a * lock (but the usual warnings apply: if you don't know what you're doing, or * you don't do it carefully, you can confidently cause any number of * disasters with this, so in most cases, you _should_ use a mutex instead of * this!). * * This is a struct so people don't accidentally use numeric operations on it * directly. You have to use SDL atomic functions. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicU32 * \sa SDL_GetAtomicU32 * \sa SDL_SetAtomicU32 */ SDL_AtomicU32 :: struct { value: Uint32; } /** * Set an atomic variable to a new value if it is currently an old value. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to an SDL_AtomicU32 variable to be modified. * \param oldval the old value. * \param newval the new value. * \returns true if the atomic variable was set, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAtomicU32 * \sa SDL_SetAtomicU32 */ SDL_CompareAndSwapAtomicU32 :: (a: *SDL_AtomicU32, oldval: Uint32, newval: Uint32) -> bool #foreign libsdl3; /** * Set an atomic variable to a value. * * This function also acts as a full memory barrier. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to an SDL_AtomicU32 variable to be modified. * \param v the desired value. * \returns the previous value of the atomic variable. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAtomicU32 */ SDL_SetAtomicU32 :: (a: *SDL_AtomicU32, v: Uint32) -> Uint32 #foreign libsdl3; /** * Get the value of an atomic variable. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to an SDL_AtomicU32 variable. * \returns the current value of an atomic variable. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAtomicU32 */ SDL_GetAtomicU32 :: (a: *SDL_AtomicU32) -> Uint32 #foreign libsdl3; /** * Set a pointer to a new value if it is currently an old value. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to a pointer. * \param oldval the old pointer value. * \param newval the new pointer value. * \returns true if the pointer was set, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicInt * \sa SDL_GetAtomicPointer * \sa SDL_SetAtomicPointer */ SDL_CompareAndSwapAtomicPointer :: (a: **void, oldval: *void, newval: *void) -> bool #foreign libsdl3; /** * Set a pointer to a value atomically. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to a pointer. * \param v the desired pointer value. * \returns the previous value of the pointer. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicPointer * \sa SDL_GetAtomicPointer */ SDL_SetAtomicPointer :: (a: **void, v: *void) -> *void #foreign libsdl3; /** * Get the value of a pointer atomically. * * ***Note: If you don't know what this function is for, you shouldn't use * it!*** * * \param a a pointer to a pointer. * \returns the current value of a pointer. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CompareAndSwapAtomicPointer * \sa SDL_SetAtomicPointer */ SDL_GetAtomicPointer :: (a: **void) -> *void #foreign libsdl3; /** * Set the SDL error message for the current thread. * * Calling this function will replace any previous error message that was set. * * This function always returns false, since SDL frequently uses false to * signify a failing result, leading to this idiom: * * ```c * if (error_code) { * return SDL_SetError("This operation has failed: %d", error_code); * } * ``` * * \param fmt a printf()-style message format string. * \param ... additional parameters matching % tokens in the `fmt` string, if * any. * \returns false. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearError * \sa SDL_GetError * \sa SDL_SetErrorV */ SDL_SetError_CFormat :: (fmt: *u8, __args: ..Any) -> bool #foreign libsdl3 "SDL_SetError"; SDL_SetError :: (fmt: string, __args: ..Any) -> bool { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); return SDL_SetError_CFormat("%s", formatted_text.data); } @PrintLike /** * Set an error indicating that memory allocation failed. * * This function does not do any memory allocation. * * \returns false. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_OutOfMemory :: () -> bool #foreign libsdl3; /** * Retrieve a message about the last error that occurred on the current * thread. * * It is possible for multiple errors to occur before calling SDL_GetError(). * Only the last error is returned. * * The message is only applicable when an SDL function has signaled an error. * You must check the return values of SDL function calls to determine when to * appropriately call SDL_GetError(). You should *not* use the results of * SDL_GetError() to decide if an error has occurred! Sometimes SDL will set * an error string even when reporting success. * * SDL will *not* clear the error string for successful API calls. You *must* * check return values for failure cases before you can assume the error * string applies. * * Error strings are set per-thread, so an error set in a different thread * will not interfere with the current thread's operation. * * The returned value is a thread-local string which will remain valid until * the current thread's error string is changed. The caller should make a copy * if the value is needed after the next SDL API call. * * \returns a message with information about the specific error that occurred, * or an empty string if there hasn't been an error message set since * the last call to SDL_ClearError(). * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearError * \sa SDL_SetError */ SDL_GetError :: () -> *u8 #foreign libsdl3; /** * Clear any previous error message for this thread. * * \returns true. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetError * \sa SDL_SetError */ SDL_ClearError :: () -> bool #foreign libsdl3; /** * SDL properties ID * * \since This datatype is available since SDL 3.2.0. */ SDL_PropertiesID :: Uint32; /** * SDL property type * * \since This enum is available since SDL 3.2.0. */ using SDL_PropertyType :: enum u32 { SDL_PROPERTY_TYPE_INVALID :: 0; SDL_PROPERTY_TYPE_POINTER :: 1; SDL_PROPERTY_TYPE_STRING :: 2; SDL_PROPERTY_TYPE_NUMBER :: 3; SDL_PROPERTY_TYPE_FLOAT :: 4; SDL_PROPERTY_TYPE_BOOLEAN :: 5; } /** * Get the global SDL properties. * * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetGlobalProperties :: () -> SDL_PropertiesID #foreign libsdl3; /** * Create a group of properties. * * All properties are automatically destroyed when SDL_Quit() is called. * * \returns an ID for a new group of properties, or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyProperties */ SDL_CreateProperties :: () -> SDL_PropertiesID #foreign libsdl3; /** * Copy a group of properties. * * Copy all the properties from one group of properties to another, with the * exception of properties requiring cleanup (set using * SDL_SetPointerPropertyWithCleanup()), which will not be copied. Any * property that already exists on `dst` will be overwritten. * * \param src the properties to copy. * \param dst the destination properties. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_CopyProperties :: (src: SDL_PropertiesID, dst: SDL_PropertiesID) -> bool #foreign libsdl3; /** * Lock a group of properties. * * Obtain a multi-threaded lock for these properties. Other threads will wait * while trying to lock these properties until they are unlocked. Properties * must be unlocked before they are destroyed. * * The lock is automatically taken when setting individual properties, this * function is only needed when you want to set several properties atomically * or want to guarantee that properties being queried aren't freed in another * thread. * * \param props the properties to lock. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UnlockProperties */ SDL_LockProperties :: (props: SDL_PropertiesID) -> bool #foreign libsdl3; /** * Unlock a group of properties. * * \param props the properties to unlock. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockProperties */ SDL_UnlockProperties :: (props: SDL_PropertiesID) -> void #foreign libsdl3; /** * A callback used to free resources when a property is deleted. * * This should release any resources associated with `value` that are no * longer needed. * * This callback is set per-property. Different properties in the same group * can have different cleanup callbacks. * * This callback will be called _during_ SDL_SetPointerPropertyWithCleanup if * the function fails for any reason. * * \param userdata an app-defined pointer passed to the callback. * \param value the pointer assigned to the property to clean up. * * \threadsafety This callback may fire without any locks held; if this is a * concern, the app should provide its own locking. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetPointerPropertyWithCleanup */ SDL_CleanupPropertyCallback :: #type (userdata: *void, value: *void) -> void #c_call; /** * Set a pointer property in a group of properties with a cleanup function * that is called when the property is deleted. * * The cleanup function is also called if setting the property fails for any * reason. * * For simply setting basic data types, like numbers, bools, or strings, use * SDL_SetNumberProperty, SDL_SetBooleanProperty, or SDL_SetStringProperty * instead, as those functions will handle cleanup on your behalf. This * function is only for more complex, custom data. * * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property, or NULL to delete the property. * \param cleanup the function to call when this property is deleted, or NULL * if no cleanup is necessary. * \param userdata a pointer that is passed to the cleanup function. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPointerProperty * \sa SDL_SetPointerProperty * \sa SDL_CleanupPropertyCallback */ SDL_SetPointerPropertyWithCleanup :: (props: SDL_PropertiesID, name: *u8, value: *void, cleanup: SDL_CleanupPropertyCallback, userdata: *void) -> bool #foreign libsdl3; /** * Set a pointer property in a group of properties. * * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property, or NULL to delete the property. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPointerProperty * \sa SDL_HasProperty * \sa SDL_SetBooleanProperty * \sa SDL_SetFloatProperty * \sa SDL_SetNumberProperty * \sa SDL_SetPointerPropertyWithCleanup * \sa SDL_SetStringProperty */ SDL_SetPointerProperty :: (props: SDL_PropertiesID, name: *u8, value: *void) -> bool #foreign libsdl3; /** * Set a string property in a group of properties. * * This function makes a copy of the string; the caller does not have to * preserve the data after this call completes. * * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property, or NULL to delete the property. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetStringProperty */ SDL_SetStringProperty :: (props: SDL_PropertiesID, name: *u8, value: *u8) -> bool #foreign libsdl3; /** * Set an integer property in a group of properties. * * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumberProperty */ SDL_SetNumberProperty :: (props: SDL_PropertiesID, name: *u8, value: Sint64) -> bool #foreign libsdl3; /** * Set a floating point property in a group of properties. * * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetFloatProperty */ SDL_SetFloatProperty :: (props: SDL_PropertiesID, name: *u8, value: float) -> bool #foreign libsdl3; /** * Set a boolean property in a group of properties. * * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetBooleanProperty */ SDL_SetBooleanProperty :: (props: SDL_PropertiesID, name: *u8, value: bool) -> bool #foreign libsdl3; /** * Return whether a property exists in a group of properties. * * \param props the properties to query. * \param name the name of the property to query. * \returns true if the property exists, or false if it doesn't. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType */ SDL_HasProperty :: (props: SDL_PropertiesID, name: *u8) -> bool #foreign libsdl3; /** * Get the type of a property in a group of properties. * * \param props the properties to query. * \param name the name of the property to query. * \returns the type of the property, or SDL_PROPERTY_TYPE_INVALID if it is * not set. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasProperty */ SDL_GetPropertyType :: (props: SDL_PropertiesID, name: *u8) -> SDL_PropertyType #foreign libsdl3; /** * Get a pointer property from a group of properties. * * By convention, the names of properties that SDL exposes on objects will * start with "SDL.", and properties that SDL uses internally will start with * "SDL.internal.". These should be considered read-only and should not be * modified by applications. * * \param props the properties to query. * \param name the name of the property to query. * \param default_value the default value of the property. * \returns the value of the property, or `default_value` if it is not set or * not a pointer property. * * \threadsafety It is safe to call this function from any thread, although * the data returned is not protected and could potentially be * freed if you call SDL_SetPointerProperty() or * SDL_ClearProperty() on these properties from another thread. * If you need to avoid this, use SDL_LockProperties() and * SDL_UnlockProperties(). * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetBooleanProperty * \sa SDL_GetFloatProperty * \sa SDL_GetNumberProperty * \sa SDL_GetPropertyType * \sa SDL_GetStringProperty * \sa SDL_HasProperty * \sa SDL_SetPointerProperty */ SDL_GetPointerProperty :: (props: SDL_PropertiesID, name: *u8, default_value: *void) -> *void #foreign libsdl3; /** * Get a string property from a group of properties. * * \param props the properties to query. * \param name the name of the property to query. * \param default_value the default value of the property. * \returns the value of the property, or `default_value` if it is not set or * not a string property. * * \threadsafety It is safe to call this function from any thread, although * the data returned is not protected and could potentially be * freed if you call SDL_SetStringProperty() or * SDL_ClearProperty() on these properties from another thread. * If you need to avoid this, use SDL_LockProperties() and * SDL_UnlockProperties(). * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType * \sa SDL_HasProperty * \sa SDL_SetStringProperty */ SDL_GetStringProperty :: (props: SDL_PropertiesID, name: *u8, default_value: *u8) -> *u8 #foreign libsdl3; /** * Get a number property from a group of properties. * * You can use SDL_GetPropertyType() to query whether the property exists and * is a number property. * * \param props the properties to query. * \param name the name of the property to query. * \param default_value the default value of the property. * \returns the value of the property, or `default_value` if it is not set or * not a number property. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType * \sa SDL_HasProperty * \sa SDL_SetNumberProperty */ SDL_GetNumberProperty :: (props: SDL_PropertiesID, name: *u8, default_value: Sint64) -> Sint64 #foreign libsdl3; /** * Get a floating point property from a group of properties. * * You can use SDL_GetPropertyType() to query whether the property exists and * is a floating point property. * * \param props the properties to query. * \param name the name of the property to query. * \param default_value the default value of the property. * \returns the value of the property, or `default_value` if it is not set or * not a float property. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType * \sa SDL_HasProperty * \sa SDL_SetFloatProperty */ SDL_GetFloatProperty :: (props: SDL_PropertiesID, name: *u8, default_value: float) -> float #foreign libsdl3; /** * Get a boolean property from a group of properties. * * You can use SDL_GetPropertyType() to query whether the property exists and * is a boolean property. * * \param props the properties to query. * \param name the name of the property to query. * \param default_value the default value of the property. * \returns the value of the property, or `default_value` if it is not set or * not a boolean property. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPropertyType * \sa SDL_HasProperty * \sa SDL_SetBooleanProperty */ SDL_GetBooleanProperty :: (props: SDL_PropertiesID, name: *u8, default_value: bool) -> bool #foreign libsdl3; /** * Clear a property from a group of properties. * * \param props the properties to modify. * \param name the name of the property to clear. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_ClearProperty :: (props: SDL_PropertiesID, name: *u8) -> bool #foreign libsdl3; /** * A callback used to enumerate all the properties in a group of properties. * * This callback is called from SDL_EnumerateProperties(), and is called once * per property in the set. * * \param userdata an app-defined pointer passed to the callback. * \param props the SDL_PropertiesID that is being enumerated. * \param name the next property name in the enumeration. * * \threadsafety SDL_EnumerateProperties holds a lock on `props` during this * callback. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_EnumerateProperties */ SDL_EnumeratePropertiesCallback :: #type (userdata: *void, props: SDL_PropertiesID, name: *u8) -> void #c_call; /** * Enumerate the properties contained in a group of properties. * * The callback function is called for each property in the group of * properties. The properties are locked during enumeration. * * \param props the properties to query. * \param callback the function to call for each property. * \param userdata a pointer that is passed to `callback`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_EnumerateProperties :: (props: SDL_PropertiesID, callback: SDL_EnumeratePropertiesCallback, userdata: *void) -> bool #foreign libsdl3; /** * Destroy a group of properties. * * All properties are deleted and their cleanup functions will be called, if * any. * * \param props the properties to destroy. * * \threadsafety This function should not be called while these properties are * locked or other threads might be setting or getting values * from these properties. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProperties */ SDL_DestroyProperties :: (props: SDL_PropertiesID) -> void #foreign libsdl3; SDL_Thread :: struct {} /** * A unique numeric ID that identifies a thread. * * These are different from SDL_Thread objects, which are generally what an * application will operate on, but having a way to uniquely identify a thread * can be useful at times. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetThreadID * \sa SDL_GetCurrentThreadID */ SDL_ThreadID :: Uint64; /** * Thread local storage ID. * * 0 is the invalid ID. An app can create these and then set data for these * IDs that is unique to each thread. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetTLS * \sa SDL_SetTLS */ SDL_TLSID :: SDL_AtomicInt; /** * The SDL thread priority. * * SDL will make system changes as necessary in order to apply the thread * priority. Code which attempts to control thread state related to priority * should be aware that calling SDL_SetCurrentThreadPriority may alter such * state. SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of * this behavior. * * \since This enum is available since SDL 3.2.0. */ using SDL_ThreadPriority :: enum u32 { SDL_THREAD_PRIORITY_LOW :: 0; SDL_THREAD_PRIORITY_NORMAL :: 1; SDL_THREAD_PRIORITY_HIGH :: 2; SDL_THREAD_PRIORITY_TIME_CRITICAL :: 3; } /** * The SDL thread state. * * The current state of a thread can be checked by calling SDL_GetThreadState. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetThreadState */ using SDL_ThreadState :: enum u32 { SDL_THREAD_UNKNOWN :: 0; SDL_THREAD_ALIVE :: 1; SDL_THREAD_DETACHED :: 2; SDL_THREAD_COMPLETE :: 3; } /** * The function passed to SDL_CreateThread() as the new thread's entry point. * * \param data what was passed as `data` to SDL_CreateThread(). * \returns a value that can be reported through SDL_WaitThread(). * * \since This datatype is available since SDL 3.2.0. */ SDL_ThreadFunction :: #type (data: *void) -> s32 #c_call; /* These are the actual functions exported from SDL! Don't use them directly! Use the SDL_CreateThread and SDL_CreateThreadWithProperties macros! */ /** * The actual entry point for SDL_CreateThread. * * \param fn the SDL_ThreadFunction function to call in the new thread * \param name the name of the thread * \param data a pointer that is passed to `fn` * \param pfnBeginThread the C runtime's _beginthreadex (or whatnot). Can be NULL. * \param pfnEndThread the C runtime's _endthreadex (or whatnot). Can be NULL. * \returns an opaque pointer to the new thread object on success, NULL if the * new thread could not be created; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_CreateThreadRuntime :: (fn: SDL_ThreadFunction, name: *u8, data: *void, pfnBeginThread: SDL_FunctionPointer, pfnEndThread: SDL_FunctionPointer) -> *SDL_Thread #foreign libsdl3; /** * The actual entry point for SDL_CreateThreadWithProperties. * * \param props the properties to use * \param pfnBeginThread the C runtime's _beginthreadex (or whatnot). Can be NULL. * \param pfnEndThread the C runtime's _endthreadex (or whatnot). Can be NULL. * \returns an opaque pointer to the new thread object on success, NULL if the * new thread could not be created; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_CreateThreadWithPropertiesRuntime :: (props: SDL_PropertiesID, pfnBeginThread: SDL_FunctionPointer, pfnEndThread: SDL_FunctionPointer) -> *SDL_Thread #foreign libsdl3; /** * Get the thread name as it was specified in SDL_CreateThread(). * * \param thread the thread to query. * \returns a pointer to a UTF-8 string that names the specified thread, or * NULL if it doesn't have a name. * * \since This function is available since SDL 3.2.0. */ SDL_GetThreadName :: (thread: *SDL_Thread) -> *u8 #foreign libsdl3; /** * Get the thread identifier for the current thread. * * This thread identifier is as reported by the underlying operating system. * If SDL is running on a platform that does not support threads the return * value will always be zero. * * This function also returns a valid thread ID when called from the main * thread. * * \returns the ID of the current thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetThreadID */ SDL_GetCurrentThreadID :: () -> SDL_ThreadID #foreign libsdl3; /** * Get the thread identifier for the specified thread. * * This thread identifier is as reported by the underlying operating system. * If SDL is running on a platform that does not support threads the return * value will always be zero. * * \param thread the thread to query. * \returns the ID of the specified thread, or the ID of the current thread if * `thread` is NULL. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCurrentThreadID */ SDL_GetThreadID :: (thread: *SDL_Thread) -> SDL_ThreadID #foreign libsdl3; /** * Set the priority for the current thread. * * Note that some platforms will not let you alter the priority (or at least, * promote the thread to a higher priority) at all, and some require you to be * an administrator account. Be prepared for this to fail. * * \param priority the SDL_ThreadPriority to set. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetCurrentThreadPriority :: (priority: SDL_ThreadPriority) -> bool #foreign libsdl3; /** * Wait for a thread to finish. * * Threads that haven't been detached will remain until this function cleans * them up. Not doing so is a resource leak. * * Once a thread has been cleaned up through this function, the SDL_Thread * that references it becomes invalid and should not be referenced again. As * such, only one thread may call SDL_WaitThread() on another. * * The return code from the thread function is placed in the area pointed to * by `status`, if `status` is not NULL. * * You may not wait on a thread that has been used in a call to * SDL_DetachThread(). Use either that function or this one, but not both, or * behavior is undefined. * * It is safe to pass a NULL thread to this function; it is a no-op. * * Note that the thread pointer is freed by this function and is not valid * afterward. * * \param thread the SDL_Thread pointer that was returned from the * SDL_CreateThread() call that started this thread. * \param status a pointer filled in with the value returned from the thread * function by its 'return', or -1 if the thread has been * detached or isn't valid, may be NULL. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateThread * \sa SDL_DetachThread */ SDL_WaitThread :: (thread: *SDL_Thread, status: *s32) -> void #foreign libsdl3; /** * Get the current state of a thread. * * \param thread the thread to query. * \returns the current state of a thread, or SDL_THREAD_UNKNOWN if the thread * isn't valid. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ThreadState */ SDL_GetThreadState :: (thread: *SDL_Thread) -> SDL_ThreadState #foreign libsdl3; /** * Let a thread clean up on exit without intervention. * * A thread may be "detached" to signify that it should not remain until * another thread has called SDL_WaitThread() on it. Detaching a thread is * useful for long-running threads that nothing needs to synchronize with or * further manage. When a detached thread is done, it simply goes away. * * There is no way to recover the return code of a detached thread. If you * need this, don't detach the thread and instead use SDL_WaitThread(). * * Once a thread is detached, you should usually assume the SDL_Thread isn't * safe to reference again, as it will become invalid immediately upon the * detached thread's exit, instead of remaining until someone has called * SDL_WaitThread() to finally clean it up. As such, don't detach the same * thread more than once. * * If a thread has already exited when passed to SDL_DetachThread(), it will * stop waiting for a call to SDL_WaitThread() and clean up immediately. It is * not safe to detach a thread that might be used with SDL_WaitThread(). * * You may not call SDL_WaitThread() on a thread that has been detached. Use * either that function or this one, but not both, or behavior is undefined. * * It is safe to pass NULL to this function; it is a no-op. * * \param thread the SDL_Thread pointer that was returned from the * SDL_CreateThread() call that started this thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateThread * \sa SDL_WaitThread */ SDL_DetachThread :: (thread: *SDL_Thread) -> void #foreign libsdl3; /** * Get the current thread's value associated with a thread local storage ID. * * \param id a pointer to the thread local storage ID, may not be NULL. * \returns the value associated with the ID for the current thread or NULL if * no value has been set; call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTLS */ SDL_GetTLS :: (id: *SDL_TLSID) -> *void #foreign libsdl3; /** * The callback used to cleanup data passed to SDL_SetTLS. * * This is called when a thread exits, to allow an app to free any resources. * * \param value a pointer previously handed to SDL_SetTLS. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetTLS */ SDL_TLSDestructorCallback :: #type (value: *void) -> void #c_call; /** * Set the current thread's value associated with a thread local storage ID. * * If the thread local storage ID is not initialized (the value is 0), a new * ID will be created in a thread-safe way, so all calls using a pointer to * the same ID will refer to the same local storage. * * Note that replacing a value from a previous call to this function on the * same thread does _not_ call the previous value's destructor! * * `destructor` can be NULL; it is assumed that `value` does not need to be * cleaned up if so. * * \param id a pointer to the thread local storage ID, may not be NULL. * \param value the value to associate with the ID for the current thread. * \param destructor a function called when the thread exits, to free the * value, may be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTLS */ SDL_SetTLS :: (id: *SDL_TLSID, value: *void, destructor: SDL_TLSDestructorCallback) -> bool #foreign libsdl3; /** * Cleanup all TLS data for this thread. * * If you are creating your threads outside of SDL and then calling SDL * functions, you should call this function before your thread exits, to * properly clean up SDL memory. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_CleanupTLS :: () -> void #foreign libsdl3; SDL_Mutex :: struct {} /** * Create a new mutex. * * All newly-created mutexes begin in the _unlocked_ state. * * Calls to SDL_LockMutex() will not return while the mutex is locked by * another thread. See SDL_TryLockMutex() to attempt to lock without blocking. * * SDL mutexes are reentrant. * * \returns the initialized and unlocked mutex or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyMutex * \sa SDL_LockMutex * \sa SDL_TryLockMutex * \sa SDL_UnlockMutex */ SDL_CreateMutex :: () -> *SDL_Mutex #foreign libsdl3; /** * Lock the mutex. * * This will block until the mutex is available, which is to say it is in the * unlocked state and the OS has chosen the caller as the next thread to lock * it. Of all threads waiting to lock the mutex, only one may do so at a time. * * It is legal for the owning thread to lock an already-locked mutex. It must * unlock it the same number of times before it is actually made available for * other threads in the system (this is known as a "recursive mutex"). * * This function does not fail; if mutex is NULL, it will return immediately * having locked nothing. If the mutex is valid, this function will always * block until it can lock the mutex, and return with it locked. * * \param mutex the mutex to lock. * * \since This function is available since SDL 3.2.0. * * \sa SDL_TryLockMutex * \sa SDL_UnlockMutex */ SDL_LockMutex :: (mutex: *SDL_Mutex) -> void #foreign libsdl3; /** * Try to lock a mutex without blocking. * * This works just like SDL_LockMutex(), but if the mutex is not available, * this function returns false immediately. * * This technique is useful if you need exclusive access to a resource but * don't want to wait for it, and will return to it to try again later. * * This function returns true if passed a NULL mutex. * * \param mutex the mutex to try to lock. * \returns true on success, false if the mutex would block. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockMutex * \sa SDL_UnlockMutex */ SDL_TryLockMutex :: (mutex: *SDL_Mutex) -> bool #foreign libsdl3; /** * Unlock the mutex. * * It is legal for the owning thread to lock an already-locked mutex. It must * unlock it the same number of times before it is actually made available for * other threads in the system (this is known as a "recursive mutex"). * * It is illegal to unlock a mutex that has not been locked by the current * thread, and doing so results in undefined behavior. * * \param mutex the mutex to unlock. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockMutex * \sa SDL_TryLockMutex */ SDL_UnlockMutex :: (mutex: *SDL_Mutex) -> void #foreign libsdl3; /** * Destroy a mutex created with SDL_CreateMutex(). * * This function must be called on any mutex that is no longer needed. Failure * to destroy a mutex will result in a system memory or resource leak. While * it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt * to destroy a locked mutex, and may result in undefined behavior depending * on the platform. * * \param mutex the mutex to destroy. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateMutex */ SDL_DestroyMutex :: (mutex: *SDL_Mutex) -> void #foreign libsdl3; SDL_RWLock :: struct {} /** * Create a new read/write lock. * * A read/write lock is useful for situations where you have multiple threads * trying to access a resource that is rarely updated. All threads requesting * a read-only lock will be allowed to run in parallel; if a thread requests a * write lock, it will be provided exclusive access. This makes it safe for * multiple threads to use a resource at the same time if they promise not to * change it, and when it has to be changed, the rwlock will serve as a * gateway to make sure those changes can be made safely. * * In the right situation, a rwlock can be more efficient than a mutex, which * only lets a single thread proceed at a time, even if it won't be modifying * the data. * * All newly-created read/write locks begin in the _unlocked_ state. * * Calls to SDL_LockRWLockForReading() and SDL_LockRWLockForWriting will not * return while the rwlock is locked _for writing_ by another thread. See * SDL_TryLockRWLockForReading() and SDL_TryLockRWLockForWriting() to attempt * to lock without blocking. * * SDL read/write locks are only recursive for read-only locks! They are not * guaranteed to be fair, or provide access in a FIFO manner! They are not * guaranteed to favor writers. You may not lock a rwlock for both read-only * and write access at the same time from the same thread (so you can't * promote your read-only lock to a write lock without unlocking first). * * \returns the initialized and unlocked read/write lock or NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyRWLock * \sa SDL_LockRWLockForReading * \sa SDL_LockRWLockForWriting * \sa SDL_TryLockRWLockForReading * \sa SDL_TryLockRWLockForWriting * \sa SDL_UnlockRWLock */ SDL_CreateRWLock :: () -> *SDL_RWLock #foreign libsdl3; /** * Lock the read/write lock for _read only_ operations. * * This will block until the rwlock is available, which is to say it is not * locked for writing by any other thread. Of all threads waiting to lock the * rwlock, all may do so at the same time as long as they are requesting * read-only access; if a thread wants to lock for writing, only one may do so * at a time, and no other threads, read-only or not, may hold the lock at the * same time. * * It is legal for the owning thread to lock an already-locked rwlock for * reading. It must unlock it the same number of times before it is actually * made available for other threads in the system (this is known as a * "recursive rwlock"). * * Note that locking for writing is not recursive (this is only available to * read-only locks). * * It is illegal to request a read-only lock from a thread that already holds * the write lock. Doing so results in undefined behavior. Unlock the write * lock before requesting a read-only lock. (But, of course, if you have the * write lock, you don't need further locks to read in any case.) * * This function does not fail; if rwlock is NULL, it will return immediately * having locked nothing. If the rwlock is valid, this function will always * block until it can lock the mutex, and return with it locked. * * \param rwlock the read/write lock to lock. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForWriting * \sa SDL_TryLockRWLockForReading * \sa SDL_UnlockRWLock */ SDL_LockRWLockForReading :: (rwlock: *SDL_RWLock) -> void #foreign libsdl3; /** * Lock the read/write lock for _write_ operations. * * This will block until the rwlock is available, which is to say it is not * locked for reading or writing by any other thread. Only one thread may hold * the lock when it requests write access; all other threads, whether they * also want to write or only want read-only access, must wait until the * writer thread has released the lock. * * It is illegal for the owning thread to lock an already-locked rwlock for * writing (read-only may be locked recursively, writing can not). Doing so * results in undefined behavior. * * It is illegal to request a write lock from a thread that already holds a * read-only lock. Doing so results in undefined behavior. Unlock the * read-only lock before requesting a write lock. * * This function does not fail; if rwlock is NULL, it will return immediately * having locked nothing. If the rwlock is valid, this function will always * block until it can lock the mutex, and return with it locked. * * \param rwlock the read/write lock to lock. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForReading * \sa SDL_TryLockRWLockForWriting * \sa SDL_UnlockRWLock */ SDL_LockRWLockForWriting :: (rwlock: *SDL_RWLock) -> void #foreign libsdl3; /** * Try to lock a read/write lock _for reading_ without blocking. * * This works just like SDL_LockRWLockForReading(), but if the rwlock is not * available, then this function returns false immediately. * * This technique is useful if you need access to a resource but don't want to * wait for it, and will return to it to try again later. * * Trying to lock for read-only access can succeed if other threads are * holding read-only locks, as this won't prevent access. * * This function returns true if passed a NULL rwlock. * * \param rwlock the rwlock to try to lock. * \returns true on success, false if the lock would block. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForReading * \sa SDL_TryLockRWLockForWriting * \sa SDL_UnlockRWLock */ SDL_TryLockRWLockForReading :: (rwlock: *SDL_RWLock) -> bool #foreign libsdl3; /** * Try to lock a read/write lock _for writing_ without blocking. * * This works just like SDL_LockRWLockForWriting(), but if the rwlock is not * available, then this function returns false immediately. * * This technique is useful if you need exclusive access to a resource but * don't want to wait for it, and will return to it to try again later. * * It is illegal for the owning thread to lock an already-locked rwlock for * writing (read-only may be locked recursively, writing can not). Doing so * results in undefined behavior. * * It is illegal to request a write lock from a thread that already holds a * read-only lock. Doing so results in undefined behavior. Unlock the * read-only lock before requesting a write lock. * * This function returns true if passed a NULL rwlock. * * \param rwlock the rwlock to try to lock. * \returns true on success, false if the lock would block. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForWriting * \sa SDL_TryLockRWLockForReading * \sa SDL_UnlockRWLock */ SDL_TryLockRWLockForWriting :: (rwlock: *SDL_RWLock) -> bool #foreign libsdl3; /** * Unlock the read/write lock. * * Use this function to unlock the rwlock, whether it was locked for read-only * or write operations. * * It is legal for the owning thread to lock an already-locked read-only lock. * It must unlock it the same number of times before it is actually made * available for other threads in the system (this is known as a "recursive * rwlock"). * * It is illegal to unlock a rwlock that has not been locked by the current * thread, and doing so results in undefined behavior. * * \param rwlock the rwlock to unlock. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockRWLockForReading * \sa SDL_LockRWLockForWriting * \sa SDL_TryLockRWLockForReading * \sa SDL_TryLockRWLockForWriting */ SDL_UnlockRWLock :: (rwlock: *SDL_RWLock) -> void #foreign libsdl3; /** * Destroy a read/write lock created with SDL_CreateRWLock(). * * This function must be called on any read/write lock that is no longer * needed. Failure to destroy a rwlock will result in a system memory or * resource leak. While it is safe to destroy a rwlock that is _unlocked_, it * is not safe to attempt to destroy a locked rwlock, and may result in * undefined behavior depending on the platform. * * \param rwlock the rwlock to destroy. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRWLock */ SDL_DestroyRWLock :: (rwlock: *SDL_RWLock) -> void #foreign libsdl3; SDL_Semaphore :: struct {} /** * Create a semaphore. * * This function creates a new semaphore and initializes it with the value * `initial_value`. Each wait operation on the semaphore will atomically * decrement the semaphore value and potentially block if the semaphore value * is 0. Each post operation will atomically increment the semaphore value and * wake waiting threads and allow them to retry the wait operation. * * \param initial_value the starting value of the semaphore. * \returns a new semaphore or NULL on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySemaphore * \sa SDL_SignalSemaphore * \sa SDL_TryWaitSemaphore * \sa SDL_GetSemaphoreValue * \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphoreTimeout */ SDL_CreateSemaphore :: (initial_value: Uint32) -> *SDL_Semaphore #foreign libsdl3; /** * Destroy a semaphore. * * It is not safe to destroy a semaphore if there are threads currently * waiting on it. * * \param sem the semaphore to destroy. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateSemaphore */ SDL_DestroySemaphore :: (sem: *SDL_Semaphore) -> void #foreign libsdl3; /** * Wait until a semaphore has a positive value and then decrements it. * * This function suspends the calling thread until the semaphore pointed to by * `sem` has a positive value, and then atomically decrement the semaphore * value. * * This function is the equivalent of calling SDL_WaitSemaphoreTimeout() with * a time length of -1. * * \param sem the semaphore wait on. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalSemaphore * \sa SDL_TryWaitSemaphore * \sa SDL_WaitSemaphoreTimeout */ SDL_WaitSemaphore :: (sem: *SDL_Semaphore) -> void #foreign libsdl3; /** * See if a semaphore has a positive value and decrement it if it does. * * This function checks to see if the semaphore pointed to by `sem` has a * positive value and atomically decrements the semaphore value if it does. If * the semaphore doesn't have a positive value, the function immediately * returns false. * * \param sem the semaphore to wait on. * \returns true if the wait succeeds, false if the wait would block. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalSemaphore * \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphoreTimeout */ SDL_TryWaitSemaphore :: (sem: *SDL_Semaphore) -> bool #foreign libsdl3; /** * Wait until a semaphore has a positive value and then decrements it. * * This function suspends the calling thread until either the semaphore * pointed to by `sem` has a positive value or the specified time has elapsed. * If the call is successful it will atomically decrement the semaphore value. * * \param sem the semaphore to wait on. * \param timeoutMS the length of the timeout, in milliseconds, or -1 to wait * indefinitely. * \returns true if the wait succeeds or false if the wait times out. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalSemaphore * \sa SDL_TryWaitSemaphore * \sa SDL_WaitSemaphore */ SDL_WaitSemaphoreTimeout :: (sem: *SDL_Semaphore, timeoutMS: Sint32) -> bool #foreign libsdl3; /** * Atomically increment a semaphore's value and wake waiting threads. * * \param sem the semaphore to increment. * * \since This function is available since SDL 3.2.0. * * \sa SDL_TryWaitSemaphore * \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphoreTimeout */ SDL_SignalSemaphore :: (sem: *SDL_Semaphore) -> void #foreign libsdl3; /** * Get the current value of a semaphore. * * \param sem the semaphore to query. * \returns the current value of the semaphore. * * \since This function is available since SDL 3.2.0. */ SDL_GetSemaphoreValue :: (sem: *SDL_Semaphore) -> Uint32 #foreign libsdl3; SDL_Condition :: struct {} /** * Create a condition variable. * * \returns a new condition variable or NULL on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BroadcastCondition * \sa SDL_SignalCondition * \sa SDL_WaitCondition * \sa SDL_WaitConditionTimeout * \sa SDL_DestroyCondition */ SDL_CreateCondition :: () -> *SDL_Condition #foreign libsdl3; /** * Destroy a condition variable. * * \param cond the condition variable to destroy. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateCondition */ SDL_DestroyCondition :: (cond: *SDL_Condition) -> void #foreign libsdl3; /** * Restart one of the threads that are waiting on the condition variable. * * \param cond the condition variable to signal. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BroadcastCondition * \sa SDL_WaitCondition * \sa SDL_WaitConditionTimeout */ SDL_SignalCondition :: (cond: *SDL_Condition) -> void #foreign libsdl3; /** * Restart all threads that are waiting on the condition variable. * * \param cond the condition variable to signal. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SignalCondition * \sa SDL_WaitCondition * \sa SDL_WaitConditionTimeout */ SDL_BroadcastCondition :: (cond: *SDL_Condition) -> void #foreign libsdl3; /** * Wait until a condition variable is signaled. * * This function unlocks the specified `mutex` and waits for another thread to * call SDL_SignalCondition() or SDL_BroadcastCondition() on the condition * variable `cond`. Once the condition variable is signaled, the mutex is * re-locked and the function returns. * * The mutex must be locked before calling this function. Locking the mutex * recursively (more than once) is not supported and leads to undefined * behavior. * * This function is the equivalent of calling SDL_WaitConditionTimeout() with * a time length of -1. * * \param cond the condition variable to wait on. * \param mutex the mutex used to coordinate thread access. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BroadcastCondition * \sa SDL_SignalCondition * \sa SDL_WaitConditionTimeout */ SDL_WaitCondition :: (cond: *SDL_Condition, mutex: *SDL_Mutex) -> void #foreign libsdl3; /** * Wait until a condition variable is signaled or a certain time has passed. * * This function unlocks the specified `mutex` and waits for another thread to * call SDL_SignalCondition() or SDL_BroadcastCondition() on the condition * variable `cond`, or for the specified time to elapse. Once the condition * variable is signaled or the time elapsed, the mutex is re-locked and the * function returns. * * The mutex must be locked before calling this function. Locking the mutex * recursively (more than once) is not supported and leads to undefined * behavior. * * \param cond the condition variable to wait on. * \param mutex the mutex used to coordinate thread access. * \param timeoutMS the maximum time to wait, in milliseconds, or -1 to wait * indefinitely. * \returns true if the condition variable is signaled, false if the condition * is not signaled in the allotted time. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BroadcastCondition * \sa SDL_SignalCondition * \sa SDL_WaitCondition */ SDL_WaitConditionTimeout :: (cond: *SDL_Condition, mutex: *SDL_Mutex, timeoutMS: Sint32) -> bool #foreign libsdl3; /** * The current status of an SDL_InitState structure. * * \since This enum is available since SDL 3.2.0. */ using SDL_InitStatus :: enum u32 { SDL_INIT_STATUS_UNINITIALIZED :: 0; SDL_INIT_STATUS_INITIALIZING :: 1; SDL_INIT_STATUS_INITIALIZED :: 2; SDL_INIT_STATUS_UNINITIALIZING :: 3; } /** * A structure used for thread-safe initialization and shutdown. * * Here is an example of using this: * * ```c * static SDL_AtomicInitState init; * * bool InitSystem(void) * { * if (!SDL_ShouldInit(&init)) { * // The system is initialized * return true; * } * * // At this point, you should not leave this function without calling SDL_SetInitialized() * * bool initialized = DoInitTasks(); * SDL_SetInitialized(&init, initialized); * return initialized; * } * * bool UseSubsystem(void) * { * if (SDL_ShouldInit(&init)) { * // Error, the subsystem isn't initialized * SDL_SetInitialized(&init, false); * return false; * } * * // Do work using the initialized subsystem * * return true; * } * * void QuitSystem(void) * { * if (!SDL_ShouldQuit(&init)) { * // The system is not initialized * return; * } * * // At this point, you should not leave this function without calling SDL_SetInitialized() * * DoQuitTasks(); * SDL_SetInitialized(&init, false); * } * ``` * * Note that this doesn't protect any resources created during initialization, * or guarantee that nobody is using those resources during cleanup. You * should use other mechanisms to protect those, if that's a concern for your * code. * * \since This struct is available since SDL 3.2.0. */ SDL_InitState :: struct { status: SDL_AtomicInt; thread: SDL_ThreadID; reserved: *void; } /** * Return whether initialization should be done. * * This function checks the passed in state and if initialization should be * done, sets the status to `SDL_INIT_STATUS_INITIALIZING` and returns true. * If another thread is already modifying this state, it will wait until * that's done before returning. * * If this function returns true, the calling code must call * SDL_SetInitialized() to complete the initialization. * * \param state the initialization state to check. * \returns true if initialization needs to be done, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetInitialized * \sa SDL_ShouldQuit */ SDL_ShouldInit :: (state: *SDL_InitState) -> bool #foreign libsdl3; /** * Return whether cleanup should be done. * * This function checks the passed in state and if cleanup should be done, * sets the status to `SDL_INIT_STATUS_UNINITIALIZING` and returns true. * * If this function returns true, the calling code must call * SDL_SetInitialized() to complete the cleanup. * * \param state the initialization state to check. * \returns true if cleanup needs to be done, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetInitialized * \sa SDL_ShouldInit */ SDL_ShouldQuit :: (state: *SDL_InitState) -> bool #foreign libsdl3; /** * Finish an initialization state transition. * * This function sets the status of the passed in state to * `SDL_INIT_STATUS_INITIALIZED` or `SDL_INIT_STATUS_UNINITIALIZED` and allows * any threads waiting for the status to proceed. * * \param state the initialization state to check. * \param initialized the new initialization state. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ShouldInit * \sa SDL_ShouldQuit */ SDL_SetInitialized :: (state: *SDL_InitState, initialized: bool) -> void #foreign libsdl3; /** * SDL_IOStream status, set by a read or write operation. * * \since This enum is available since SDL 3.2.0. */ using SDL_IOStatus :: enum u32 { SDL_IO_STATUS_READY :: 0; SDL_IO_STATUS_ERROR :: 1; SDL_IO_STATUS_EOF :: 2; SDL_IO_STATUS_NOT_READY :: 3; SDL_IO_STATUS_READONLY :: 4; SDL_IO_STATUS_WRITEONLY :: 5; } /** * Possible `whence` values for SDL_IOStream seeking. * * These map to the same "whence" concept that `fseek` or `lseek` use in the * standard C runtime. * * \since This enum is available since SDL 3.2.0. */ using SDL_IOWhence :: enum u32 { SDL_IO_SEEK_SET :: 0; SDL_IO_SEEK_CUR :: 1; SDL_IO_SEEK_END :: 2; } /** * The function pointers that drive an SDL_IOStream. * * Applications can provide this struct to SDL_OpenIO() to create their own * implementation of SDL_IOStream. This is not necessarily required, as SDL * already offers several common types of I/O streams, via functions like * SDL_IOFromFile() and SDL_IOFromMem(). * * This structure should be initialized using SDL_INIT_INTERFACE() * * \since This struct is available since SDL 3.2.0. * * \sa SDL_INIT_INTERFACE */ SDL_IOStreamInterface :: struct { /* The version of this interface */ version: Uint32; /** * Return the number of bytes in this SDL_IOStream * * \return the total size of the data stream, or -1 on error. */ size: #type (userdata: *void) -> Sint64 #c_call; /** * Seek to `offset` relative to `whence`, one of stdio's whence values: * SDL_IO_SEEK_SET, SDL_IO_SEEK_CUR, SDL_IO_SEEK_END * * \return the final offset in the data stream, or -1 on error. */ seek: #type (userdata: *void, offset: Sint64, whence: SDL_IOWhence) -> Sint64 #c_call; /** * Read up to `size` bytes from the data stream to the area pointed * at by `ptr`. * * On an incomplete read, you should set `*status` to a value from the * SDL_IOStatus enum. You do not have to explicitly set this on * a complete, successful read. * * \return the number of bytes read */ read: #type (userdata: *void, ptr: *void, size: u64, status: *SDL_IOStatus) -> u64 #c_call; /** * Write exactly `size` bytes from the area pointed at by `ptr` * to data stream. * * On an incomplete write, you should set `*status` to a value from the * SDL_IOStatus enum. You do not have to explicitly set this on * a complete, successful write. * * \return the number of bytes written */ write: #type (userdata: *void, ptr: *void, size: u64, status: *SDL_IOStatus) -> u64 #c_call; /** * If the stream is buffering, make sure the data is written out. * * On failure, you should set `*status` to a value from the * SDL_IOStatus enum. You do not have to explicitly set this on * a successful flush. * * \return true if successful or false on write error when flushing data. */ flush: #type (userdata: *void, status: *SDL_IOStatus) -> bool #c_call; /** * Close and free any allocated resources. * * This does not guarantee file writes will sync to physical media; they * can be in the system's file cache, waiting to go to disk. * * The SDL_IOStream is still destroyed even if this fails, so clean up anything * even if flushing buffers, etc, returns an error. * * \return true if successful or false on write error when flushing data. */ close: #type (userdata: *void) -> bool #c_call; } SDL_IOStream :: struct {} /** * Use this function to create a new SDL_IOStream structure for reading from * and/or writing to a named file. * * The `mode` string is treated roughly the same as in a call to the C * library's fopen(), even if SDL doesn't happen to use fopen() behind the * scenes. * * Available `mode` strings: * * - "r": Open a file for reading. The file must exist. * - "w": Create an empty file for writing. If a file with the same name * already exists its content is erased and the file is treated as a new * empty file. * - "a": Append to a file. Writing operations append data at the end of the * file. The file is created if it does not exist. * - "r+": Open a file for update both reading and writing. The file must * exist. * - "w+": Create an empty file for both reading and writing. If a file with * the same name already exists its content is erased and the file is * treated as a new empty file. * - "a+": Open a file for reading and appending. All writing operations are * performed at the end of the file, protecting the previous content to be * overwritten. You can reposition (fseek, rewind) the internal pointer to * anywhere in the file for reading, but writing operations will move it * back to the end of file. The file is created if it does not exist. * * **NOTE**: In order to open a file as a binary file, a "b" character has to * be included in the `mode` string. This additional "b" character can either * be appended at the end of the string (thus making the following compound * modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the * letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+"). * Additional characters may follow the sequence, although they should have no * effect. For example, "t" is sometimes appended to make explicit the file is * a text file. * * This function supports Unicode filenames, but they must be encoded in UTF-8 * format, regardless of the underlying operating system. * * In Android, SDL_IOFromFile() can be used to open content:// URIs. As a * fallback, SDL_IOFromFile() will transparently open a matching filename in * the app's `assets`. * * Closing the SDL_IOStream will close SDL's internal file handle. * * The following properties may be set at creation time by SDL: * * - `SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER`: a pointer, that can be cast * to a win32 `HANDLE`, that this SDL_IOStream is using to access the * filesystem. If the program isn't running on Windows, or SDL used some * other method to access the filesystem, this property will not be set. * - `SDL_PROP_IOSTREAM_STDIO_FILE_POINTER`: a pointer, that can be cast to a * stdio `FILE *`, that this SDL_IOStream is using to access the filesystem. * If SDL used some other method to access the filesystem, this property * will not be set. PLEASE NOTE that if SDL is using a different C runtime * than your app, trying to use this pointer will almost certainly result in * a crash! This is mostly a problem on Windows; make sure you build SDL and * your app with the same compiler and settings to avoid it. * - `SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER`: a file descriptor that this * SDL_IOStream is using to access the filesystem. * - `SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER`: a pointer, that can be cast * to an Android NDK `AAsset *`, that this SDL_IOStream is using to access * the filesystem. If SDL used some other method to access the filesystem, * this property will not be set. * * \param file a UTF-8 string representing the filename to open. * \param mode an ASCII string representing the mode to be used for opening * the file. * \returns a pointer to the SDL_IOStream structure that is created or NULL on * failure; call SDL_GetError() for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseIO * \sa SDL_FlushIO * \sa SDL_ReadIO * \sa SDL_SeekIO * \sa SDL_TellIO * \sa SDL_WriteIO */ SDL_IOFromFile :: (file: *u8, mode: *u8) -> *SDL_IOStream #foreign libsdl3; /** * Use this function to prepare a read-write memory buffer for use with * SDL_IOStream. * * This function sets up an SDL_IOStream struct based on a memory area of a * certain size, for both read and write access. * * This memory buffer is not copied by the SDL_IOStream; the pointer you * provide must remain valid until you close the stream. Closing the stream * will not free the original buffer. * * If you need to make sure the SDL_IOStream never writes to the memory * buffer, you should use SDL_IOFromConstMem() with a read-only buffer of * memory instead. * * The following properties will be set at creation time by SDL: * * - `SDL_PROP_IOSTREAM_MEMORY_POINTER`: this will be the `mem` parameter that * was passed to this function. * - `SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER`: this will be the `size` parameter * that was passed to this function. * * \param mem a pointer to a buffer to feed an SDL_IOStream stream. * \param size the buffer size, in bytes. * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_IOFromConstMem * \sa SDL_CloseIO * \sa SDL_FlushIO * \sa SDL_ReadIO * \sa SDL_SeekIO * \sa SDL_TellIO * \sa SDL_WriteIO */ SDL_IOFromMem :: (mem: *void, size: u64) -> *SDL_IOStream #foreign libsdl3; /** * Use this function to prepare a read-only memory buffer for use with * SDL_IOStream. * * This function sets up an SDL_IOStream struct based on a memory area of a * certain size. It assumes the memory area is not writable. * * Attempting to write to this SDL_IOStream stream will report an error * without writing to the memory buffer. * * This memory buffer is not copied by the SDL_IOStream; the pointer you * provide must remain valid until you close the stream. Closing the stream * will not free the original buffer. * * If you need to write to a memory buffer, you should use SDL_IOFromMem() * with a writable buffer of memory instead. * * The following properties will be set at creation time by SDL: * * - `SDL_PROP_IOSTREAM_MEMORY_POINTER`: this will be the `mem` parameter that * was passed to this function. * - `SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER`: this will be the `size` parameter * that was passed to this function. * * \param mem a pointer to a read-only buffer to feed an SDL_IOStream stream. * \param size the buffer size, in bytes. * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_IOFromMem * \sa SDL_CloseIO * \sa SDL_ReadIO * \sa SDL_SeekIO * \sa SDL_TellIO */ SDL_IOFromConstMem :: (mem: *void, size: u64) -> *SDL_IOStream #foreign libsdl3; /** * Use this function to create an SDL_IOStream that is backed by dynamically * allocated memory. * * This supports the following properties to provide access to the memory and * control over allocations: * * - `SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER`: a pointer to the internal * memory of the stream. This can be set to NULL to transfer ownership of * the memory to the application, which should free the memory with * SDL_free(). If this is done, the next operation on the stream must be * SDL_CloseIO(). * - `SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER`: memory will be allocated in * multiples of this size, defaulting to 1024. * * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseIO * \sa SDL_ReadIO * \sa SDL_SeekIO * \sa SDL_TellIO * \sa SDL_WriteIO */ SDL_IOFromDynamicMem :: () -> *SDL_IOStream #foreign libsdl3; /** * Create a custom SDL_IOStream. * * Applications do not need to use this function unless they are providing * their own SDL_IOStream implementation. If you just need an SDL_IOStream to * read/write a common data source, you should use the built-in * implementations in SDL, like SDL_IOFromFile() or SDL_IOFromMem(), etc. * * This function makes a copy of `iface` and the caller does not need to keep * it around after this call. * * \param iface the interface that implements this SDL_IOStream, initialized * using SDL_INIT_INTERFACE(). * \param userdata the pointer that will be passed to the interface functions. * \returns a pointer to the allocated memory on success or NULL on failure; * call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseIO * \sa SDL_INIT_INTERFACE * \sa SDL_IOFromConstMem * \sa SDL_IOFromFile * \sa SDL_IOFromMem */ SDL_OpenIO :: (iface: *SDL_IOStreamInterface, userdata: *void) -> *SDL_IOStream #foreign libsdl3; /** * Close and free an allocated SDL_IOStream structure. * * SDL_CloseIO() closes and cleans up the SDL_IOStream stream. It releases any * resources used by the stream and frees the SDL_IOStream itself. This * returns true on success, or false if the stream failed to flush to its * output (e.g. to disk). * * Note that if this fails to flush the stream for any reason, this function * reports an error, but the SDL_IOStream is still invalid once this function * returns. * * This call flushes any buffered writes to the operating system, but there * are no guarantees that those writes have gone to physical media; they might * be in the OS's file cache, waiting to go to disk later. If it's absolutely * crucial that writes go to disk immediately, so they are definitely stored * even if the power fails before the file cache would have caught up, one * should call SDL_FlushIO() before closing. Note that flushing takes time and * makes the system and your app operate less efficiently, so do so sparingly. * * \param context SDL_IOStream structure to close. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenIO */ SDL_CloseIO :: (_context: *SDL_IOStream) -> bool #foreign libsdl3; /** * Get the properties associated with an SDL_IOStream. * * \param context a pointer to an SDL_IOStream structure. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_GetIOProperties :: (_context: *SDL_IOStream) -> SDL_PropertiesID #foreign libsdl3; /** * Query the stream status of an SDL_IOStream. * * This information can be useful to decide if a short read or write was due * to an error, an EOF, or a non-blocking operation that isn't yet ready to * complete. * * An SDL_IOStream's status is only expected to change after a SDL_ReadIO or * SDL_WriteIO call; don't expect it to change if you just call this query * function in a tight loop. * * \param context the SDL_IOStream to query. * \returns an SDL_IOStatus enum with the current state. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_GetIOStatus :: (_context: *SDL_IOStream) -> SDL_IOStatus #foreign libsdl3; /** * Use this function to get the size of the data stream in an SDL_IOStream. * * \param context the SDL_IOStream to get the size of the data stream from. * \returns the size of the data stream in the SDL_IOStream on success or a * negative error code on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_GetIOSize :: (_context: *SDL_IOStream) -> Sint64 #foreign libsdl3; /** * Seek within an SDL_IOStream data stream. * * This function seeks to byte `offset`, relative to `whence`. * * `whence` may be any of the following values: * * - `SDL_IO_SEEK_SET`: seek from the beginning of data * - `SDL_IO_SEEK_CUR`: seek relative to current read point * - `SDL_IO_SEEK_END`: seek relative to the end of data * * If this stream can not seek, it will return -1. * * \param context a pointer to an SDL_IOStream structure. * \param offset an offset in bytes, relative to `whence` location; can be * negative. * \param whence any of `SDL_IO_SEEK_SET`, `SDL_IO_SEEK_CUR`, * `SDL_IO_SEEK_END`. * \returns the final offset in the data stream after the seek or -1 on * failure; call SDL_GetError() for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_TellIO */ SDL_SeekIO :: (_context: *SDL_IOStream, offset: Sint64, whence: SDL_IOWhence) -> Sint64 #foreign libsdl3; /** * Determine the current read/write offset in an SDL_IOStream data stream. * * SDL_TellIO is actually a wrapper function that calls the SDL_IOStream's * `seek` method, with an offset of 0 bytes from `SDL_IO_SEEK_CUR`, to * simplify application development. * * \param context an SDL_IOStream data stream object from which to get the * current offset. * \returns the current offset in the stream, or -1 if the information can not * be determined. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SeekIO */ SDL_TellIO :: (_context: *SDL_IOStream) -> Sint64 #foreign libsdl3; /** * Read from a data source. * * This function reads up `size` bytes from the data source to the area * pointed at by `ptr`. This function may read less bytes than requested. * * This function will return zero when the data stream is completely read, and * SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If zero is returned and * the stream is not at EOF, SDL_GetIOStatus() will return a different error * value and SDL_GetError() will offer a human-readable message. * * \param context a pointer to an SDL_IOStream structure. * \param ptr a pointer to a buffer to read data into. * \param size the number of bytes to read from the data source. * \returns the number of bytes read, or 0 on end of file or other failure; * call SDL_GetError() for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WriteIO * \sa SDL_GetIOStatus */ SDL_ReadIO :: (_context: *SDL_IOStream, ptr: *void, size: u64) -> u64 #foreign libsdl3; /** * Write to an SDL_IOStream data stream. * * This function writes exactly `size` bytes from the area pointed at by `ptr` * to the stream. If this fails for any reason, it'll return less than `size` * to demonstrate how far the write progressed. On success, it returns `size`. * * On error, this function still attempts to write as much as possible, so it * might return a positive value less than the requested write size. * * The caller can use SDL_GetIOStatus() to determine if the problem is * recoverable, such as a non-blocking write that can simply be retried later, * or a fatal error. * * \param context a pointer to an SDL_IOStream structure. * \param ptr a pointer to a buffer containing data to write. * \param size the number of bytes to write. * \returns the number of bytes written, which will be less than `size` on * failure; call SDL_GetError() for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_IOprintf * \sa SDL_ReadIO * \sa SDL_SeekIO * \sa SDL_FlushIO * \sa SDL_GetIOStatus */ SDL_WriteIO :: (_context: *SDL_IOStream, ptr: *void, size: u64) -> u64 #foreign libsdl3; /** * Print to an SDL_IOStream data stream. * * This function does formatted printing to the stream. * * \param context a pointer to an SDL_IOStream structure. * \param fmt a printf() style format string. * \param ... additional parameters matching % tokens in the `fmt` string, if * any. * \returns the number of bytes written or 0 on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_IOvprintf * \sa SDL_WriteIO */ SDL_IOprintf_CFormat :: (_context: *SDL_IOStream, fmt: *u8, __args: ..Any) -> u64 #foreign libsdl3 "SDL_IOprintf"; SDL_IOprintf :: (_context: *SDL_IOStream, fmt: string, __args: ..Any) -> u64 { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); return SDL_IOprintf_CFormat(_context, "%s", formatted_text.data); } @PrintLike /** * Flush any buffered data in the stream. * * This function makes sure that any buffered data is written to the stream. * Normally this isn't necessary but if the stream is a pipe or socket it * guarantees that any pending data is sent. * * \param context SDL_IOStream structure to flush. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenIO * \sa SDL_WriteIO */ SDL_FlushIO :: (_context: *SDL_IOStream) -> bool #foreign libsdl3; /** * Load all the data from an SDL data stream. * * The data is allocated with a zero byte at the end (null terminated) for * convenience. This extra byte is not included in the value reported via * `datasize`. * * The data should be freed with SDL_free(). * * \param src the SDL_IOStream to read all available data from. * \param datasize a pointer filled in with the number of bytes read, may be * NULL. * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even * in the case of an error. * \returns the data or NULL on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadFile * \sa SDL_SaveFile_IO */ SDL_LoadFile_IO :: (src: *SDL_IOStream, datasize: *u64, closeio: bool) -> *void #foreign libsdl3; /** * Load all the data from a file path. * * The data is allocated with a zero byte at the end (null terminated) for * convenience. This extra byte is not included in the value reported via * `datasize`. * * The data should be freed with SDL_free(). * * \param file the path to read all available data from. * \param datasize if not NULL, will store the number of bytes read. * \returns the data or NULL on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadFile_IO * \sa SDL_SaveFile */ SDL_LoadFile :: (file: *u8, datasize: *u64) -> *void #foreign libsdl3; /** * Save all the data into an SDL data stream. * * \param src the SDL_IOStream to write all data to. * \param data the data to be written. If datasize is 0, may be NULL or a * invalid pointer. * \param datasize the number of bytes to be written. * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even * in the case of an error. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SaveFile * \sa SDL_LoadFile_IO */ SDL_SaveFile_IO :: (src: *SDL_IOStream, data: *void, datasize: u64, closeio: bool) -> bool #foreign libsdl3; /** * Save all the data into a file path. * * \param file the path to write all available data into. * \param data the data to be written. If datasize is 0, may be NULL or a * invalid pointer. * \param datasize the number of bytes to be written. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SaveFile_IO * \sa SDL_LoadFile */ SDL_SaveFile :: (file: *u8, data: *void, datasize: u64) -> bool #foreign libsdl3; /** * Use this function to read a byte from an SDL_IOStream. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the SDL_IOStream to read from. * \param value a pointer filled in with the data read. * \returns true on success or false on failure or EOF; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadU8 :: (src: *SDL_IOStream, value: *Uint8) -> bool #foreign libsdl3; /** * Use this function to read a signed byte from an SDL_IOStream. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the SDL_IOStream to read from. * \param value a pointer filled in with the data read. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadS8 :: (src: *SDL_IOStream, value: *Sint8) -> bool #foreign libsdl3; /** * Use this function to read 16 bits of little-endian data from an * SDL_IOStream and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadU16LE :: (src: *SDL_IOStream, value: *Uint16) -> bool #foreign libsdl3; /** * Use this function to read 16 bits of little-endian data from an * SDL_IOStream and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadS16LE :: (src: *SDL_IOStream, value: *Sint16) -> bool #foreign libsdl3; /** * Use this function to read 16 bits of big-endian data from an SDL_IOStream * and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadU16BE :: (src: *SDL_IOStream, value: *Uint16) -> bool #foreign libsdl3; /** * Use this function to read 16 bits of big-endian data from an SDL_IOStream * and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadS16BE :: (src: *SDL_IOStream, value: *Sint16) -> bool #foreign libsdl3; /** * Use this function to read 32 bits of little-endian data from an * SDL_IOStream and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadU32LE :: (src: *SDL_IOStream, value: *Uint32) -> bool #foreign libsdl3; /** * Use this function to read 32 bits of little-endian data from an * SDL_IOStream and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadS32LE :: (src: *SDL_IOStream, value: *Sint32) -> bool #foreign libsdl3; /** * Use this function to read 32 bits of big-endian data from an SDL_IOStream * and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadU32BE :: (src: *SDL_IOStream, value: *Uint32) -> bool #foreign libsdl3; /** * Use this function to read 32 bits of big-endian data from an SDL_IOStream * and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadS32BE :: (src: *SDL_IOStream, value: *Sint32) -> bool #foreign libsdl3; /** * Use this function to read 64 bits of little-endian data from an * SDL_IOStream and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadU64LE :: (src: *SDL_IOStream, value: *Uint64) -> bool #foreign libsdl3; /** * Use this function to read 64 bits of little-endian data from an * SDL_IOStream and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadS64LE :: (src: *SDL_IOStream, value: *Sint64) -> bool #foreign libsdl3; /** * Use this function to read 64 bits of big-endian data from an SDL_IOStream * and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadU64BE :: (src: *SDL_IOStream, value: *Uint64) -> bool #foreign libsdl3; /** * Use this function to read 64 bits of big-endian data from an SDL_IOStream * and return in native format. * * SDL byteswaps the data only if necessary, so the data returned will be in * the native byte order. * * This function will return false when the data stream is completely read, * and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned * and the stream is not at EOF, SDL_GetIOStatus() will return a different * error value and SDL_GetError() will offer a human-readable message. * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_ReadS64BE :: (src: *SDL_IOStream, value: *Sint64) -> bool #foreign libsdl3; /** * Use this function to write a byte to an SDL_IOStream. * * \param dst the SDL_IOStream to write to. * \param value the byte value to write. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteU8 :: (dst: *SDL_IOStream, value: Uint8) -> bool #foreign libsdl3; /** * Use this function to write a signed byte to an SDL_IOStream. * * \param dst the SDL_IOStream to write to. * \param value the byte value to write. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteS8 :: (dst: *SDL_IOStream, value: Sint8) -> bool #foreign libsdl3; /** * Use this function to write 16 bits in native format to an SDL_IOStream as * little-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in little-endian * format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteU16LE :: (dst: *SDL_IOStream, value: Uint16) -> bool #foreign libsdl3; /** * Use this function to write 16 bits in native format to an SDL_IOStream as * little-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in little-endian * format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteS16LE :: (dst: *SDL_IOStream, value: Sint16) -> bool #foreign libsdl3; /** * Use this function to write 16 bits in native format to an SDL_IOStream as * big-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in big-endian format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteU16BE :: (dst: *SDL_IOStream, value: Uint16) -> bool #foreign libsdl3; /** * Use this function to write 16 bits in native format to an SDL_IOStream as * big-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in big-endian format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteS16BE :: (dst: *SDL_IOStream, value: Sint16) -> bool #foreign libsdl3; /** * Use this function to write 32 bits in native format to an SDL_IOStream as * little-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in little-endian * format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteU32LE :: (dst: *SDL_IOStream, value: Uint32) -> bool #foreign libsdl3; /** * Use this function to write 32 bits in native format to an SDL_IOStream as * little-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in little-endian * format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteS32LE :: (dst: *SDL_IOStream, value: Sint32) -> bool #foreign libsdl3; /** * Use this function to write 32 bits in native format to an SDL_IOStream as * big-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in big-endian format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteU32BE :: (dst: *SDL_IOStream, value: Uint32) -> bool #foreign libsdl3; /** * Use this function to write 32 bits in native format to an SDL_IOStream as * big-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in big-endian format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteS32BE :: (dst: *SDL_IOStream, value: Sint32) -> bool #foreign libsdl3; /** * Use this function to write 64 bits in native format to an SDL_IOStream as * little-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in little-endian * format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteU64LE :: (dst: *SDL_IOStream, value: Uint64) -> bool #foreign libsdl3; /** * Use this function to write 64 bits in native format to an SDL_IOStream as * little-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in little-endian * format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteS64LE :: (dst: *SDL_IOStream, value: Sint64) -> bool #foreign libsdl3; /** * Use this function to write 64 bits in native format to an SDL_IOStream as * big-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in big-endian format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteU64BE :: (dst: *SDL_IOStream, value: Uint64) -> bool #foreign libsdl3; /** * Use this function to write 64 bits in native format to an SDL_IOStream as * big-endian data. * * SDL byteswaps the data only if necessary, so the application always * specifies native format, and the data written will be in big-endian format. * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. */ SDL_WriteS64BE :: (dst: *SDL_IOStream, value: Sint64) -> bool #foreign libsdl3; /** * Audio format. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_AUDIO_BITSIZE * \sa SDL_AUDIO_BYTESIZE * \sa SDL_AUDIO_ISINT * \sa SDL_AUDIO_ISFLOAT * \sa SDL_AUDIO_ISBIGENDIAN * \sa SDL_AUDIO_ISLITTLEENDIAN * \sa SDL_AUDIO_ISSIGNED * \sa SDL_AUDIO_ISUNSIGNED */ using SDL_AudioFormat :: enum u32 { SDL_AUDIO_UNKNOWN :: 0; SDL_AUDIO_U8 :: 8; SDL_AUDIO_S8 :: 32776; SDL_AUDIO_S16LE :: 32784; SDL_AUDIO_S16BE :: 36880; SDL_AUDIO_S32LE :: 32800; SDL_AUDIO_S32BE :: 36896; SDL_AUDIO_F32LE :: 33056; SDL_AUDIO_F32BE :: 37152; SDL_AUDIO_S16 :: 32784; SDL_AUDIO_S32 :: 32800; SDL_AUDIO_F32 :: 33056; } /** * SDL Audio Device instance IDs. * * Zero is used to signify an invalid/null device. * * \since This datatype is available since SDL 3.2.0. */ SDL_AudioDeviceID :: Uint32; /** * Format specifier for audio data. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_AudioFormat */ SDL_AudioSpec :: struct { format: SDL_AudioFormat; /**< Audio data format */ channels: s32; /**< Number of channels: 1 mono, 2 stereo, etc */ freq: s32; /**< sample rate: sample frames per second */ } SDL_AudioStream :: struct {} /** * Use this function to get the number of built-in audio drivers. * * This function returns a hardcoded number. This never returns a negative * value; if there are no drivers compiled into this build of SDL, this * function returns zero. The presence of a driver in this list does not mean * it will function, it just means SDL is capable of interacting with that * interface. For example, a build of SDL might have esound support, but if * there's no esound server available, SDL's esound driver would fail if used. * * By default, SDL tries all drivers, in its preferred order, until one is * found to be usable. * * \returns the number of built-in audio drivers. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioDriver */ SDL_GetNumAudioDrivers :: () -> s32 #foreign libsdl3; /** * Use this function to get the name of a built in audio driver. * * The list of audio drivers is given in the order that they are normally * initialized by default; the drivers that seem more reasonable to choose * first (as far as the SDL developers believe) are earlier in the list. * * The names of drivers are all simple, low-ASCII identifiers, like "alsa", * "coreaudio" or "wasapi". These never have Unicode characters, and are not * meant to be proper names. * * \param index the index of the audio driver; the value ranges from 0 to * SDL_GetNumAudioDrivers() - 1. * \returns the name of the audio driver at the requested index, or NULL if an * invalid index was specified. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumAudioDrivers */ SDL_GetAudioDriver :: (index: s32) -> *u8 #foreign libsdl3; /** * Get the name of the current audio driver. * * The names of drivers are all simple, low-ASCII identifiers, like "alsa", * "coreaudio" or "wasapi". These never have Unicode characters, and are not * meant to be proper names. * * \returns the name of the current audio driver or NULL if no driver has been * initialized. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetCurrentAudioDriver :: () -> *u8 #foreign libsdl3; /** * Get a list of currently-connected audio playback devices. * * This returns of list of available devices that play sound, perhaps to * speakers or headphones ("playback" devices). If you want devices that * record audio, like a microphone ("recording" devices), use * SDL_GetAudioRecordingDevices() instead. * * This only returns a list of physical devices; it will not have any device * IDs returned by SDL_OpenAudioDevice(). * * If this function returns NULL, to signify an error, `*count` will be set to * zero. * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs or NULL on error; call * SDL_GetError() for more information. This should be freed with * SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioRecordingDevices */ SDL_GetAudioPlaybackDevices :: (count: *s32) -> *SDL_AudioDeviceID #foreign libsdl3; /** * Get a list of currently-connected audio recording devices. * * This returns of list of available devices that record audio, like a * microphone ("recording" devices). If you want devices that play sound, * perhaps to speakers or headphones ("playback" devices), use * SDL_GetAudioPlaybackDevices() instead. * * This only returns a list of physical devices; it will not have any device * IDs returned by SDL_OpenAudioDevice(). * * If this function returns NULL, to signify an error, `*count` will be set to * zero. * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs, or NULL on failure; * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioPlaybackDevices */ SDL_GetAudioRecordingDevices :: (count: *s32) -> *SDL_AudioDeviceID #foreign libsdl3; /** * Get the human-readable name of a specific audio device. * * \param devid the instance ID of the device to query. * \returns the name of the audio device, or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioPlaybackDevices * \sa SDL_GetAudioRecordingDevices */ SDL_GetAudioDeviceName :: (devid: SDL_AudioDeviceID) -> *u8 #foreign libsdl3; /** * Get the current audio format of a specific audio device. * * For an opened device, this will report the format the device is currently * using. If the device isn't yet opened, this will report the device's * preferred format (or a reasonable default if this can't be determined). * * You may also specify SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK or * SDL_AUDIO_DEVICE_DEFAULT_RECORDING here, which is useful for getting a * reasonable recommendation before opening the system-recommended default * device. * * You can also use this to request the current device buffer size. This is * specified in sample frames and represents the amount of data SDL will feed * to the physical hardware in each chunk. This can be converted to * milliseconds of audio with the following equation: * * `ms = (int) ((((Sint64) frames) * 1000) / spec.freq);` * * Buffer size is only important if you need low-level control over the audio * playback timing. Most apps do not need this. * * \param devid the instance ID of the device to query. * \param spec on return, will be filled with device details. * \param sample_frames pointer to store device buffer size, in sample frames. * Can be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetAudioDeviceFormat :: (devid: SDL_AudioDeviceID, spec: *SDL_AudioSpec, sample_frames: *s32) -> bool #foreign libsdl3; /** * Get the current channel map of an audio device. * * Channel maps are optional; most things do not need them, instead passing * data in the [order that SDL expects](CategoryAudio#channel-layouts). * * Audio devices usually have no remapping applied. This is represented by * returning NULL, and does not signify an error. * * \param devid the instance ID of the device to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as * the current output spec's channels, or NULL if default. This * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ SDL_GetAudioDeviceChannelMap :: (devid: SDL_AudioDeviceID, count: *s32) -> *s32 #foreign libsdl3; /** * Open a specific audio device. * * You can open both playback and recording devices through this function. * Playback devices will take data from bound audio streams, mix it, and send * it to the hardware. Recording devices will feed any bound audio streams * with a copy of any incoming data. * * An opened audio device starts out with no audio streams bound. To start * audio playing, bind a stream and supply audio data to it. Unlike SDL2, * there is no audio callback; you only bind audio streams and make sure they * have data flowing into them (however, you can simulate SDL2's semantics * fairly closely by using SDL_OpenAudioDeviceStream instead of this * function). * * If you don't care about opening a specific device, pass a `devid` of either * `SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK` or * `SDL_AUDIO_DEVICE_DEFAULT_RECORDING`. In this case, SDL will try to pick * the most reasonable default, and may also switch between physical devices * seamlessly later, if the most reasonable default changes during the * lifetime of this opened device (user changed the default in the OS's system * preferences, the default got unplugged so the system jumped to a new * default, the user plugged in headphones on a mobile device, etc). Unless * you have a good reason to choose a specific device, this is probably what * you want. * * You may request a specific format for the audio device, but there is no * promise the device will honor that request for several reasons. As such, * it's only meant to be a hint as to what data your app will provide. Audio * streams will accept data in whatever format you specify and manage * conversion for you as appropriate. SDL_GetAudioDeviceFormat can tell you * the preferred format for the device before opening and the actual format * the device is using after opening. * * It's legal to open the same device ID more than once; each successful open * will generate a new logical SDL_AudioDeviceID that is managed separately * from others on the same physical device. This allows libraries to open a * device separately from the main app and bind its own streams without * conflicting. * * It is also legal to open a device ID returned by a previous call to this * function; doing so just creates another logical device on the same physical * device. This may be useful for making logical groupings of audio streams. * * This function returns the opened device ID on success. This is a new, * unique SDL_AudioDeviceID that represents a logical device. * * Some backends might offer arbitrary devices (for example, a networked audio * protocol that can connect to an arbitrary server). For these, as a change * from SDL2, you should open a default device ID and use an SDL hint to * specify the target if you care, or otherwise let the backend figure out a * reasonable default. Most backends don't offer anything like this, and often * this would be an end user setting an environment variable for their custom * need, and not something an application should specifically manage. * * When done with an audio device, possibly at the end of the app's life, one * should call SDL_CloseAudioDevice() on the returned device id. * * \param devid the device instance id to open, or * SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK or * SDL_AUDIO_DEVICE_DEFAULT_RECORDING for the most reasonable * default device. * \param spec the requested device configuration. Can be NULL to use * reasonable defaults. * \returns the device ID on success or 0 on failure; call SDL_GetError() for * more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseAudioDevice * \sa SDL_GetAudioDeviceFormat */ SDL_OpenAudioDevice :: (devid: SDL_AudioDeviceID, spec: *SDL_AudioSpec) -> SDL_AudioDeviceID #foreign libsdl3; /** * Determine if an audio device is physical (instead of logical). * * An SDL_AudioDeviceID that represents physical hardware is a physical * device; there is one for each piece of hardware that SDL can see. Logical * devices are created by calling SDL_OpenAudioDevice or * SDL_OpenAudioDeviceStream, and while each is associated with a physical * device, there can be any number of logical devices on one physical device. * * For the most part, logical and physical IDs are interchangeable--if you try * to open a logical device, SDL understands to assign that effort to the * underlying physical device, etc. However, it might be useful to know if an * arbitrary device ID is physical or logical. This function reports which. * * This function may return either true or false for invalid device IDs. * * \param devid the device ID to query. * \returns true if devid is a physical device, false if it is logical. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_IsAudioDevicePhysical :: (devid: SDL_AudioDeviceID) -> bool #foreign libsdl3; /** * Determine if an audio device is a playback device (instead of recording). * * This function may return either true or false for invalid device IDs. * * \param devid the device ID to query. * \returns true if devid is a playback device, false if it is recording. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_IsAudioDevicePlayback :: (devid: SDL_AudioDeviceID) -> bool #foreign libsdl3; /** * Use this function to pause audio playback on a specified device. * * This function pauses audio processing for a given device. Any bound audio * streams will not progress, and no audio will be generated. Pausing one * device does not prevent other unpaused devices from running. * * Unlike in SDL2, audio devices start in an _unpaused_ state, since an app * has to bind a stream before any audio will flow. Pausing a paused device is * a legal no-op. * * Pausing a device can be useful to halt all audio without unbinding all the * audio streams. This might be useful while a game is paused, or a level is * loading, etc. * * Physical devices can not be paused or unpaused, only logical devices * created through SDL_OpenAudioDevice() can be. * * \param dev a device opened by SDL_OpenAudioDevice(). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ResumeAudioDevice * \sa SDL_AudioDevicePaused */ SDL_PauseAudioDevice :: (dev: SDL_AudioDeviceID) -> bool #foreign libsdl3; /** * Use this function to unpause audio playback on a specified device. * * This function unpauses audio processing for a given device that has * previously been paused with SDL_PauseAudioDevice(). Once unpaused, any * bound audio streams will begin to progress again, and audio can be * generated. * * Unlike in SDL2, audio devices start in an _unpaused_ state, since an app * has to bind a stream before any audio will flow. Unpausing an unpaused * device is a legal no-op. * * Physical devices can not be paused or unpaused, only logical devices * created through SDL_OpenAudioDevice() can be. * * \param dev a device opened by SDL_OpenAudioDevice(). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AudioDevicePaused * \sa SDL_PauseAudioDevice */ SDL_ResumeAudioDevice :: (dev: SDL_AudioDeviceID) -> bool #foreign libsdl3; /** * Use this function to query if an audio device is paused. * * Unlike in SDL2, audio devices start in an _unpaused_ state, since an app * has to bind a stream before any audio will flow. * * Physical devices can not be paused or unpaused, only logical devices * created through SDL_OpenAudioDevice() can be. Physical and invalid device * IDs will report themselves as unpaused here. * * \param dev a device opened by SDL_OpenAudioDevice(). * \returns true if device is valid and paused, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PauseAudioDevice * \sa SDL_ResumeAudioDevice */ SDL_AudioDevicePaused :: (dev: SDL_AudioDeviceID) -> bool #foreign libsdl3; /** * Get the gain of an audio device. * * The gain of a device is its volume; a larger gain means a louder output, * with a gain of zero being silence. * * Audio devices default to a gain of 1.0f (no change in output). * * Physical devices may not have their gain changed, only logical devices, and * this function will always return -1.0f when used on physical devices. * * \param devid the audio device to query. * \returns the gain of the device or -1.0f on failure; call SDL_GetError() * for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioDeviceGain */ SDL_GetAudioDeviceGain :: (devid: SDL_AudioDeviceID) -> float #foreign libsdl3; /** * Change the gain of an audio device. * * The gain of a device is its volume; a larger gain means a louder output, * with a gain of zero being silence. * * Audio devices default to a gain of 1.0f (no change in output). * * Physical devices may not have their gain changed, only logical devices, and * this function will always return false when used on physical devices. While * it might seem attractive to adjust several logical devices at once in this * way, it would allow an app or library to interfere with another portion of * the program's otherwise-isolated devices. * * This is applied, along with any per-audiostream gain, during playback to * the hardware, and can be continuously changed to create various effects. On * recording devices, this will adjust the gain before passing the data into * an audiostream; that recording audiostream can then adjust its gain further * when outputting the data elsewhere, if it likes, but that second gain is * not applied until the data leaves the audiostream again. * * \param devid the audio device on which to change gain. * \param gain the gain. 1.0f is no change, 0.0f is silence. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioDeviceGain */ SDL_SetAudioDeviceGain :: (devid: SDL_AudioDeviceID, gain: float) -> bool #foreign libsdl3; /** * Close a previously-opened audio device. * * The application should close open audio devices once they are no longer * needed. * * This function may block briefly while pending audio data is played by the * hardware, so that applications don't drop the last buffer of data they * supplied if terminating immediately afterwards. * * \param devid an audio device id previously returned by * SDL_OpenAudioDevice(). * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenAudioDevice */ SDL_CloseAudioDevice :: (devid: SDL_AudioDeviceID) -> void #foreign libsdl3; /** * Bind a list of audio streams to an audio device. * * Audio data will flow through any bound streams. For a playback device, data * for all bound streams will be mixed together and fed to the device. For a * recording device, a copy of recorded data will be provided to each bound * stream. * * Audio streams can only be bound to an open device. This operation is * atomic--all streams bound in the same call will start processing at the * same time, so they can stay in sync. Also: either all streams will be bound * or none of them will be. * * It is an error to bind an already-bound stream; it must be explicitly * unbound first. * * Binding a stream to a device will set its output format for playback * devices, and its input format for recording devices, so they match the * device's settings. The caller is welcome to change the other end of the * stream's format at any time with SDL_SetAudioStreamFormat(). * * \param devid an audio device to bind a stream to. * \param streams an array of audio streams to bind. * \param num_streams number streams listed in the `streams` array. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStreams * \sa SDL_UnbindAudioStream * \sa SDL_GetAudioStreamDevice */ SDL_BindAudioStreams :: (devid: SDL_AudioDeviceID, streams: **SDL_AudioStream, num_streams: s32) -> bool #foreign libsdl3; /** * Bind a single audio stream to an audio device. * * This is a convenience function, equivalent to calling * `SDL_BindAudioStreams(devid, &stream, 1)`. * * \param devid an audio device to bind a stream to. * \param stream an audio stream to bind to a device. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStreams * \sa SDL_UnbindAudioStream * \sa SDL_GetAudioStreamDevice */ SDL_BindAudioStream :: (devid: SDL_AudioDeviceID, stream: *SDL_AudioStream) -> bool #foreign libsdl3; /** * Unbind a list of audio streams from their audio devices. * * The streams being unbound do not all have to be on the same device. All * streams on the same device will be unbound atomically (data will stop * flowing through all unbound streams on the same device at the same time). * * Unbinding a stream that isn't bound to a device is a legal no-op. * * \param streams an array of audio streams to unbind. Can be NULL or contain * NULL. * \param num_streams number streams listed in the `streams` array. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStreams */ SDL_UnbindAudioStreams :: (streams: **SDL_AudioStream, num_streams: s32) -> void #foreign libsdl3; /** * Unbind a single audio stream from its audio device. * * This is a convenience function, equivalent to calling * `SDL_UnbindAudioStreams(&stream, 1)`. * * \param stream an audio stream to unbind from a device. Can be NULL. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStream */ SDL_UnbindAudioStream :: (stream: *SDL_AudioStream) -> void #foreign libsdl3; /** * Query an audio stream for its currently-bound device. * * This reports the audio device that an audio stream is currently bound to. * * If not bound, or invalid, this returns zero, which is not a valid device * ID. * * \param stream the audio stream to query. * \returns the bound audio device, or 0 if not bound or invalid. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BindAudioStream * \sa SDL_BindAudioStreams */ SDL_GetAudioStreamDevice :: (stream: *SDL_AudioStream) -> SDL_AudioDeviceID #foreign libsdl3; /** * Create a new audio stream. * * \param src_spec the format details of the input audio. * \param dst_spec the format details of the output audio. * \returns a new audio stream on success or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PutAudioStreamData * \sa SDL_GetAudioStreamData * \sa SDL_GetAudioStreamAvailable * \sa SDL_FlushAudioStream * \sa SDL_ClearAudioStream * \sa SDL_SetAudioStreamFormat * \sa SDL_DestroyAudioStream */ SDL_CreateAudioStream :: (src_spec: *SDL_AudioSpec, dst_spec: *SDL_AudioSpec) -> *SDL_AudioStream #foreign libsdl3; /** * Get the properties associated with an audio stream. * * \param stream the SDL_AudioStream to query. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetAudioStreamProperties :: (stream: *SDL_AudioStream) -> SDL_PropertiesID #foreign libsdl3; /** * Query the current format of an audio stream. * * \param stream the SDL_AudioStream to query. * \param src_spec where to store the input audio format; ignored if NULL. * \param dst_spec where to store the output audio format; ignored if NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamFormat */ SDL_GetAudioStreamFormat :: (stream: *SDL_AudioStream, src_spec: *SDL_AudioSpec, dst_spec: *SDL_AudioSpec) -> bool #foreign libsdl3; /** * Change the input and output formats of an audio stream. * * Future calls to and SDL_GetAudioStreamAvailable and SDL_GetAudioStreamData * will reflect the new format, and future calls to SDL_PutAudioStreamData * must provide data in the new input formats. * * Data that was previously queued in the stream will still be operated on in * the format that was current when it was added, which is to say you can put * the end of a sound file in one format to a stream, change formats for the * next sound file, and start putting that new data while the previous sound * file is still queued, and everything will still play back correctly. * * If a stream is bound to a device, then the format of the side of the stream * bound to a device cannot be changed (src_spec for recording devices, * dst_spec for playback devices). Attempts to make a change to this side will * be ignored, but this will not report an error. The other side's format can * be changed. * * \param stream the stream the format is being changed. * \param src_spec the new format of the audio input; if NULL, it is not * changed. * \param dst_spec the new format of the audio output; if NULL, it is not * changed. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamFormat * \sa SDL_SetAudioStreamFrequencyRatio */ SDL_SetAudioStreamFormat :: (stream: *SDL_AudioStream, src_spec: *SDL_AudioSpec, dst_spec: *SDL_AudioSpec) -> bool #foreign libsdl3; /** * Get the frequency ratio of an audio stream. * * \param stream the SDL_AudioStream to query. * \returns the frequency ratio of the stream or 0.0 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamFrequencyRatio */ SDL_GetAudioStreamFrequencyRatio :: (stream: *SDL_AudioStream) -> float #foreign libsdl3; /** * Change the frequency ratio of an audio stream. * * The frequency ratio is used to adjust the rate at which input data is * consumed. Changing this effectively modifies the speed and pitch of the * audio. A value greater than 1.0 will play the audio faster, and at a higher * pitch. A value less than 1.0 will play the audio slower, and at a lower * pitch. * * This is applied during SDL_GetAudioStreamData, and can be continuously * changed to create various effects. * * \param stream the stream the frequency ratio is being changed. * \param ratio the frequency ratio. 1.0 is normal speed. Must be between 0.01 * and 100. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamFrequencyRatio * \sa SDL_SetAudioStreamFormat */ SDL_SetAudioStreamFrequencyRatio :: (stream: *SDL_AudioStream, ratio: float) -> bool #foreign libsdl3; /** * Get the gain of an audio stream. * * The gain of a stream is its volume; a larger gain means a louder output, * with a gain of zero being silence. * * Audio streams default to a gain of 1.0f (no change in output). * * \param stream the SDL_AudioStream to query. * \returns the gain of the stream or -1.0f on failure; call SDL_GetError() * for more information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamGain */ SDL_GetAudioStreamGain :: (stream: *SDL_AudioStream) -> float #foreign libsdl3; /** * Change the gain of an audio stream. * * The gain of a stream is its volume; a larger gain means a louder output, * with a gain of zero being silence. * * Audio streams default to a gain of 1.0f (no change in output). * * This is applied during SDL_GetAudioStreamData, and can be continuously * changed to create various effects. * * \param stream the stream on which the gain is being changed. * \param gain the gain. 1.0f is no change, 0.0f is silence. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamGain */ SDL_SetAudioStreamGain :: (stream: *SDL_AudioStream, gain: float) -> bool #foreign libsdl3; /** * Get the current input channel map of an audio stream. * * Channel maps are optional; most things do not need them, instead passing * data in the [order that SDL expects](CategoryAudio#channel-layouts). * * Audio streams default to no remapping applied. This is represented by * returning NULL, and does not signify an error. * * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as * the current output spec's channels, or NULL if default. This * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ SDL_GetAudioStreamInputChannelMap :: (stream: *SDL_AudioStream, count: *s32) -> *s32 #foreign libsdl3; /** * Get the current output channel map of an audio stream. * * Channel maps are optional; most things do not need them, instead passing * data in the [order that SDL expects](CategoryAudio#channel-layouts). * * Audio streams default to no remapping applied. This is represented by * returning NULL, and does not signify an error. * * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as * the current output spec's channels, or NULL if default. This * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ SDL_GetAudioStreamOutputChannelMap :: (stream: *SDL_AudioStream, count: *s32) -> *s32 #foreign libsdl3; /** * Set the current input channel map of an audio stream. * * Channel maps are optional; most things do not need them, instead passing * data in the [order that SDL expects](CategoryAudio#channel-layouts). * * The input channel map reorders data that is added to a stream via * SDL_PutAudioStreamData. Future calls to SDL_PutAudioStreamData must provide * data in the new channel order. * * Each item in the array represents an input channel, and its value is the * channel that it should be remapped to. To reverse a stereo signal's left * and right values, you'd have an array of `{ 1, 0 }`. It is legal to remap * multiple channels to the same thing, so `{ 1, 1 }` would duplicate the * right channel to both channels of a stereo signal. An element in the * channel map set to -1 instead of a valid channel will mute that channel, * setting it to a silence value. * * You cannot change the number of channels through a channel map, just * reorder/mute them. * * Data that was previously queued in the stream will still be operated on in * the order that was current when it was added, which is to say you can put * the end of a sound file in one order to a stream, change orders for the * next sound file, and start putting that new data while the previous sound * file is still queued, and everything will still play back correctly. * * Audio streams default to no remapping applied. Passing a NULL channel map * is legal, and turns off remapping. * * SDL will copy the channel map; the caller does not have to save this array * after this call. * * If `count` is not equal to the current number of channels in the audio * stream's format, this will fail. This is a safety measure to make sure a * race condition hasn't changed the format while this call is setting the * channel map. * * Unlike attempting to change the stream's format, the input channel map on a * stream bound to a recording device is permitted to change at any time; any * data added to the stream from the device after this call will have the new * mapping, but previously-added data will still have the prior mapping. * * \param stream the SDL_AudioStream to change. * \param chmap the new channel map, NULL to reset to default. * \param count The number of channels in the map. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. Don't change the * stream's format to have a different number of channels from a * a different thread at the same time, though! * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ SDL_SetAudioStreamInputChannelMap :: (stream: *SDL_AudioStream, chmap: *s32, count: s32) -> bool #foreign libsdl3; /** * Set the current output channel map of an audio stream. * * Channel maps are optional; most things do not need them, instead passing * data in the [order that SDL expects](CategoryAudio#channel-layouts). * * The output channel map reorders data that leaving a stream via * SDL_GetAudioStreamData. * * Each item in the array represents an input channel, and its value is the * channel that it should be remapped to. To reverse a stereo signal's left * and right values, you'd have an array of `{ 1, 0 }`. It is legal to remap * multiple channels to the same thing, so `{ 1, 1 }` would duplicate the * right channel to both channels of a stereo signal. An element in the * channel map set to -1 instead of a valid channel will mute that channel, * setting it to a silence value. * * You cannot change the number of channels through a channel map, just * reorder/mute them. * * The output channel map can be changed at any time, as output remapping is * applied during SDL_GetAudioStreamData. * * Audio streams default to no remapping applied. Passing a NULL channel map * is legal, and turns off remapping. * * SDL will copy the channel map; the caller does not have to save this array * after this call. * * If `count` is not equal to the current number of channels in the audio * stream's format, this will fail. This is a safety measure to make sure a * race condition hasn't changed the format while this call is setting the * channel map. * * Unlike attempting to change the stream's format, the output channel map on * a stream bound to a recording device is permitted to change at any time; * any data added to the stream after this call will have the new mapping, but * previously-added data will still have the prior mapping. When the channel * map doesn't match the hardware's channel layout, SDL will convert the data * before feeding it to the device for playback. * * \param stream the SDL_AudioStream to change. * \param chmap the new channel map, NULL to reset to default. * \param count The number of channels in the map. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. Don't change the * stream's format to have a different number of channels from a * a different thread at the same time, though! * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamInputChannelMap */ SDL_SetAudioStreamOutputChannelMap :: (stream: *SDL_AudioStream, chmap: *s32, count: s32) -> bool #foreign libsdl3; /** * Add data to the stream. * * This data must match the format/channels/samplerate specified in the latest * call to SDL_SetAudioStreamFormat, or the format specified when creating the * stream if it hasn't been changed. * * Note that this call simply copies the unconverted data for later. This is * different than SDL2, where data was converted during the Put call and the * Get call would just dequeue the previously-converted data. * * \param stream the stream the audio data is being added to. * \param buf a pointer to the audio data to add. * \param len the number of bytes to write to the stream. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, but if the * stream has a callback set, the caller might need to manage * extra locking. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearAudioStream * \sa SDL_FlushAudioStream * \sa SDL_GetAudioStreamData * \sa SDL_GetAudioStreamQueued */ SDL_PutAudioStreamData :: (stream: *SDL_AudioStream, buf: *void, len: s32) -> bool #foreign libsdl3; /** * Get converted/resampled data from the stream. * * The input/output data format/channels/samplerate is specified when creating * the stream, and can be changed after creation by calling * SDL_SetAudioStreamFormat. * * Note that any conversion and resampling necessary is done during this call, * and SDL_PutAudioStreamData simply queues unconverted data for later. This * is different than SDL2, where that work was done while inputting new data * to the stream and requesting the output just copied the converted data. * * \param stream the stream the audio is being requested from. * \param buf a buffer to fill with audio data. * \param len the maximum number of bytes to fill. * \returns the number of bytes read from the stream or -1 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread, but if the * stream has a callback set, the caller might need to manage * extra locking. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearAudioStream * \sa SDL_GetAudioStreamAvailable * \sa SDL_PutAudioStreamData */ SDL_GetAudioStreamData :: (stream: *SDL_AudioStream, buf: *void, len: s32) -> s32 #foreign libsdl3; /** * Get the number of converted/resampled bytes available. * * The stream may be buffering data behind the scenes until it has enough to * resample correctly, so this number might be lower than what you expect, or * even be zero. Add more data or flush the stream if you need the data now. * * If the stream has so much data that it would overflow an int, the return * value is clamped to a maximum value, but no queued data is lost; if there * are gigabytes of data queued, the app might need to read some of it with * SDL_GetAudioStreamData before this function's return value is no longer * clamped. * * \param stream the audio stream to query. * \returns the number of converted/resampled bytes available or -1 on * failure; call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamData * \sa SDL_PutAudioStreamData */ SDL_GetAudioStreamAvailable :: (stream: *SDL_AudioStream) -> s32 #foreign libsdl3; /** * Get the number of bytes currently queued. * * This is the number of bytes put into a stream as input, not the number that * can be retrieved as output. Because of several details, it's not possible * to calculate one number directly from the other. If you need to know how * much usable data can be retrieved right now, you should use * SDL_GetAudioStreamAvailable() and not this function. * * Note that audio streams can change their input format at any time, even if * there is still data queued in a different format, so the returned byte * count will not necessarily match the number of _sample frames_ available. * Users of this API should be aware of format changes they make when feeding * a stream and plan accordingly. * * Queued data is not converted until it is consumed by * SDL_GetAudioStreamData, so this value should be representative of the exact * data that was put into the stream. * * If the stream has so much data that it would overflow an int, the return * value is clamped to a maximum value, but no queued data is lost; if there * are gigabytes of data queued, the app might need to read some of it with * SDL_GetAudioStreamData before this function's return value is no longer * clamped. * * \param stream the audio stream to query. * \returns the number of bytes queued or -1 on failure; call SDL_GetError() * for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PutAudioStreamData * \sa SDL_ClearAudioStream */ SDL_GetAudioStreamQueued :: (stream: *SDL_AudioStream) -> s32 #foreign libsdl3; /** * Tell the stream that you're done sending data, and anything being buffered * should be converted/resampled and made available immediately. * * It is legal to add more data to a stream after flushing, but there may be * audio gaps in the output. Generally this is intended to signal the end of * input, so the complete output becomes available. * * \param stream the audio stream to flush. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PutAudioStreamData */ SDL_FlushAudioStream :: (stream: *SDL_AudioStream) -> bool #foreign libsdl3; /** * Clear any pending data in the stream. * * This drops any queued data, so there will be nothing to read from the * stream until more is added. * * \param stream the audio stream to clear. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamAvailable * \sa SDL_GetAudioStreamData * \sa SDL_GetAudioStreamQueued * \sa SDL_PutAudioStreamData */ SDL_ClearAudioStream :: (stream: *SDL_AudioStream) -> bool #foreign libsdl3; /** * Use this function to pause audio playback on the audio device associated * with an audio stream. * * This function pauses audio processing for a given device. Any bound audio * streams will not progress, and no audio will be generated. Pausing one * device does not prevent other unpaused devices from running. * * Pausing a device can be useful to halt all audio without unbinding all the * audio streams. This might be useful while a game is paused, or a level is * loading, etc. * * \param stream the audio stream associated with the audio device to pause. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ResumeAudioStreamDevice */ SDL_PauseAudioStreamDevice :: (stream: *SDL_AudioStream) -> bool #foreign libsdl3; /** * Use this function to unpause audio playback on the audio device associated * with an audio stream. * * This function unpauses audio processing for a given device that has * previously been paused. Once unpaused, any bound audio streams will begin * to progress again, and audio can be generated. * * \param stream the audio stream associated with the audio device to resume. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PauseAudioStreamDevice */ SDL_ResumeAudioStreamDevice :: (stream: *SDL_AudioStream) -> bool #foreign libsdl3; /** * Use this function to query if an audio device associated with a stream is * paused. * * Unlike in SDL2, audio devices start in an _unpaused_ state, since an app * has to bind a stream before any audio will flow. * * \param stream the audio stream associated with the audio device to query. * \returns true if device is valid and paused, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PauseAudioStreamDevice * \sa SDL_ResumeAudioStreamDevice */ SDL_AudioStreamDevicePaused :: (stream: *SDL_AudioStream) -> bool #foreign libsdl3; /** * Lock an audio stream for serialized access. * * Each SDL_AudioStream has an internal mutex it uses to protect its data * structures from threading conflicts. This function allows an app to lock * that mutex, which could be useful if registering callbacks on this stream. * * One does not need to lock a stream to use in it most cases, as the stream * manages this lock internally. However, this lock is held during callbacks, * which may run from arbitrary threads at any time, so if an app needs to * protect shared data during those callbacks, locking the stream guarantees * that the callback is not running while the lock is held. * * As this is just a wrapper over SDL_LockMutex for an internal lock; it has * all the same attributes (recursive locks are allowed, etc). * * \param stream the audio stream to lock. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UnlockAudioStream */ SDL_LockAudioStream :: (stream: *SDL_AudioStream) -> bool #foreign libsdl3; /** * Unlock an audio stream for serialized access. * * This unlocks an audio stream after a call to SDL_LockAudioStream. * * \param stream the audio stream to unlock. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety You should only call this from the same thread that * previously called SDL_LockAudioStream. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockAudioStream */ SDL_UnlockAudioStream :: (stream: *SDL_AudioStream) -> bool #foreign libsdl3; /** * A callback that fires when data passes through an SDL_AudioStream. * * Apps can (optionally) register a callback with an audio stream that is * called when data is added with SDL_PutAudioStreamData, or requested with * SDL_GetAudioStreamData. * * Two values are offered here: one is the amount of additional data needed to * satisfy the immediate request (which might be zero if the stream already * has enough data queued) and the other is the total amount being requested. * In a Get call triggering a Put callback, these values can be different. In * a Put call triggering a Get callback, these values are always the same. * * Byte counts might be slightly overestimated due to buffering or resampling, * and may change from call to call. * * This callback is not required to do anything. Generally this is useful for * adding/reading data on demand, and the app will often put/get data as * appropriate, but the system goes on with the data currently available to it * if this callback does nothing. * * \param stream the SDL audio stream associated with this callback. * \param additional_amount the amount of data, in bytes, that is needed right * now. * \param total_amount the total amount of data requested, in bytes, that is * requested or available. * \param userdata an opaque pointer provided by the app for their personal * use. * * \threadsafety This callbacks may run from any thread, so if you need to * protect shared data, you should use SDL_LockAudioStream to * serialize access; this lock will be held before your callback * is called, so your callback does not need to manage the lock * explicitly. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamGetCallback * \sa SDL_SetAudioStreamPutCallback */ SDL_AudioStreamCallback :: #type (userdata: *void, stream: *SDL_AudioStream, additional_amount: s32, total_amount: s32) -> void #c_call; /** * Set a callback that runs when data is requested from an audio stream. * * This callback is called _before_ data is obtained from the stream, giving * the callback the chance to add more on-demand. * * The callback can (optionally) call SDL_PutAudioStreamData() to add more * audio to the stream during this call; if needed, the request that triggered * this callback will obtain the new data immediately. * * The callback's `approx_request` argument is roughly how many bytes of * _unconverted_ data (in the stream's input format) is needed by the caller, * although this may overestimate a little for safety. This takes into account * how much is already in the stream and only asks for any extra necessary to * resolve the request, which means the callback may be asked for zero bytes, * and a different amount on each call. * * The callback is not required to supply exact amounts; it is allowed to * supply too much or too little or none at all. The caller will get what's * available, up to the amount they requested, regardless of this callback's * outcome. * * Clearing or flushing an audio stream does not call this callback. * * This function obtains the stream's lock, which means any existing callback * (get or put) in progress will finish running before setting the new * callback. * * Setting a NULL function turns off the callback. * * \param stream the audio stream to set the new callback on. * \param callback the new callback function to call when data is requested * from the stream. * \param userdata an opaque pointer provided to the callback for its own * personal use. * \returns true on success or false on failure; call SDL_GetError() for more * information. This only fails if `stream` is NULL. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamPutCallback */ SDL_SetAudioStreamGetCallback :: (stream: *SDL_AudioStream, callback: SDL_AudioStreamCallback, userdata: *void) -> bool #foreign libsdl3; /** * Set a callback that runs when data is added to an audio stream. * * This callback is called _after_ the data is added to the stream, giving the * callback the chance to obtain it immediately. * * The callback can (optionally) call SDL_GetAudioStreamData() to obtain audio * from the stream during this call. * * The callback's `approx_request` argument is how many bytes of _converted_ * data (in the stream's output format) was provided by the caller, although * this may underestimate a little for safety. This value might be less than * what is currently available in the stream, if data was already there, and * might be less than the caller provided if the stream needs to keep a buffer * to aid in resampling. Which means the callback may be provided with zero * bytes, and a different amount on each call. * * The callback may call SDL_GetAudioStreamAvailable to see the total amount * currently available to read from the stream, instead of the total provided * by the current call. * * The callback is not required to obtain all data. It is allowed to read less * or none at all. Anything not read now simply remains in the stream for * later access. * * Clearing or flushing an audio stream does not call this callback. * * This function obtains the stream's lock, which means any existing callback * (get or put) in progress will finish running before setting the new * callback. * * Setting a NULL function turns off the callback. * * \param stream the audio stream to set the new callback on. * \param callback the new callback function to call when data is added to the * stream. * \param userdata an opaque pointer provided to the callback for its own * personal use. * \returns true on success or false on failure; call SDL_GetError() for more * information. This only fails if `stream` is NULL. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAudioStreamGetCallback */ SDL_SetAudioStreamPutCallback :: (stream: *SDL_AudioStream, callback: SDL_AudioStreamCallback, userdata: *void) -> bool #foreign libsdl3; /** * Free an audio stream. * * This will release all allocated data, including any audio that is still * queued. You do not need to manually clear the stream first. * * If this stream was bound to an audio device, it is unbound during this * call. If this stream was created with SDL_OpenAudioDeviceStream, the audio * device that was opened alongside this stream's creation will be closed, * too. * * \param stream the audio stream to destroy. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateAudioStream */ SDL_DestroyAudioStream :: (stream: *SDL_AudioStream) -> void #foreign libsdl3; /** * Convenience function for straightforward audio init for the common case. * * If all your app intends to do is provide a single source of PCM audio, this * function allows you to do all your audio setup in a single call. * * This is also intended to be a clean means to migrate apps from SDL2. * * This function will open an audio device, create a stream and bind it. * Unlike other methods of setup, the audio device will be closed when this * stream is destroyed, so the app can treat the returned SDL_AudioStream as * the only object needed to manage audio playback. * * Also unlike other functions, the audio device begins paused. This is to map * more closely to SDL2-style behavior, since there is no extra step here to * bind a stream to begin audio flowing. The audio device should be resumed * with `SDL_ResumeAudioStreamDevice(stream);` * * This function works with both playback and recording devices. * * The `spec` parameter represents the app's side of the audio stream. That * is, for recording audio, this will be the output format, and for playing * audio, this will be the input format. If spec is NULL, the system will * choose the format, and the app can use SDL_GetAudioStreamFormat() to obtain * this information later. * * If you don't care about opening a specific audio device, you can (and * probably _should_), use SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK for playback and * SDL_AUDIO_DEVICE_DEFAULT_RECORDING for recording. * * One can optionally provide a callback function; if NULL, the app is * expected to queue audio data for playback (or unqueue audio data if * capturing). Otherwise, the callback will begin to fire once the device is * unpaused. * * Destroying the returned stream with SDL_DestroyAudioStream will also close * the audio device associated with this stream. * * \param devid an audio device to open, or SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK * or SDL_AUDIO_DEVICE_DEFAULT_RECORDING. * \param spec the audio stream's data format. Can be NULL. * \param callback a callback where the app will provide new data for * playback, or receive new data for recording. Can be NULL, * in which case the app will need to call * SDL_PutAudioStreamData or SDL_GetAudioStreamData as * necessary. * \param userdata app-controlled pointer passed to callback. Can be NULL. * Ignored if callback is NULL. * \returns an audio stream on success, ready to use, or NULL on failure; call * SDL_GetError() for more information. When done with this stream, * call SDL_DestroyAudioStream to free resources and close the * device. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAudioStreamDevice * \sa SDL_ResumeAudioStreamDevice */ SDL_OpenAudioDeviceStream :: (devid: SDL_AudioDeviceID, spec: *SDL_AudioSpec, callback: SDL_AudioStreamCallback, userdata: *void) -> *SDL_AudioStream #foreign libsdl3; /** * A callback that fires when data is about to be fed to an audio device. * * This is useful for accessing the final mix, perhaps for writing a * visualizer or applying a final effect to the audio data before playback. * * This callback should run as quickly as possible and not block for any * significant time, as this callback delays submission of data to the audio * device, which can cause audio playback problems. * * The postmix callback _must_ be able to handle any audio data format * specified in `spec`, which can change between callbacks if the audio device * changed. However, this only covers frequency and channel count; data is * always provided here in SDL_AUDIO_F32 format. * * The postmix callback runs _after_ logical device gain and audiostream gain * have been applied, which is to say you can make the output data louder at * this point than the gain settings would suggest. * * \param userdata a pointer provided by the app through * SDL_SetAudioPostmixCallback, for its own use. * \param spec the current format of audio that is to be submitted to the * audio device. * \param buffer the buffer of audio samples to be submitted. The callback can * inspect and/or modify this data. * \param buflen the size of `buffer` in bytes. * * \threadsafety This will run from a background thread owned by SDL. The * application is responsible for locking resources the callback * touches that need to be protected. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetAudioPostmixCallback */ SDL_AudioPostmixCallback :: #type (userdata: *void, spec: *SDL_AudioSpec, buffer: *float, buflen: s32) -> void #c_call; /** * Set a callback that fires when data is about to be fed to an audio device. * * This is useful for accessing the final mix, perhaps for writing a * visualizer or applying a final effect to the audio data before playback. * * The buffer is the final mix of all bound audio streams on an opened device; * this callback will fire regularly for any device that is both opened and * unpaused. If there is no new data to mix, either because no streams are * bound to the device or all the streams are empty, this callback will still * fire with the entire buffer set to silence. * * This callback is allowed to make changes to the data; the contents of the * buffer after this call is what is ultimately passed along to the hardware. * * The callback is always provided the data in float format (values from -1.0f * to 1.0f), but the number of channels or sample rate may be different than * the format the app requested when opening the device; SDL might have had to * manage a conversion behind the scenes, or the playback might have jumped to * new physical hardware when a system default changed, etc. These details may * change between calls. Accordingly, the size of the buffer might change * between calls as well. * * This callback can run at any time, and from any thread; if you need to * serialize access to your app's data, you should provide and use a mutex or * other synchronization device. * * All of this to say: there are specific needs this callback can fulfill, but * it is not the simplest interface. Apps should generally provide audio in * their preferred format through an SDL_AudioStream and let SDL handle the * difference. * * This function is extremely time-sensitive; the callback should do the least * amount of work possible and return as quickly as it can. The longer the * callback runs, the higher the risk of audio dropouts or other problems. * * This function will block until the audio device is in between iterations, * so any existing callback that might be running will finish before this * function sets the new callback and returns. * * Setting a NULL callback function disables any previously-set callback. * * \param devid the ID of an opened audio device. * \param callback a callback function to be called. Can be NULL. * \param userdata app-controlled pointer passed to callback. Can be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_SetAudioPostmixCallback :: (devid: SDL_AudioDeviceID, callback: SDL_AudioPostmixCallback, userdata: *void) -> bool #foreign libsdl3; /** * Load the audio data of a WAVE file into memory. * * Loading a WAVE file requires `src`, `spec`, `audio_buf` and `audio_len` to * be valid pointers. The entire data portion of the file is then loaded into * memory and decoded if necessary. * * Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and * 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and * A-law and mu-law (8 bits). Other formats are currently unsupported and * cause an error. * * If this function succeeds, the return value is zero and the pointer to the * audio data allocated by the function is written to `audio_buf` and its * length in bytes to `audio_len`. The SDL_AudioSpec members `freq`, * `channels`, and `format` are set to the values of the audio data in the * buffer. * * It's necessary to use SDL_free() to free the audio data returned in * `audio_buf` when it is no longer used. * * Because of the underspecification of the .WAV format, there are many * problematic files in the wild that cause issues with strict decoders. To * provide compatibility with these files, this decoder is lenient in regards * to the truncation of the file, the fact chunk, and the size of the RIFF * chunk. The hints `SDL_HINT_WAVE_RIFF_CHUNK_SIZE`, * `SDL_HINT_WAVE_TRUNCATION`, and `SDL_HINT_WAVE_FACT_CHUNK` can be used to * tune the behavior of the loading process. * * Any file that is invalid (due to truncation, corruption, or wrong values in * the headers), too big, or unsupported causes an error. Additionally, any * critical I/O error from the data source will terminate the loading process * with an error. The function returns NULL on error and in all cases (with * the exception of `src` being NULL), an appropriate error message will be * set. * * It is required that the data source supports seeking. * * Example: * * ```c * SDL_LoadWAV_IO(SDL_IOFromFile("sample.wav", "rb"), true, &spec, &buf, &len); * ``` * * Note that the SDL_LoadWAV function does this same thing for you, but in a * less messy way: * * ```c * SDL_LoadWAV("sample.wav", &spec, &buf, &len); * ``` * * \param src the data source for the WAVE data. * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even * in the case of an error. * \param spec a pointer to an SDL_AudioSpec that will be set to the WAVE * data's format details on successful return. * \param audio_buf a pointer filled with the audio data, allocated by the * function. * \param audio_len a pointer filled with the length of the audio data buffer * in bytes. * \returns true on success. `audio_buf` will be filled with a pointer to an * allocated buffer containing the audio data, and `audio_len` is * filled with the length of that audio buffer in bytes. * * This function returns false if the .WAV file cannot be opened, * uses an unknown data format, or is corrupt; call SDL_GetError() * for more information. * * When the application is done with the data returned in * `audio_buf`, it should call SDL_free() to dispose of it. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_LoadWAV */ SDL_LoadWAV_IO :: (src: *SDL_IOStream, closeio: bool, spec: *SDL_AudioSpec, audio_buf: **Uint8, audio_len: *Uint32) -> bool #foreign libsdl3; /** * Loads a WAV from a file path. * * This is a convenience function that is effectively the same as: * * ```c * SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), true, spec, audio_buf, audio_len); * ``` * * \param path the file path of the WAV file to open. * \param spec a pointer to an SDL_AudioSpec that will be set to the WAVE * data's format details on successful return. * \param audio_buf a pointer filled with the audio data, allocated by the * function. * \param audio_len a pointer filled with the length of the audio data buffer * in bytes. * \returns true on success. `audio_buf` will be filled with a pointer to an * allocated buffer containing the audio data, and `audio_len` is * filled with the length of that audio buffer in bytes. * * This function returns false if the .WAV file cannot be opened, * uses an unknown data format, or is corrupt; call SDL_GetError() * for more information. * * When the application is done with the data returned in * `audio_buf`, it should call SDL_free() to dispose of it. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_free * \sa SDL_LoadWAV_IO */ SDL_LoadWAV :: (path: *u8, spec: *SDL_AudioSpec, audio_buf: **Uint8, audio_len: *Uint32) -> bool #foreign libsdl3; /** * Mix audio data in a specified format. * * This takes an audio buffer `src` of `len` bytes of `format` data and mixes * it into `dst`, performing addition, volume adjustment, and overflow * clipping. The buffer pointed to by `dst` must also be `len` bytes of * `format` data. * * This is provided for convenience -- you can mix your own audio data. * * Do not use this function for mixing together more than two streams of * sample data. The output from repeated application of this function may be * distorted by clipping, because there is no accumulator with greater range * than the input (not to mention this being an inefficient way of doing it). * * It is a common misconception that this function is required to write audio * data to an output stream in an audio callback. While you can do that, * SDL_MixAudio() is really only needed when you're mixing a single audio * stream with a volume adjustment. * * \param dst the destination for the mixed audio. * \param src the source audio buffer to be mixed. * \param format the SDL_AudioFormat structure representing the desired audio * format. * \param len the length of the audio buffer in bytes. * \param volume ranges from 0.0 - 1.0, and should be set to 1.0 for full * audio volume. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_MixAudio :: (dst: *Uint8, src: *Uint8, format: SDL_AudioFormat, len: Uint32, volume: float) -> bool #foreign libsdl3; /** * Convert some audio data of one format to another format. * * Please note that this function is for convenience, but should not be used * to resample audio in blocks, as it will introduce audio artifacts on the * boundaries. You should only use this function if you are converting audio * data in its entirety in one call. If you want to convert audio in smaller * chunks, use an SDL_AudioStream, which is designed for this situation. * * Internally, this function creates and destroys an SDL_AudioStream on each * use, so it's also less efficient than using one directly, if you need to * convert multiple times. * * \param src_spec the format details of the input audio. * \param src_data the audio data to be converted. * \param src_len the len of src_data. * \param dst_spec the format details of the output audio. * \param dst_data will be filled with a pointer to converted audio data, * which should be freed with SDL_free(). On error, it will be * NULL. * \param dst_len will be filled with the len of dst_data. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_ConvertAudioSamples :: (src_spec: *SDL_AudioSpec, src_data: *Uint8, src_len: s32, dst_spec: *SDL_AudioSpec, dst_data: **Uint8, dst_len: *s32) -> bool #foreign libsdl3; /** * Get the human readable name of an audio format. * * \param format the audio format to query. * \returns the human readable name of the specified audio format or * "SDL_AUDIO_UNKNOWN" if the format isn't recognized. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetAudioFormatName :: (format: SDL_AudioFormat) -> *u8 #foreign libsdl3; /** * Get the appropriate memset value for silencing an audio format. * * The value returned by this function can be used as the second argument to * memset (or SDL_memset) to set an audio buffer in a specific format to * silence. * * \param format the audio data format to query. * \returns a byte value that can be passed to memset. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetSilenceValueForFormat :: (format: SDL_AudioFormat) -> s32 #foreign libsdl3; /** * A set of blend modes used in drawing operations. * * These predefined blend modes are supported everywhere. * * Additional values may be obtained from SDL_ComposeCustomBlendMode. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_ComposeCustomBlendMode */ SDL_BlendMode :: Uint32; /** * The blend operation used when combining source and destination pixel * components. * * \since This enum is available since SDL 3.2.0. */ using SDL_BlendOperation :: enum u32 { SDL_BLENDOPERATION_ADD :: 1; SDL_BLENDOPERATION_SUBTRACT :: 2; SDL_BLENDOPERATION_REV_SUBTRACT :: 3; SDL_BLENDOPERATION_MINIMUM :: 4; SDL_BLENDOPERATION_MAXIMUM :: 5; } /** * The normalized factor used to multiply pixel components. * * The blend factors are multiplied with the pixels from a drawing operation * (src) and the pixels from the render target (dst) before the blend * operation. The comma-separated factors listed above are always applied in * the component order red, green, blue, and alpha. * * \since This enum is available since SDL 3.2.0. */ using SDL_BlendFactor :: enum u32 { SDL_BLENDFACTOR_ZERO :: 1; SDL_BLENDFACTOR_ONE :: 2; SDL_BLENDFACTOR_SRC_COLOR :: 3; SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR :: 4; SDL_BLENDFACTOR_SRC_ALPHA :: 5; SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA :: 6; SDL_BLENDFACTOR_DST_COLOR :: 7; SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR :: 8; SDL_BLENDFACTOR_DST_ALPHA :: 9; SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA :: 10; } /** * Compose a custom blend mode for renderers. * * The functions SDL_SetRenderDrawBlendMode and SDL_SetTextureBlendMode accept * the SDL_BlendMode returned by this function if the renderer supports it. * * A blend mode controls how the pixels from a drawing operation (source) get * combined with the pixels from the render target (destination). First, the * components of the source and destination pixels get multiplied with their * blend factors. Then, the blend operation takes the two products and * calculates the result that will get stored in the render target. * * Expressed in pseudocode, it would look like this: * * ```c * dstRGB = colorOperation(srcRGB * srcColorFactor, dstRGB * dstColorFactor); * dstA = alphaOperation(srcA * srcAlphaFactor, dstA * dstAlphaFactor); * ``` * * Where the functions `colorOperation(src, dst)` and `alphaOperation(src, * dst)` can return one of the following: * * - `src + dst` * - `src - dst` * - `dst - src` * - `min(src, dst)` * - `max(src, dst)` * * The red, green, and blue components are always multiplied with the first, * second, and third components of the SDL_BlendFactor, respectively. The * fourth component is not used. * * The alpha component is always multiplied with the fourth component of the * SDL_BlendFactor. The other components are not used in the alpha * calculation. * * Support for these blend modes varies for each renderer. To check if a * specific SDL_BlendMode is supported, create a renderer and pass it to * either SDL_SetRenderDrawBlendMode or SDL_SetTextureBlendMode. They will * return with an error if the blend mode is not supported. * * This list describes the support of custom blend modes for each renderer. * All renderers support the four blend modes listed in the SDL_BlendMode * enumeration. * * - **direct3d**: Supports all operations with all factors. However, some * factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and * `SDL_BLENDOPERATION_MAXIMUM`. * - **direct3d11**: Same as Direct3D 9. * - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all * factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly here. * - **opengles2**: Supports the `SDL_BLENDOPERATION_ADD`, * `SDL_BLENDOPERATION_SUBTRACT`, `SDL_BLENDOPERATION_REV_SUBTRACT` * operations with all factors. * - **psp**: No custom blend mode support. * - **software**: No custom blend mode support. * * Some renderers do not provide an alpha component for the default render * target. The `SDL_BLENDFACTOR_DST_ALPHA` and * `SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA` factors do not have an effect in this * case. * * \param srcColorFactor the SDL_BlendFactor applied to the red, green, and * blue components of the source pixels. * \param dstColorFactor the SDL_BlendFactor applied to the red, green, and * blue components of the destination pixels. * \param colorOperation the SDL_BlendOperation used to combine the red, * green, and blue components of the source and * destination pixels. * \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of * the source pixels. * \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of * the destination pixels. * \param alphaOperation the SDL_BlendOperation used to combine the alpha * component of the source and destination pixels. * \returns an SDL_BlendMode that represents the chosen factors and * operations. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderDrawBlendMode * \sa SDL_GetRenderDrawBlendMode * \sa SDL_SetTextureBlendMode * \sa SDL_GetTextureBlendMode */ SDL_ComposeCustomBlendMode :: (srcColorFactor: SDL_BlendFactor, dstColorFactor: SDL_BlendFactor, colorOperation: SDL_BlendOperation, srcAlphaFactor: SDL_BlendFactor, dstAlphaFactor: SDL_BlendFactor, alphaOperation: SDL_BlendOperation) -> SDL_BlendMode #foreign libsdl3; /** * Pixel type. * * \since This enum is available since SDL 3.2.0. */ using SDL_PixelType :: enum u32 { SDL_PIXELTYPE_UNKNOWN :: 0; SDL_PIXELTYPE_INDEX1 :: 1; SDL_PIXELTYPE_INDEX4 :: 2; SDL_PIXELTYPE_INDEX8 :: 3; SDL_PIXELTYPE_PACKED8 :: 4; SDL_PIXELTYPE_PACKED16 :: 5; SDL_PIXELTYPE_PACKED32 :: 6; SDL_PIXELTYPE_ARRAYU8 :: 7; SDL_PIXELTYPE_ARRAYU16 :: 8; SDL_PIXELTYPE_ARRAYU32 :: 9; SDL_PIXELTYPE_ARRAYF16 :: 10; SDL_PIXELTYPE_ARRAYF32 :: 11; SDL_PIXELTYPE_INDEX2 :: 12; } /** * Bitmap pixel order, high bit -> low bit. * * \since This enum is available since SDL 3.2.0. */ using SDL_BitmapOrder :: enum u32 { SDL_BITMAPORDER_NONE :: 0; SDL_BITMAPORDER_4321 :: 1; SDL_BITMAPORDER_1234 :: 2; } /** * Packed component order, high bit -> low bit. * * \since This enum is available since SDL 3.2.0. */ using SDL_PackedOrder :: enum u32 { SDL_PACKEDORDER_NONE :: 0; SDL_PACKEDORDER_XRGB :: 1; SDL_PACKEDORDER_RGBX :: 2; SDL_PACKEDORDER_ARGB :: 3; SDL_PACKEDORDER_RGBA :: 4; SDL_PACKEDORDER_XBGR :: 5; SDL_PACKEDORDER_BGRX :: 6; SDL_PACKEDORDER_ABGR :: 7; SDL_PACKEDORDER_BGRA :: 8; } /** * Array component order, low byte -> high byte. * * \since This enum is available since SDL 3.2.0. */ using SDL_ArrayOrder :: enum u32 { SDL_ARRAYORDER_NONE :: 0; SDL_ARRAYORDER_RGB :: 1; SDL_ARRAYORDER_RGBA :: 2; SDL_ARRAYORDER_ARGB :: 3; SDL_ARRAYORDER_BGR :: 4; SDL_ARRAYORDER_BGRA :: 5; SDL_ARRAYORDER_ABGR :: 6; } /** * Packed component layout. * * \since This enum is available since SDL 3.2.0. */ using SDL_PackedLayout :: enum u32 { SDL_PACKEDLAYOUT_NONE :: 0; SDL_PACKEDLAYOUT_332 :: 1; SDL_PACKEDLAYOUT_4444 :: 2; SDL_PACKEDLAYOUT_1555 :: 3; SDL_PACKEDLAYOUT_5551 :: 4; SDL_PACKEDLAYOUT_565 :: 5; SDL_PACKEDLAYOUT_8888 :: 6; SDL_PACKEDLAYOUT_2101010 :: 7; SDL_PACKEDLAYOUT_1010102 :: 8; } /** * Pixel format. * * SDL's pixel formats have the following naming convention: * * - Names with a list of components and a single bit count, such as RGB24 and * ABGR32, define a platform-independent encoding into bytes in the order * specified. For example, in RGB24 data, each pixel is encoded in 3 bytes * (red, green, blue) in that order, and in ABGR32 data, each pixel is * encoded in 4 bytes alpha, blue, green, red) in that order. Use these * names if the property of a format that is important to you is the order * of the bytes in memory or on disk. * - Names with a bit count per component, such as ARGB8888 and XRGB1555, are * "packed" into an appropriately-sized integer in the platform's native * endianness. For example, ARGB8888 is a sequence of 32-bit integers; in * each integer, the most significant bits are alpha, and the least * significant bits are blue. On a little-endian CPU such as x86, the least * significant bits of each integer are arranged first in memory, but on a * big-endian CPU such as s390x, the most significant bits are arranged * first. Use these names if the property of a format that is important to * you is the meaning of each bit position within a native-endianness * integer. * - In indexed formats such as INDEX4LSB, each pixel is represented by * encoding an index into the palette into the indicated number of bits, * with multiple pixels packed into each byte if appropriate. In LSB * formats, the first (leftmost) pixel is stored in the least-significant * bits of the byte; in MSB formats, it's stored in the most-significant * bits. INDEX8 does not need LSB/MSB variants, because each pixel exactly * fills one byte. * * The 32-bit byte-array encodings such as RGBA32 are aliases for the * appropriate 8888 encoding for the current platform. For example, RGBA32 is * an alias for ABGR8888 on little-endian CPUs like x86, or an alias for * RGBA8888 on big-endian CPUs. * * \since This enum is available since SDL 3.2.0. */ using SDL_PixelFormat :: enum u32 { SDL_PIXELFORMAT_UNKNOWN :: 0; SDL_PIXELFORMAT_INDEX1LSB :: 286261504; SDL_PIXELFORMAT_INDEX1MSB :: 287310080; SDL_PIXELFORMAT_INDEX2LSB :: 470811136; SDL_PIXELFORMAT_INDEX2MSB :: 471859712; SDL_PIXELFORMAT_INDEX4LSB :: 303039488; SDL_PIXELFORMAT_INDEX4MSB :: 304088064; SDL_PIXELFORMAT_INDEX8 :: 318769153; SDL_PIXELFORMAT_RGB332 :: 336660481; SDL_PIXELFORMAT_XRGB4444 :: 353504258; SDL_PIXELFORMAT_XBGR4444 :: 357698562; SDL_PIXELFORMAT_XRGB1555 :: 353570562; SDL_PIXELFORMAT_XBGR1555 :: 357764866; SDL_PIXELFORMAT_ARGB4444 :: 355602434; SDL_PIXELFORMAT_RGBA4444 :: 356651010; SDL_PIXELFORMAT_ABGR4444 :: 359796738; SDL_PIXELFORMAT_BGRA4444 :: 360845314; SDL_PIXELFORMAT_ARGB1555 :: 355667970; SDL_PIXELFORMAT_RGBA5551 :: 356782082; SDL_PIXELFORMAT_ABGR1555 :: 359862274; SDL_PIXELFORMAT_BGRA5551 :: 360976386; SDL_PIXELFORMAT_RGB565 :: 353701890; SDL_PIXELFORMAT_BGR565 :: 357896194; SDL_PIXELFORMAT_RGB24 :: 386930691; SDL_PIXELFORMAT_BGR24 :: 390076419; SDL_PIXELFORMAT_XRGB8888 :: 370546692; SDL_PIXELFORMAT_RGBX8888 :: 371595268; SDL_PIXELFORMAT_XBGR8888 :: 374740996; SDL_PIXELFORMAT_BGRX8888 :: 375789572; SDL_PIXELFORMAT_ARGB8888 :: 372645892; SDL_PIXELFORMAT_RGBA8888 :: 373694468; SDL_PIXELFORMAT_ABGR8888 :: 376840196; SDL_PIXELFORMAT_BGRA8888 :: 377888772; SDL_PIXELFORMAT_XRGB2101010 :: 370614276; SDL_PIXELFORMAT_XBGR2101010 :: 374808580; SDL_PIXELFORMAT_ARGB2101010 :: 372711428; SDL_PIXELFORMAT_ABGR2101010 :: 376905732; SDL_PIXELFORMAT_RGB48 :: 403714054; SDL_PIXELFORMAT_BGR48 :: 406859782; SDL_PIXELFORMAT_RGBA64 :: 404766728; SDL_PIXELFORMAT_ARGB64 :: 405815304; SDL_PIXELFORMAT_BGRA64 :: 407912456; SDL_PIXELFORMAT_ABGR64 :: 408961032; SDL_PIXELFORMAT_RGB48_FLOAT :: 437268486; SDL_PIXELFORMAT_BGR48_FLOAT :: 440414214; SDL_PIXELFORMAT_RGBA64_FLOAT :: 438321160; SDL_PIXELFORMAT_ARGB64_FLOAT :: 439369736; SDL_PIXELFORMAT_BGRA64_FLOAT :: 441466888; SDL_PIXELFORMAT_ABGR64_FLOAT :: 442515464; SDL_PIXELFORMAT_RGB96_FLOAT :: 454057996; SDL_PIXELFORMAT_BGR96_FLOAT :: 457203724; SDL_PIXELFORMAT_RGBA128_FLOAT :: 455114768; SDL_PIXELFORMAT_ARGB128_FLOAT :: 456163344; SDL_PIXELFORMAT_BGRA128_FLOAT :: 458260496; SDL_PIXELFORMAT_ABGR128_FLOAT :: 459309072; SDL_PIXELFORMAT_YV12 :: 842094169; SDL_PIXELFORMAT_IYUV :: 1448433993; SDL_PIXELFORMAT_YUY2 :: 844715353; SDL_PIXELFORMAT_UYVY :: 1498831189; SDL_PIXELFORMAT_YVYU :: 1431918169; SDL_PIXELFORMAT_NV12 :: 842094158; SDL_PIXELFORMAT_NV21 :: 825382478; SDL_PIXELFORMAT_P010 :: 808530000; SDL_PIXELFORMAT_EXTERNAL_OES :: 542328143; SDL_PIXELFORMAT_RGBA32 :: 376840196; SDL_PIXELFORMAT_ARGB32 :: 377888772; SDL_PIXELFORMAT_BGRA32 :: 372645892; SDL_PIXELFORMAT_ABGR32 :: 373694468; SDL_PIXELFORMAT_RGBX32 :: 374740996; SDL_PIXELFORMAT_XRGB32 :: 375789572; SDL_PIXELFORMAT_BGRX32 :: 370546692; SDL_PIXELFORMAT_XBGR32 :: 371595268; } /** * Colorspace color type. * * \since This enum is available since SDL 3.2.0. */ using SDL_ColorType :: enum u32 { SDL_COLOR_TYPE_UNKNOWN :: 0; SDL_COLOR_TYPE_RGB :: 1; SDL_COLOR_TYPE_YCBCR :: 2; } /** * Colorspace color range, as described by * https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en * * \since This enum is available since SDL 3.2.0. */ using SDL_ColorRange :: enum u32 { SDL_COLOR_RANGE_UNKNOWN :: 0; SDL_COLOR_RANGE_LIMITED :: 1; SDL_COLOR_RANGE_FULL :: 2; } /** * Colorspace color primaries, as described by * https://www.itu.int/rec/T-REC-H.273-201612-S/en * * \since This enum is available since SDL 3.2.0. */ using SDL_ColorPrimaries :: enum u32 { SDL_COLOR_PRIMARIES_UNKNOWN :: 0; SDL_COLOR_PRIMARIES_BT709 :: 1; SDL_COLOR_PRIMARIES_UNSPECIFIED :: 2; SDL_COLOR_PRIMARIES_BT470M :: 4; SDL_COLOR_PRIMARIES_BT470BG :: 5; SDL_COLOR_PRIMARIES_BT601 :: 6; SDL_COLOR_PRIMARIES_SMPTE240 :: 7; SDL_COLOR_PRIMARIES_GENERIC_FILM :: 8; SDL_COLOR_PRIMARIES_BT2020 :: 9; SDL_COLOR_PRIMARIES_XYZ :: 10; SDL_COLOR_PRIMARIES_SMPTE431 :: 11; SDL_COLOR_PRIMARIES_SMPTE432 :: 12; SDL_COLOR_PRIMARIES_EBU3213 :: 22; SDL_COLOR_PRIMARIES_CUSTOM :: 31; } /** * Colorspace transfer characteristics. * * These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en * * \since This enum is available since SDL 3.2.0. */ using SDL_TransferCharacteristics :: enum u32 { SDL_TRANSFER_CHARACTERISTICS_UNKNOWN :: 0; SDL_TRANSFER_CHARACTERISTICS_BT709 :: 1; SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED :: 2; SDL_TRANSFER_CHARACTERISTICS_GAMMA22 :: 4; SDL_TRANSFER_CHARACTERISTICS_GAMMA28 :: 5; SDL_TRANSFER_CHARACTERISTICS_BT601 :: 6; SDL_TRANSFER_CHARACTERISTICS_SMPTE240 :: 7; SDL_TRANSFER_CHARACTERISTICS_LINEAR :: 8; SDL_TRANSFER_CHARACTERISTICS_LOG100 :: 9; SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10 :: 10; SDL_TRANSFER_CHARACTERISTICS_IEC61966 :: 11; SDL_TRANSFER_CHARACTERISTICS_BT1361 :: 12; SDL_TRANSFER_CHARACTERISTICS_SRGB :: 13; SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT :: 14; SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT :: 15; SDL_TRANSFER_CHARACTERISTICS_PQ :: 16; SDL_TRANSFER_CHARACTERISTICS_SMPTE428 :: 17; SDL_TRANSFER_CHARACTERISTICS_HLG :: 18; SDL_TRANSFER_CHARACTERISTICS_CUSTOM :: 31; } /** * Colorspace matrix coefficients. * * These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en * * \since This enum is available since SDL 3.2.0. */ using SDL_MatrixCoefficients :: enum u32 { SDL_MATRIX_COEFFICIENTS_IDENTITY :: 0; SDL_MATRIX_COEFFICIENTS_BT709 :: 1; SDL_MATRIX_COEFFICIENTS_UNSPECIFIED :: 2; SDL_MATRIX_COEFFICIENTS_FCC :: 4; SDL_MATRIX_COEFFICIENTS_BT470BG :: 5; SDL_MATRIX_COEFFICIENTS_BT601 :: 6; SDL_MATRIX_COEFFICIENTS_SMPTE240 :: 7; SDL_MATRIX_COEFFICIENTS_YCGCO :: 8; SDL_MATRIX_COEFFICIENTS_BT2020_NCL :: 9; SDL_MATRIX_COEFFICIENTS_BT2020_CL :: 10; SDL_MATRIX_COEFFICIENTS_SMPTE2085 :: 11; SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL :: 12; SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL :: 13; SDL_MATRIX_COEFFICIENTS_ICTCP :: 14; SDL_MATRIX_COEFFICIENTS_CUSTOM :: 31; } /** * Colorspace chroma sample location. * * \since This enum is available since SDL 3.2.0. */ using SDL_ChromaLocation :: enum u32 { SDL_CHROMA_LOCATION_NONE :: 0; SDL_CHROMA_LOCATION_LEFT :: 1; SDL_CHROMA_LOCATION_CENTER :: 2; SDL_CHROMA_LOCATION_TOPLEFT :: 3; } /** * Colorspace definitions. * * Since similar colorspaces may vary in their details (matrix, transfer * function, etc.), this is not an exhaustive list, but rather a * representative sample of the kinds of colorspaces supported in SDL. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_ColorPrimaries * \sa SDL_ColorRange * \sa SDL_ColorType * \sa SDL_MatrixCoefficients * \sa SDL_TransferCharacteristics */ using SDL_Colorspace :: enum u32 { SDL_COLORSPACE_UNKNOWN :: 0; SDL_COLORSPACE_SRGB :: 301991328; SDL_COLORSPACE_SRGB_LINEAR :: 301991168; SDL_COLORSPACE_HDR10 :: 301999616; SDL_COLORSPACE_JPEG :: 570426566; SDL_COLORSPACE_BT601_LIMITED :: 554703046; SDL_COLORSPACE_BT601_FULL :: 571480262; SDL_COLORSPACE_BT709_LIMITED :: 554697761; SDL_COLORSPACE_BT709_FULL :: 571474977; SDL_COLORSPACE_BT2020_LIMITED :: 554706441; SDL_COLORSPACE_BT2020_FULL :: 571483657; SDL_COLORSPACE_RGB_DEFAULT :: 301991328; SDL_COLORSPACE_YUV_DEFAULT :: 570426566; } /** * A structure that represents a color as RGBA components. * * The bits of this structure can be directly reinterpreted as an * integer-packed color which uses the SDL_PIXELFORMAT_RGBA32 format * (SDL_PIXELFORMAT_ABGR8888 on little-endian systems and * SDL_PIXELFORMAT_RGBA8888 on big-endian systems). * * \since This struct is available since SDL 3.2.0. */ SDL_Color :: struct { r: Uint8; g: Uint8; b: Uint8; a: Uint8; } /** * The bits of this structure can be directly reinterpreted as a float-packed * color which uses the SDL_PIXELFORMAT_RGBA128_FLOAT format * * \since This struct is available since SDL 3.2.0. */ SDL_FColor :: struct { r: float; g: float; b: float; a: float; } /** * A set of indexed colors representing a palette. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_SetPaletteColors */ SDL_Palette :: struct { ncolors: s32; /**< number of elements in `colors`. */ colors: *SDL_Color; /**< an array of colors, `ncolors` long. */ version: Uint32; /**< internal use only, do not touch. */ refcount: s32; /**< internal use only, do not touch. */ } /** * Details about the format of a pixel. * * \since This struct is available since SDL 3.2.0. */ SDL_PixelFormatDetails :: struct { format: SDL_PixelFormat; bits_per_pixel: Uint8; bytes_per_pixel: Uint8; padding: [2] Uint8; Rmask: Uint32; Gmask: Uint32; Bmask: Uint32; Amask: Uint32; Rbits: Uint8; Gbits: Uint8; Bbits: Uint8; Abits: Uint8; Rshift: Uint8; Gshift: Uint8; Bshift: Uint8; Ashift: Uint8; } /** * Get the human readable name of a pixel format. * * \param format the pixel format to query. * \returns the human readable name of the specified pixel format or * "SDL_PIXELFORMAT_UNKNOWN" if the format isn't recognized. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetPixelFormatName :: (format: SDL_PixelFormat) -> *u8 #foreign libsdl3; /** * Convert one of the enumerated pixel formats to a bpp value and RGBA masks. * * \param format one of the SDL_PixelFormat values. * \param bpp a bits per pixel value; usually 15, 16, or 32. * \param Rmask a pointer filled in with the red mask for the format. * \param Gmask a pointer filled in with the green mask for the format. * \param Bmask a pointer filled in with the blue mask for the format. * \param Amask a pointer filled in with the alpha mask for the format. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatForMasks */ SDL_GetMasksForPixelFormat :: (format: SDL_PixelFormat, bpp: *s32, Rmask: *Uint32, Gmask: *Uint32, Bmask: *Uint32, Amask: *Uint32) -> bool #foreign libsdl3; /** * Convert a bpp value and RGBA masks to an enumerated pixel format. * * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't * possible. * * \param bpp a bits per pixel value; usually 15, 16, or 32. * \param Rmask the red mask for the format. * \param Gmask the green mask for the format. * \param Bmask the blue mask for the format. * \param Amask the alpha mask for the format. * \returns the SDL_PixelFormat value corresponding to the format masks, or * SDL_PIXELFORMAT_UNKNOWN if there isn't a match. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMasksForPixelFormat */ SDL_GetPixelFormatForMasks :: (bpp: s32, Rmask: Uint32, Gmask: Uint32, Bmask: Uint32, Amask: Uint32) -> SDL_PixelFormat #foreign libsdl3; /** * Create an SDL_PixelFormatDetails structure corresponding to a pixel format. * * Returned structure may come from a shared global cache (i.e. not newly * allocated), and hence should not be modified, especially the palette. Weird * errors such as `Blit combination not supported` may occur. * * \param format one of the SDL_PixelFormat values. * \returns a pointer to a SDL_PixelFormatDetails structure or NULL on * failure; call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetPixelFormatDetails :: (format: SDL_PixelFormat) -> *SDL_PixelFormatDetails #foreign libsdl3; /** * Create a palette structure with the specified number of color entries. * * The palette entries are initialized to white. * * \param ncolors represents the number of color entries in the color palette. * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if * there wasn't enough memory); call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyPalette * \sa SDL_SetPaletteColors * \sa SDL_SetSurfacePalette */ SDL_CreatePalette :: (ncolors: s32) -> *SDL_Palette #foreign libsdl3; /** * Set a range of colors in a palette. * * \param palette the SDL_Palette structure to modify. * \param colors an array of SDL_Color structures to copy into the palette. * \param firstcolor the index of the first palette entry to modify. * \param ncolors the number of entries to modify. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified or destroyed in another thread. * * \since This function is available since SDL 3.2.0. */ SDL_SetPaletteColors :: (palette: *SDL_Palette, colors: *SDL_Color, firstcolor: s32, ncolors: s32) -> bool #foreign libsdl3; /** * Free a palette created with SDL_CreatePalette(). * * \param palette the SDL_Palette structure to be freed. * * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified or destroyed in another thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreatePalette */ SDL_DestroyPalette :: (palette: *SDL_Palette) -> void #foreign libsdl3; /** * Map an RGB triple to an opaque pixel value for a given pixel format. * * This function maps the RGB color value to the specified pixel format and * returns the pixel value best approximating the given RGB color value for * the given pixel format. * * If the format has a palette (8-bit) the index of the closest matching color * in the palette will be returned. * * If the specified pixel format has an alpha component it will be returned as * all 1 bits (fully opaque). * * If the pixel format bpp (color depth) is less than 32-bpp then the unused * upper bits of the return value can safely be ignored (e.g., with a 16-bpp * format the return value can be assigned to a Uint16, and similarly a Uint8 * for an 8-bpp format). * * \param format a pointer to SDL_PixelFormatDetails describing the pixel * format. * \param palette an optional palette for indexed formats, may be NULL. * \param r the red component of the pixel in the range 0-255. * \param g the green component of the pixel in the range 0-255. * \param b the blue component of the pixel in the range 0-255. * \returns a pixel value. * * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatDetails * \sa SDL_GetRGB * \sa SDL_MapRGBA * \sa SDL_MapSurfaceRGB */ SDL_MapRGB :: (format: *SDL_PixelFormatDetails, palette: *SDL_Palette, r: Uint8, g: Uint8, b: Uint8) -> Uint32 #foreign libsdl3; /** * Map an RGBA quadruple to a pixel value for a given pixel format. * * This function maps the RGBA color value to the specified pixel format and * returns the pixel value best approximating the given RGBA color value for * the given pixel format. * * If the specified pixel format has no alpha component the alpha value will * be ignored (as it will be in formats with a palette). * * If the format has a palette (8-bit) the index of the closest matching color * in the palette will be returned. * * If the pixel format bpp (color depth) is less than 32-bpp then the unused * upper bits of the return value can safely be ignored (e.g., with a 16-bpp * format the return value can be assigned to a Uint16, and similarly a Uint8 * for an 8-bpp format). * * \param format a pointer to SDL_PixelFormatDetails describing the pixel * format. * \param palette an optional palette for indexed formats, may be NULL. * \param r the red component of the pixel in the range 0-255. * \param g the green component of the pixel in the range 0-255. * \param b the blue component of the pixel in the range 0-255. * \param a the alpha component of the pixel in the range 0-255. * \returns a pixel value. * * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatDetails * \sa SDL_GetRGBA * \sa SDL_MapRGB * \sa SDL_MapSurfaceRGBA */ SDL_MapRGBA :: (format: *SDL_PixelFormatDetails, palette: *SDL_Palette, r: Uint8, g: Uint8, b: Uint8, a: Uint8) -> Uint32 #foreign libsdl3; /** * Get RGB values from a pixel in the specified format. * * This function uses the entire 8-bit [0..255] range when converting color * components from pixel formats with less than 8-bits per RGB component * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). * * \param pixel a pixel value. * \param format a pointer to SDL_PixelFormatDetails describing the pixel * format. * \param palette an optional palette for indexed formats, may be NULL. * \param r a pointer filled in with the red component, may be NULL. * \param g a pointer filled in with the green component, may be NULL. * \param b a pointer filled in with the blue component, may be NULL. * * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatDetails * \sa SDL_GetRGBA * \sa SDL_MapRGB * \sa SDL_MapRGBA */ SDL_GetRGB :: (pixel: Uint32, format: *SDL_PixelFormatDetails, palette: *SDL_Palette, r: *Uint8, g: *Uint8, b: *Uint8) -> void #foreign libsdl3; /** * Get RGBA values from a pixel in the specified format. * * This function uses the entire 8-bit [0..255] range when converting color * components from pixel formats with less than 8-bits per RGB component * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). * * If the surface has no alpha component, the alpha will be returned as 0xff * (100% opaque). * * \param pixel a pixel value. * \param format a pointer to SDL_PixelFormatDetails describing the pixel * format. * \param palette an optional palette for indexed formats, may be NULL. * \param r a pointer filled in with the red component, may be NULL. * \param g a pointer filled in with the green component, may be NULL. * \param b a pointer filled in with the blue component, may be NULL. * \param a a pointer filled in with the alpha component, may be NULL. * * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPixelFormatDetails * \sa SDL_GetRGB * \sa SDL_MapRGB * \sa SDL_MapRGBA */ SDL_GetRGBA :: (pixel: Uint32, format: *SDL_PixelFormatDetails, palette: *SDL_Palette, r: *Uint8, g: *Uint8, b: *Uint8, a: *Uint8) -> void #foreign libsdl3; /** * The structure that defines a point (using integers). * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetRectEnclosingPoints * \sa SDL_PointInRect */ SDL_Point :: struct { x: s32; y: s32; } /** * The structure that defines a point (using floating point values). * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetRectEnclosingPointsFloat * \sa SDL_PointInRectFloat */ SDL_FPoint :: struct { x: float; y: float; } /** * A rectangle, with the origin at the upper left (using integers). * * \since This struct is available since SDL 3.2.0. * * \sa SDL_RectEmpty * \sa SDL_RectsEqual * \sa SDL_HasRectIntersection * \sa SDL_GetRectIntersection * \sa SDL_GetRectAndLineIntersection * \sa SDL_GetRectUnion * \sa SDL_GetRectEnclosingPoints */ SDL_Rect :: struct { x: s32; y: s32; w: s32; h: s32; } /** * A rectangle, with the origin at the upper left (using floating point * values). * * \since This struct is available since SDL 3.2.0. * * \sa SDL_RectEmptyFloat * \sa SDL_RectsEqualFloat * \sa SDL_RectsEqualEpsilon * \sa SDL_HasRectIntersectionFloat * \sa SDL_GetRectIntersectionFloat * \sa SDL_GetRectAndLineIntersectionFloat * \sa SDL_GetRectUnionFloat * \sa SDL_GetRectEnclosingPointsFloat * \sa SDL_PointInRectFloat */ SDL_FRect :: struct { x: float; y: float; w: float; h: float; } /** * Determine whether two rectangles intersect. * * If either pointer is NULL the function will return false. * * \param A an SDL_Rect structure representing the first rectangle. * \param B an SDL_Rect structure representing the second rectangle. * \returns true if there is an intersection, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRectIntersection */ SDL_HasRectIntersection :: (A: *SDL_Rect, B: *SDL_Rect) -> bool #foreign libsdl3; /** * Calculate the intersection of two rectangles. * * If `result` is NULL then this function will return false. * * \param A an SDL_Rect structure representing the first rectangle. * \param B an SDL_Rect structure representing the second rectangle. * \param result an SDL_Rect structure filled in with the intersection of * rectangles `A` and `B`. * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasRectIntersection */ SDL_GetRectIntersection :: (A: *SDL_Rect, B: *SDL_Rect, result: *SDL_Rect) -> bool #foreign libsdl3; /** * Calculate the union of two rectangles. * * \param A an SDL_Rect structure representing the first rectangle. * \param B an SDL_Rect structure representing the second rectangle. * \param result an SDL_Rect structure filled in with the union of rectangles * `A` and `B`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_GetRectUnion :: (A: *SDL_Rect, B: *SDL_Rect, result: *SDL_Rect) -> bool #foreign libsdl3; /** * Calculate a minimal rectangle enclosing a set of points. * * If `clip` is not NULL then only points inside of the clipping rectangle are * considered. * * \param points an array of SDL_Point structures representing points to be * enclosed. * \param count the number of structures in the `points` array. * \param clip an SDL_Rect used for clipping or NULL to enclose all points. * \param result an SDL_Rect structure filled in with the minimal enclosing * rectangle. * \returns true if any points were enclosed or false if all the points were * outside of the clipping rectangle. * * \since This function is available since SDL 3.2.0. */ SDL_GetRectEnclosingPoints :: (points: *SDL_Point, count: s32, clip: *SDL_Rect, result: *SDL_Rect) -> bool #foreign libsdl3; /** * Calculate the intersection of a rectangle and line segment. * * This function is used to clip a line segment to a rectangle. A line segment * contained entirely within the rectangle or that does not intersect will * remain unchanged. A line segment that crosses the rectangle at either or * both ends will be clipped to the boundary of the rectangle and the new * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. * * \param rect an SDL_Rect structure representing the rectangle to intersect. * \param X1 a pointer to the starting X-coordinate of the line. * \param Y1 a pointer to the starting Y-coordinate of the line. * \param X2 a pointer to the ending X-coordinate of the line. * \param Y2 a pointer to the ending Y-coordinate of the line. * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.2.0. */ SDL_GetRectAndLineIntersection :: (rect: *SDL_Rect, X1: *s32, Y1: *s32, X2: *s32, Y2: *s32) -> bool #foreign libsdl3; /** * Determine whether two rectangles intersect with float precision. * * If either pointer is NULL the function will return false. * * \param A an SDL_FRect structure representing the first rectangle. * \param B an SDL_FRect structure representing the second rectangle. * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRectIntersection */ SDL_HasRectIntersectionFloat :: (A: *SDL_FRect, B: *SDL_FRect) -> bool #foreign libsdl3; /** * Calculate the intersection of two rectangles with float precision. * * If `result` is NULL then this function will return false. * * \param A an SDL_FRect structure representing the first rectangle. * \param B an SDL_FRect structure representing the second rectangle. * \param result an SDL_FRect structure filled in with the intersection of * rectangles `A` and `B`. * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasRectIntersectionFloat */ SDL_GetRectIntersectionFloat :: (A: *SDL_FRect, B: *SDL_FRect, result: *SDL_FRect) -> bool #foreign libsdl3; /** * Calculate the union of two rectangles with float precision. * * \param A an SDL_FRect structure representing the first rectangle. * \param B an SDL_FRect structure representing the second rectangle. * \param result an SDL_FRect structure filled in with the union of rectangles * `A` and `B`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_GetRectUnionFloat :: (A: *SDL_FRect, B: *SDL_FRect, result: *SDL_FRect) -> bool #foreign libsdl3; /** * Calculate a minimal rectangle enclosing a set of points with float * precision. * * If `clip` is not NULL then only points inside of the clipping rectangle are * considered. * * \param points an array of SDL_FPoint structures representing points to be * enclosed. * \param count the number of structures in the `points` array. * \param clip an SDL_FRect used for clipping or NULL to enclose all points. * \param result an SDL_FRect structure filled in with the minimal enclosing * rectangle. * \returns true if any points were enclosed or false if all the points were * outside of the clipping rectangle. * * \since This function is available since SDL 3.2.0. */ SDL_GetRectEnclosingPointsFloat :: (points: *SDL_FPoint, count: s32, clip: *SDL_FRect, result: *SDL_FRect) -> bool #foreign libsdl3; /** * Calculate the intersection of a rectangle and line segment with float * precision. * * This function is used to clip a line segment to a rectangle. A line segment * contained entirely within the rectangle or that does not intersect will * remain unchanged. A line segment that crosses the rectangle at either or * both ends will be clipped to the boundary of the rectangle and the new * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. * * \param rect an SDL_FRect structure representing the rectangle to intersect. * \param X1 a pointer to the starting X-coordinate of the line. * \param Y1 a pointer to the starting Y-coordinate of the line. * \param X2 a pointer to the ending X-coordinate of the line. * \param Y2 a pointer to the ending Y-coordinate of the line. * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.2.0. */ SDL_GetRectAndLineIntersectionFloat :: (rect: *SDL_FRect, X1: *float, Y1: *float, X2: *float, Y2: *float) -> bool #foreign libsdl3; /** * The flags on an SDL_Surface. * * These are generally considered read-only. * * \since This datatype is available since SDL 3.2.0. */ SDL_SurfaceFlags :: Uint32; /** * The scaling mode. * * \since This enum is available since SDL 3.2.0. */ using SDL_ScaleMode :: enum u32 { SDL_SCALEMODE_NEAREST :: 0; SDL_SCALEMODE_LINEAR :: 1; } /** * The flip mode. * * \since This enum is available since SDL 3.2.0. */ using SDL_FlipMode :: enum u32 { SDL_FLIP_NONE :: 0; SDL_FLIP_HORIZONTAL :: 1; SDL_FLIP_VERTICAL :: 2; } /** * A collection of pixels used in software blitting. * * Pixels are arranged in memory in rows, with the top row first. Each row * occupies an amount of memory given by the pitch (sometimes known as the row * stride in non-SDL APIs). * * Within each row, pixels are arranged from left to right until the width is * reached. Each pixel occupies a number of bits appropriate for its format, * with most formats representing each pixel as one or more whole bytes (in * some indexed formats, instead multiple pixels are packed into each byte), * and a byte order given by the format. After encoding all pixels, any * remaining bytes to reach the pitch are used as padding to reach a desired * alignment, and have undefined contents. * * When a surface holds YUV format data, the planes are assumed to be * contiguous without padding between them, e.g. a 32x32 surface in NV12 * format with a pitch of 32 would consist of 32x32 bytes of Y plane followed * by 32x16 bytes of UV plane. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateSurface * \sa SDL_DestroySurface */ SDL_Surface :: struct { flags: SDL_SurfaceFlags; /**< The flags of the surface, read-only */ format: SDL_PixelFormat; /**< The format of the surface, read-only */ w: s32; /**< The width of the surface, read-only. */ h: s32; /**< The height of the surface, read-only. */ pitch: s32; /**< The distance in bytes between rows of pixels, read-only */ pixels: *void; /**< A pointer to the pixels of the surface, the pixels are writeable if non-NULL */ refcount: s32; /**< Application reference count, used when freeing surface */ reserved: *void; /**< Reserved for internal use */ } /** * Allocate a new surface with a specific pixel format. * * The pixels of the new surface are initialized to zero. * * \param width the width of the surface. * \param height the height of the surface. * \param format the SDL_PixelFormat for the new surface's pixel format. * \returns the new SDL_Surface structure that is created or NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateSurfaceFrom * \sa SDL_DestroySurface */ SDL_CreateSurface :: (width: s32, height: s32, format: SDL_PixelFormat) -> *SDL_Surface #foreign libsdl3; /** * Allocate a new surface with a specific pixel format and existing pixel * data. * * No copy is made of the pixel data. Pixel data is not managed automatically; * you must free the surface before you free the pixel data. * * Pitch is the offset in bytes from one row of pixels to the next, e.g. * `width*4` for `SDL_PIXELFORMAT_RGBA8888`. * * You may pass NULL for pixels and 0 for pitch to create a surface that you * will fill in with valid values later. * * \param width the width of the surface. * \param height the height of the surface. * \param format the SDL_PixelFormat for the new surface's pixel format. * \param pixels a pointer to existing pixel data. * \param pitch the number of bytes between each row, including padding. * \returns the new SDL_Surface structure that is created or NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateSurface * \sa SDL_DestroySurface */ SDL_CreateSurfaceFrom :: (width: s32, height: s32, format: SDL_PixelFormat, pixels: *void, pitch: s32) -> *SDL_Surface #foreign libsdl3; /** * Free a surface. * * It is safe to pass NULL to this function. * * \param surface the SDL_Surface to free. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateSurface * \sa SDL_CreateSurfaceFrom */ SDL_DestroySurface :: (surface: *SDL_Surface) -> void #foreign libsdl3; /** * Get the properties associated with a surface. * * The following properties are understood by SDL: * * - `SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point * surfaces, this defines the value of 100% diffuse white, with higher * values being displayed in the High Dynamic Range headroom. This defaults * to 203 for HDR10 surfaces and 1.0 for floating point surfaces. * - `SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point * surfaces, this defines the maximum dynamic range used by the content, in * terms of the SDR white point. This defaults to 0.0, which disables tone * mapping. * - `SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING`: the tone mapping operator * used when compressing from a surface with high dynamic range to another * with lower dynamic range. Currently this supports "chrome", which uses * the same tone mapping that Chrome uses for HDR content, the form "*=N", * where N is a floating point scale factor applied in linear space, and * "none", which disables tone mapping. This defaults to "chrome". * * \param surface the SDL_Surface structure to query. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetSurfaceProperties :: (surface: *SDL_Surface) -> SDL_PropertiesID #foreign libsdl3; /** * Set the colorspace used by a surface. * * Setting the colorspace doesn't change the pixels, only how they are * interpreted in color operations. * * \param surface the SDL_Surface structure to update. * \param colorspace an SDL_Colorspace value describing the surface * colorspace. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceColorspace */ SDL_SetSurfaceColorspace :: (surface: *SDL_Surface, colorspace: SDL_Colorspace) -> bool #foreign libsdl3; /** * Get the colorspace used by a surface. * * The colorspace defaults to SDL_COLORSPACE_SRGB_LINEAR for floating point * formats, SDL_COLORSPACE_HDR10 for 10-bit formats, SDL_COLORSPACE_SRGB for * other RGB surfaces and SDL_COLORSPACE_BT709_FULL for YUV textures. * * \param surface the SDL_Surface structure to query. * \returns the colorspace used by the surface, or SDL_COLORSPACE_UNKNOWN if * the surface is NULL. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceColorspace */ SDL_GetSurfaceColorspace :: (surface: *SDL_Surface) -> SDL_Colorspace #foreign libsdl3; /** * Create a palette and associate it with a surface. * * This function creates a palette compatible with the provided surface. The * palette is then returned for you to modify, and the surface will * automatically use the new palette in future operations. You do not need to * destroy the returned palette, it will be freed when the reference count * reaches 0, usually when the surface is destroyed. * * Bitmap surfaces (with format SDL_PIXELFORMAT_INDEX1LSB or * SDL_PIXELFORMAT_INDEX1MSB) will have the palette initialized with 0 as * white and 1 as black. Other surfaces will get a palette initialized with * white in every entry. * * If this function is called for a surface that already has a palette, a new * palette will be created to replace it. * * \param surface the SDL_Surface structure to update. * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if * the surface didn't have an index format); call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetPaletteColors */ SDL_CreateSurfacePalette :: (surface: *SDL_Surface) -> *SDL_Palette #foreign libsdl3; /** * Set the palette used by a surface. * * A single palette can be shared with many surfaces. * * \param surface the SDL_Surface structure to update. * \param palette the SDL_Palette structure to use. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreatePalette * \sa SDL_GetSurfacePalette */ SDL_SetSurfacePalette :: (surface: *SDL_Surface, palette: *SDL_Palette) -> bool #foreign libsdl3; /** * Get the palette used by a surface. * * \param surface the SDL_Surface structure to query. * \returns a pointer to the palette used by the surface, or NULL if there is * no palette used. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfacePalette */ SDL_GetSurfacePalette :: (surface: *SDL_Surface) -> *SDL_Palette #foreign libsdl3; /** * Add an alternate version of a surface. * * This function adds an alternate version of this surface, usually used for * content with high DPI representations like cursors or icons. The size, * format, and content do not need to match the original surface, and these * alternate versions will not be updated when the original surface changes. * * This function adds a reference to the alternate version, so you should call * SDL_DestroySurface() on the image after this call. * * \param surface the SDL_Surface structure to update. * \param image a pointer to an alternate SDL_Surface to associate with this * surface. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RemoveSurfaceAlternateImages * \sa SDL_GetSurfaceImages * \sa SDL_SurfaceHasAlternateImages */ SDL_AddSurfaceAlternateImage :: (surface: *SDL_Surface, image: *SDL_Surface) -> bool #foreign libsdl3; /** * Return whether a surface has alternate versions available. * * \param surface the SDL_Surface structure to query. * \returns true if alternate versions are available or false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddSurfaceAlternateImage * \sa SDL_RemoveSurfaceAlternateImages * \sa SDL_GetSurfaceImages */ SDL_SurfaceHasAlternateImages :: (surface: *SDL_Surface) -> bool #foreign libsdl3; /** * Get an array including all versions of a surface. * * This returns all versions of a surface, with the surface being queried as * the first element in the returned array. * * Freeing the array of surfaces does not affect the surfaces in the array. * They are still referenced by the surface being queried and will be cleaned * up normally. * * \param surface the SDL_Surface structure to query. * \param count a pointer filled in with the number of surface pointers * returned, may be NULL. * \returns a NULL terminated array of SDL_Surface pointers or NULL on * failure; call SDL_GetError() for more information. This should be * freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddSurfaceAlternateImage * \sa SDL_RemoveSurfaceAlternateImages * \sa SDL_SurfaceHasAlternateImages */ SDL_GetSurfaceImages :: (surface: *SDL_Surface, count: *s32) -> **SDL_Surface #foreign libsdl3; /** * Remove all alternate versions of a surface. * * This function removes a reference from all the alternative versions, * destroying them if this is the last reference to them. * * \param surface the SDL_Surface structure to update. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddSurfaceAlternateImage * \sa SDL_GetSurfaceImages * \sa SDL_SurfaceHasAlternateImages */ SDL_RemoveSurfaceAlternateImages :: (surface: *SDL_Surface) -> void #foreign libsdl3; /** * Set up a surface for directly accessing the pixels. * * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write to * and read from `surface->pixels`, using the pixel format stored in * `surface->format`. Once you are done accessing the surface, you should use * SDL_UnlockSurface() to release it. * * Not all surfaces require locking. If `SDL_MUSTLOCK(surface)` evaluates to * 0, then you can read and write to the surface at any time, and the pixel * format of the surface will not change. * * \param surface the SDL_Surface structure to be locked. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_MUSTLOCK * \sa SDL_UnlockSurface */ SDL_LockSurface :: (surface: *SDL_Surface) -> bool #foreign libsdl3; /** * Release a surface after directly accessing the pixels. * * \param surface the SDL_Surface structure to be unlocked. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockSurface */ SDL_UnlockSurface :: (surface: *SDL_Surface) -> void #foreign libsdl3; /** * Load a BMP image from a seekable SDL data stream. * * The new surface should be freed with SDL_DestroySurface(). Not doing so * will result in a memory leak. * * \param src the data stream for the surface. * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even * in the case of an error. * \returns a pointer to a new SDL_Surface structure or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySurface * \sa SDL_LoadBMP * \sa SDL_SaveBMP_IO */ SDL_LoadBMP_IO :: (src: *SDL_IOStream, closeio: bool) -> *SDL_Surface #foreign libsdl3; /** * Load a BMP image from a file. * * The new surface should be freed with SDL_DestroySurface(). Not doing so * will result in a memory leak. * * \param file the BMP file to load. * \returns a pointer to a new SDL_Surface structure or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySurface * \sa SDL_LoadBMP_IO * \sa SDL_SaveBMP */ SDL_LoadBMP :: (file: *u8) -> *SDL_Surface #foreign libsdl3; /** * Save a surface to a seekable SDL data stream in BMP format. * * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the * BMP directly. Other RGB formats with 8-bit or higher get converted to a * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are * not supported. * * \param surface the SDL_Surface structure containing the image to be saved. * \param dst a data stream to save to. * \param closeio if true, calls SDL_CloseIO() on `dst` before returning, even * in the case of an error. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadBMP_IO * \sa SDL_SaveBMP */ SDL_SaveBMP_IO :: (surface: *SDL_Surface, dst: *SDL_IOStream, closeio: bool) -> bool #foreign libsdl3; /** * Save a surface to a file. * * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the * BMP directly. Other RGB formats with 8-bit or higher get converted to a * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are * not supported. * * \param surface the SDL_Surface structure containing the image to be saved. * \param file a file to save to. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadBMP * \sa SDL_SaveBMP_IO */ SDL_SaveBMP :: (surface: *SDL_Surface, file: *u8) -> bool #foreign libsdl3; /** * Set the RLE acceleration hint for a surface. * * If RLE is enabled, color key and alpha blending blits are much faster, but * the surface must be locked before directly accessing the pixels. * * \param surface the SDL_Surface structure to optimize. * \param enabled true to enable RLE acceleration, false to disable it. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface * \sa SDL_LockSurface * \sa SDL_UnlockSurface */ SDL_SetSurfaceRLE :: (surface: *SDL_Surface, enabled: bool) -> bool #foreign libsdl3; /** * Returns whether the surface is RLE enabled. * * It is safe to pass a NULL `surface` here; it will return false. * * \param surface the SDL_Surface structure to query. * \returns true if the surface is RLE enabled, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceRLE */ SDL_SurfaceHasRLE :: (surface: *SDL_Surface) -> bool #foreign libsdl3; /** * Set the color key (transparent pixel) in a surface. * * The color key defines a pixel value that will be treated as transparent in * a blit. For example, one can use this to specify that cyan pixels should be * considered transparent, and therefore not rendered. * * It is a pixel of the format used by the surface, as generated by * SDL_MapRGB(). * * \param surface the SDL_Surface structure to update. * \param enabled true to enable color key, false to disable color key. * \param key the transparent pixel. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceColorKey * \sa SDL_SetSurfaceRLE * \sa SDL_SurfaceHasColorKey */ SDL_SetSurfaceColorKey :: (surface: *SDL_Surface, enabled: bool, key: Uint32) -> bool #foreign libsdl3; /** * Returns whether the surface has a color key. * * It is safe to pass a NULL `surface` here; it will return false. * * \param surface the SDL_Surface structure to query. * \returns true if the surface has a color key, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceColorKey * \sa SDL_GetSurfaceColorKey */ SDL_SurfaceHasColorKey :: (surface: *SDL_Surface) -> bool #foreign libsdl3; /** * Get the color key (transparent pixel) for a surface. * * The color key is a pixel of the format used by the surface, as generated by * SDL_MapRGB(). * * If the surface doesn't have color key enabled this function returns false. * * \param surface the SDL_Surface structure to query. * \param key a pointer filled in with the transparent pixel. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceColorKey * \sa SDL_SurfaceHasColorKey */ SDL_GetSurfaceColorKey :: (surface: *SDL_Surface, key: *Uint32) -> bool #foreign libsdl3; /** * Set an additional color value multiplied into blit operations. * * When this surface is blitted, during the blit operation each source color * channel is modulated by the appropriate color value according to the * following formula: * * `srcC = srcC * (color / 255)` * * \param surface the SDL_Surface structure to update. * \param r the red color value multiplied into blit operations. * \param g the green color value multiplied into blit operations. * \param b the blue color value multiplied into blit operations. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceColorMod * \sa SDL_SetSurfaceAlphaMod */ SDL_SetSurfaceColorMod :: (surface: *SDL_Surface, r: Uint8, g: Uint8, b: Uint8) -> bool #foreign libsdl3; /** * Get the additional color value multiplied into blit operations. * * \param surface the SDL_Surface structure to query. * \param r a pointer filled in with the current red color value. * \param g a pointer filled in with the current green color value. * \param b a pointer filled in with the current blue color value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceAlphaMod * \sa SDL_SetSurfaceColorMod */ SDL_GetSurfaceColorMod :: (surface: *SDL_Surface, r: *Uint8, g: *Uint8, b: *Uint8) -> bool #foreign libsdl3; /** * Set an additional alpha value used in blit operations. * * When this surface is blitted, during the blit operation the source alpha * value is modulated by this alpha value according to the following formula: * * `srcA = srcA * (alpha / 255)` * * \param surface the SDL_Surface structure to update. * \param alpha the alpha value multiplied into blit operations. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceAlphaMod * \sa SDL_SetSurfaceColorMod */ SDL_SetSurfaceAlphaMod :: (surface: *SDL_Surface, alpha: Uint8) -> bool #foreign libsdl3; /** * Get the additional alpha value used in blit operations. * * \param surface the SDL_Surface structure to query. * \param alpha a pointer filled in with the current alpha value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceColorMod * \sa SDL_SetSurfaceAlphaMod */ SDL_GetSurfaceAlphaMod :: (surface: *SDL_Surface, alpha: *Uint8) -> bool #foreign libsdl3; /** * Set the blend mode used for blit operations. * * To copy a surface to another surface (or texture) without blending with the * existing data, the blendmode of the SOURCE surface should be set to * `SDL_BLENDMODE_NONE`. * * \param surface the SDL_Surface structure to update. * \param blendMode the SDL_BlendMode to use for blit blending. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceBlendMode */ SDL_SetSurfaceBlendMode :: (surface: *SDL_Surface, blendMode: SDL_BlendMode) -> bool #foreign libsdl3; /** * Get the blend mode used for blit operations. * * \param surface the SDL_Surface structure to query. * \param blendMode a pointer filled in with the current SDL_BlendMode. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceBlendMode */ SDL_GetSurfaceBlendMode :: (surface: *SDL_Surface, blendMode: *SDL_BlendMode) -> bool #foreign libsdl3; /** * Set the clipping rectangle for a surface. * * When `surface` is the destination of a blit, only the area within the clip * rectangle is drawn into. * * Note that blits are automatically clipped to the edges of the source and * destination surfaces. * * \param surface the SDL_Surface structure to be clipped. * \param rect the SDL_Rect structure representing the clipping rectangle, or * NULL to disable clipping. * \returns true if the rectangle intersects the surface, otherwise false and * blits will be completely clipped. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetSurfaceClipRect */ SDL_SetSurfaceClipRect :: (surface: *SDL_Surface, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Get the clipping rectangle for a surface. * * When `surface` is the destination of a blit, only the area within the clip * rectangle is drawn into. * * \param surface the SDL_Surface structure representing the surface to be * clipped. * \param rect an SDL_Rect structure filled in with the clipping rectangle for * the surface. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetSurfaceClipRect */ SDL_GetSurfaceClipRect :: (surface: *SDL_Surface, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Flip a surface vertically or horizontally. * * \param surface the surface to flip. * \param flip the direction to flip. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_FlipSurface :: (surface: *SDL_Surface, flip: SDL_FlipMode) -> bool #foreign libsdl3; /** * Creates a new surface identical to the existing surface. * * If the original surface has alternate images, the new surface will have a * reference to them as well. * * The returned surface should be freed with SDL_DestroySurface(). * * \param surface the surface to duplicate. * \returns a copy of the surface or NULL on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySurface */ SDL_DuplicateSurface :: (surface: *SDL_Surface) -> *SDL_Surface #foreign libsdl3; /** * Creates a new surface identical to the existing surface, scaled to the * desired size. * * The returned surface should be freed with SDL_DestroySurface(). * * \param surface the surface to duplicate and scale. * \param width the width of the new surface. * \param height the height of the new surface. * \param scaleMode the SDL_ScaleMode to be used. * \returns a copy of the surface or NULL on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroySurface */ SDL_ScaleSurface :: (surface: *SDL_Surface, width: s32, height: s32, scaleMode: SDL_ScaleMode) -> *SDL_Surface #foreign libsdl3; /** * Copy an existing surface to a new surface of the specified format. * * This function is used to optimize images for faster *repeat* blitting. This * is accomplished by converting the original and storing the result as a new * surface. The new, optimized surface can then be used as the source for * future blits, making them faster. * * If you are converting to an indexed surface and want to map colors to a * palette, you can use SDL_ConvertSurfaceAndColorspace() instead. * * If the original surface has alternate images, the new surface will have a * reference to them as well. * * \param surface the existing SDL_Surface structure to convert. * \param format the new pixel format. * \returns the new SDL_Surface structure that is created or NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertSurfaceAndColorspace * \sa SDL_DestroySurface */ SDL_ConvertSurface :: (surface: *SDL_Surface, format: SDL_PixelFormat) -> *SDL_Surface #foreign libsdl3; /** * Copy an existing surface to a new surface of the specified format and * colorspace. * * This function converts an existing surface to a new format and colorspace * and returns the new surface. This will perform any pixel format and * colorspace conversion needed. * * If the original surface has alternate images, the new surface will have a * reference to them as well. * * \param surface the existing SDL_Surface structure to convert. * \param format the new pixel format. * \param palette an optional palette to use for indexed formats, may be NULL. * \param colorspace the new colorspace. * \param props an SDL_PropertiesID with additional color properties, or 0. * \returns the new SDL_Surface structure that is created or NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertSurface * \sa SDL_DestroySurface */ SDL_ConvertSurfaceAndColorspace :: (surface: *SDL_Surface, format: SDL_PixelFormat, palette: *SDL_Palette, colorspace: SDL_Colorspace, props: SDL_PropertiesID) -> *SDL_Surface #foreign libsdl3; /** * Copy a block of pixels of one format to another format. * * \param width the width of the block to copy, in pixels. * \param height the height of the block to copy, in pixels. * \param src_format an SDL_PixelFormat value of the `src` pixels format. * \param src a pointer to the source pixels. * \param src_pitch the pitch of the source pixels, in bytes. * \param dst_format an SDL_PixelFormat value of the `dst` pixels format. * \param dst a pointer to be filled in with new pixel data. * \param dst_pitch the pitch of the destination pixels, in bytes. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertPixelsAndColorspace */ SDL_ConvertPixels :: (width: s32, height: s32, src_format: SDL_PixelFormat, src: *void, src_pitch: s32, dst_format: SDL_PixelFormat, dst: *void, dst_pitch: s32) -> bool #foreign libsdl3; /** * Copy a block of pixels of one format and colorspace to another format and * colorspace. * * \param width the width of the block to copy, in pixels. * \param height the height of the block to copy, in pixels. * \param src_format an SDL_PixelFormat value of the `src` pixels format. * \param src_colorspace an SDL_Colorspace value describing the colorspace of * the `src` pixels. * \param src_properties an SDL_PropertiesID with additional source color * properties, or 0. * \param src a pointer to the source pixels. * \param src_pitch the pitch of the source pixels, in bytes. * \param dst_format an SDL_PixelFormat value of the `dst` pixels format. * \param dst_colorspace an SDL_Colorspace value describing the colorspace of * the `dst` pixels. * \param dst_properties an SDL_PropertiesID with additional destination color * properties, or 0. * \param dst a pointer to be filled in with new pixel data. * \param dst_pitch the pitch of the destination pixels, in bytes. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertPixels */ SDL_ConvertPixelsAndColorspace :: (width: s32, height: s32, src_format: SDL_PixelFormat, src_colorspace: SDL_Colorspace, src_properties: SDL_PropertiesID, src: *void, src_pitch: s32, dst_format: SDL_PixelFormat, dst_colorspace: SDL_Colorspace, dst_properties: SDL_PropertiesID, dst: *void, dst_pitch: s32) -> bool #foreign libsdl3; /** * Premultiply the alpha on a block of pixels. * * This is safe to use with src == dst, but not for other overlapping areas. * * \param width the width of the block to convert, in pixels. * \param height the height of the block to convert, in pixels. * \param src_format an SDL_PixelFormat value of the `src` pixels format. * \param src a pointer to the source pixels. * \param src_pitch the pitch of the source pixels, in bytes. * \param dst_format an SDL_PixelFormat value of the `dst` pixels format. * \param dst a pointer to be filled in with premultiplied pixel data. * \param dst_pitch the pitch of the destination pixels, in bytes. * \param linear true to convert from sRGB to linear space for the alpha * multiplication, false to do multiplication in sRGB space. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_PremultiplyAlpha :: (width: s32, height: s32, src_format: SDL_PixelFormat, src: *void, src_pitch: s32, dst_format: SDL_PixelFormat, dst: *void, dst_pitch: s32, linear: bool) -> bool #foreign libsdl3; /** * Premultiply the alpha in a surface. * * This is safe to use with src == dst, but not for other overlapping areas. * * \param surface the surface to modify. * \param linear true to convert from sRGB to linear space for the alpha * multiplication, false to do multiplication in sRGB space. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_PremultiplySurfaceAlpha :: (surface: *SDL_Surface, linear: bool) -> bool #foreign libsdl3; /** * Clear a surface with a specific color, with floating point precision. * * This function handles all surface formats, and ignores any clip rectangle. * * If the surface is YUV, the color is assumed to be in the sRGB colorspace, * otherwise the color is assumed to be in the colorspace of the suface. * * \param surface the SDL_Surface to clear. * \param r the red component of the pixel, normally in the range 0-1. * \param g the green component of the pixel, normally in the range 0-1. * \param b the blue component of the pixel, normally in the range 0-1. * \param a the alpha component of the pixel, normally in the range 0-1. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_ClearSurface :: (surface: *SDL_Surface, r: float, g: float, b: float, a: float) -> bool #foreign libsdl3; /** * Perform a fast fill of a rectangle with a specific color. * * `color` should be a pixel of the format used by the surface, and can be * generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an * alpha component then the destination is simply filled with that alpha * information, no blending takes place. * * If there is a clip rectangle set on the destination (set via * SDL_SetSurfaceClipRect()), then this function will fill based on the * intersection of the clip rectangle and `rect`. * * \param dst the SDL_Surface structure that is the drawing target. * \param rect the SDL_Rect structure representing the rectangle to fill, or * NULL to fill the entire surface. * \param color the color to fill with. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_FillSurfaceRects */ SDL_FillSurfaceRect :: (dst: *SDL_Surface, rect: *SDL_Rect, color: Uint32) -> bool #foreign libsdl3; /** * Perform a fast fill of a set of rectangles with a specific color. * * `color` should be a pixel of the format used by the surface, and can be * generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an * alpha component then the destination is simply filled with that alpha * information, no blending takes place. * * If there is a clip rectangle set on the destination (set via * SDL_SetSurfaceClipRect()), then this function will fill based on the * intersection of the clip rectangle and `rect`. * * \param dst the SDL_Surface structure that is the drawing target. * \param rects an array of SDL_Rects representing the rectangles to fill. * \param count the number of rectangles in the array. * \param color the color to fill with. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_FillSurfaceRect */ SDL_FillSurfaceRects :: (dst: *SDL_Surface, rects: *SDL_Rect, count: s32, color: Uint32) -> bool #foreign libsdl3; /** * Performs a fast blit from the source surface to the destination surface * with clipping. * * If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or * `dst`) is copied while ensuring clipping to `dst->clip_rect`. * * The final blit rectangles are saved in `srcrect` and `dstrect` after all * clipping is performed. * * The blit function should not be called on a locked surface. * * The blit semantics for surfaces with and without blending and colorkey are * defined as follows: * * ``` * RGBA->RGB: * Source surface blend mode set to SDL_BLENDMODE_BLEND: * alpha-blend (using the source alpha-channel and per-surface alpha) * SDL_SRCCOLORKEY ignored. * Source surface blend mode set to SDL_BLENDMODE_NONE: * copy RGB. * if SDL_SRCCOLORKEY set, only copy the pixels that do not match the * RGB values of the source color key, ignoring alpha in the * comparison. * * RGB->RGBA: * Source surface blend mode set to SDL_BLENDMODE_BLEND: * alpha-blend (using the source per-surface alpha) * Source surface blend mode set to SDL_BLENDMODE_NONE: * copy RGB, set destination alpha to source per-surface alpha value. * both: * if SDL_SRCCOLORKEY set, only copy the pixels that do not match the * source color key. * * RGBA->RGBA: * Source surface blend mode set to SDL_BLENDMODE_BLEND: * alpha-blend (using the source alpha-channel and per-surface alpha) * SDL_SRCCOLORKEY ignored. * Source surface blend mode set to SDL_BLENDMODE_NONE: * copy all of RGBA to the destination. * if SDL_SRCCOLORKEY set, only copy the pixels that do not match the * RGB values of the source color key, ignoring alpha in the * comparison. * * RGB->RGB: * Source surface blend mode set to SDL_BLENDMODE_BLEND: * alpha-blend (using the source per-surface alpha) * Source surface blend mode set to SDL_BLENDMODE_NONE: * copy RGB. * both: * if SDL_SRCCOLORKEY set, only copy the pixels that do not match the * source color key. * ``` * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be * copied, or NULL to copy the entire surface. * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the x and y position in * the destination surface, or NULL for (0,0). The width and * height are ignored, and are copied from `srcrect`. If you * want a specific width and height, you should use * SDL_BlitSurfaceScaled(). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface * from multiple threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurfaceScaled */ SDL_BlitSurface :: (src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> bool #foreign libsdl3; /** * Perform low-level surface blitting only. * * This is a semi-private blit function and it performs low-level surface * blitting, assuming the input rectangles have already been clipped. * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be * copied, may not be NULL. * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, may not be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface * from multiple threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ SDL_BlitSurfaceUnchecked :: (src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> bool #foreign libsdl3; /** * Perform a scaled blit to a destination surface, which may be of a different * format. * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be * copied, or NULL to copy the entire surface. * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, or NULL to fill the entire * destination surface. * \param scaleMode the SDL_ScaleMode to be used. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface * from multiple threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ SDL_BlitSurfaceScaled :: (src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect, scaleMode: SDL_ScaleMode) -> bool #foreign libsdl3; /** * Perform low-level surface scaled blitting only. * * This is a semi-private function and it performs low-level surface blitting, * assuming the input rectangles have already been clipped. * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be * copied, may not be NULL. * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, may not be NULL. * \param scaleMode the SDL_ScaleMode to be used. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface * from multiple threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurfaceScaled */ SDL_BlitSurfaceUncheckedScaled :: (src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect, scaleMode: SDL_ScaleMode) -> bool #foreign libsdl3; /** * Perform a tiled blit to a destination surface, which may be of a different * format. * * The pixels in `srcrect` will be repeated as many times as needed to * completely fill `dstrect`. * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be * copied, or NULL to copy the entire surface. * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, or NULL to fill the entire surface. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface * from multiple threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ SDL_BlitSurfaceTiled :: (src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> bool #foreign libsdl3; /** * Perform a scaled and tiled blit to a destination surface, which may be of a * different format. * * The pixels in `srcrect` will be scaled and repeated as many times as needed * to completely fill `dstrect`. * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be * copied, or NULL to copy the entire surface. * \param scale the scale used to transform srcrect into the destination * rectangle, e.g. a 32x32 texture with a scale of 2 would fill * 64x64 tiles. * \param scaleMode scale algorithm to be used. * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, or NULL to fill the entire surface. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface * from multiple threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ SDL_BlitSurfaceTiledWithScale :: (src: *SDL_Surface, srcrect: *SDL_Rect, scale: float, scaleMode: SDL_ScaleMode, dst: *SDL_Surface, dstrect: *SDL_Rect) -> bool #foreign libsdl3; /** * Perform a scaled blit using the 9-grid algorithm to a destination surface, * which may be of a different format. * * The pixels in the source surface are split into a 3x3 grid, using the * different corner sizes for each corner, and the sides and center making up * the remaining pixels. The corners are then scaled using `scale` and fit * into the corners of the destination rectangle. The sides and center are * then stretched into place to cover the remaining destination rectangle. * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be used * for the 9-grid, or NULL to use the entire surface. * \param left_width the width, in pixels, of the left corners in `srcrect`. * \param right_width the width, in pixels, of the right corners in `srcrect`. * \param top_height the height, in pixels, of the top corners in `srcrect`. * \param bottom_height the height, in pixels, of the bottom corners in * `srcrect`. * \param scale the scale used to transform the corner of `srcrect` into the * corner of `dstrect`, or 0.0f for an unscaled blit. * \param scaleMode scale algorithm to be used. * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, or NULL to fill the entire surface. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface * from multiple threads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BlitSurface */ SDL_BlitSurface9Grid :: (src: *SDL_Surface, srcrect: *SDL_Rect, left_width: s32, right_width: s32, top_height: s32, bottom_height: s32, scale: float, scaleMode: SDL_ScaleMode, dst: *SDL_Surface, dstrect: *SDL_Rect) -> bool #foreign libsdl3; /** * Map an RGB triple to an opaque pixel value for a surface. * * This function maps the RGB color value to the specified pixel format and * returns the pixel value best approximating the given RGB color value for * the given pixel format. * * If the surface has a palette, the index of the closest matching color in * the palette will be returned. * * If the surface pixel format has an alpha component it will be returned as * all 1 bits (fully opaque). * * If the pixel format bpp (color depth) is less than 32-bpp then the unused * upper bits of the return value can safely be ignored (e.g., with a 16-bpp * format the return value can be assigned to a Uint16, and similarly a Uint8 * for an 8-bpp format). * * \param surface the surface to use for the pixel format and palette. * \param r the red component of the pixel in the range 0-255. * \param g the green component of the pixel in the range 0-255. * \param b the blue component of the pixel in the range 0-255. * \returns a pixel value. * * \since This function is available since SDL 3.2.0. * * \sa SDL_MapSurfaceRGBA */ SDL_MapSurfaceRGB :: (surface: *SDL_Surface, r: Uint8, g: Uint8, b: Uint8) -> Uint32 #foreign libsdl3; /** * Map an RGBA quadruple to a pixel value for a surface. * * This function maps the RGBA color value to the specified pixel format and * returns the pixel value best approximating the given RGBA color value for * the given pixel format. * * If the surface pixel format has no alpha component the alpha value will be * ignored (as it will be in formats with a palette). * * If the surface has a palette, the index of the closest matching color in * the palette will be returned. * * If the pixel format bpp (color depth) is less than 32-bpp then the unused * upper bits of the return value can safely be ignored (e.g., with a 16-bpp * format the return value can be assigned to a Uint16, and similarly a Uint8 * for an 8-bpp format). * * \param surface the surface to use for the pixel format and palette. * \param r the red component of the pixel in the range 0-255. * \param g the green component of the pixel in the range 0-255. * \param b the blue component of the pixel in the range 0-255. * \param a the alpha component of the pixel in the range 0-255. * \returns a pixel value. * * \since This function is available since SDL 3.2.0. * * \sa SDL_MapSurfaceRGB */ SDL_MapSurfaceRGBA :: (surface: *SDL_Surface, r: Uint8, g: Uint8, b: Uint8, a: Uint8) -> Uint32 #foreign libsdl3; /** * Retrieves a single pixel from a surface. * * This function prioritizes correctness over speed: it is suitable for unit * tests, but is not intended for use in a game engine. * * Like SDL_GetRGBA, this uses the entire 0..255 range when converting color * components from pixel formats with less than 8 bits per RGB component. * * \param surface the surface to read. * \param x the horizontal coordinate, 0 <= x < width. * \param y the vertical coordinate, 0 <= y < height. * \param r a pointer filled in with the red channel, 0-255, or NULL to ignore * this channel. * \param g a pointer filled in with the green channel, 0-255, or NULL to * ignore this channel. * \param b a pointer filled in with the blue channel, 0-255, or NULL to * ignore this channel. * \param a a pointer filled in with the alpha channel, 0-255, or NULL to * ignore this channel. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_ReadSurfacePixel :: (surface: *SDL_Surface, x: s32, y: s32, r: *Uint8, g: *Uint8, b: *Uint8, a: *Uint8) -> bool #foreign libsdl3; /** * Retrieves a single pixel from a surface. * * This function prioritizes correctness over speed: it is suitable for unit * tests, but is not intended for use in a game engine. * * \param surface the surface to read. * \param x the horizontal coordinate, 0 <= x < width. * \param y the vertical coordinate, 0 <= y < height. * \param r a pointer filled in with the red channel, normally in the range * 0-1, or NULL to ignore this channel. * \param g a pointer filled in with the green channel, normally in the range * 0-1, or NULL to ignore this channel. * \param b a pointer filled in with the blue channel, normally in the range * 0-1, or NULL to ignore this channel. * \param a a pointer filled in with the alpha channel, normally in the range * 0-1, or NULL to ignore this channel. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_ReadSurfacePixelFloat :: (surface: *SDL_Surface, x: s32, y: s32, r: *float, g: *float, b: *float, a: *float) -> bool #foreign libsdl3; /** * Writes a single pixel to a surface. * * This function prioritizes correctness over speed: it is suitable for unit * tests, but is not intended for use in a game engine. * * Like SDL_MapRGBA, this uses the entire 0..255 range when converting color * components from pixel formats with less than 8 bits per RGB component. * * \param surface the surface to write. * \param x the horizontal coordinate, 0 <= x < width. * \param y the vertical coordinate, 0 <= y < height. * \param r the red channel value, 0-255. * \param g the green channel value, 0-255. * \param b the blue channel value, 0-255. * \param a the alpha channel value, 0-255. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_WriteSurfacePixel :: (surface: *SDL_Surface, x: s32, y: s32, r: Uint8, g: Uint8, b: Uint8, a: Uint8) -> bool #foreign libsdl3; /** * Writes a single pixel to a surface. * * This function prioritizes correctness over speed: it is suitable for unit * tests, but is not intended for use in a game engine. * * \param surface the surface to write. * \param x the horizontal coordinate, 0 <= x < width. * \param y the vertical coordinate, 0 <= y < height. * \param r the red channel value, normally in the range 0-1. * \param g the green channel value, normally in the range 0-1. * \param b the blue channel value, normally in the range 0-1. * \param a the alpha channel value, normally in the range 0-1. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_WriteSurfacePixelFloat :: (surface: *SDL_Surface, x: s32, y: s32, r: float, g: float, b: float, a: float) -> bool #foreign libsdl3; /** * This is a unique ID for a camera device for the time it is connected to the * system, and is never reused for the lifetime of the application. * * If the device is disconnected and reconnected, it will get a new ID. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetCameras */ SDL_CameraID :: Uint32; SDL_Camera :: struct {} /** * The details of an output format for a camera device. * * Cameras often support multiple formats; each one will be encapsulated in * this struct. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetCameraSupportedFormats * \sa SDL_GetCameraFormat */ SDL_CameraSpec :: struct { format: SDL_PixelFormat; /**< Frame format */ colorspace: SDL_Colorspace; /**< Frame colorspace */ width: s32; /**< Frame width */ height: s32; /**< Frame height */ framerate_numerator: s32; /**< Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds) */ framerate_denominator: s32; /**< Frame rate demoninator ((num / denom) == FPS, (denom / num) == duration in seconds) */ } /** * The position of camera in relation to system device. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetCameraPosition */ using SDL_CameraPosition :: enum u32 { SDL_CAMERA_POSITION_UNKNOWN :: 0; SDL_CAMERA_POSITION_FRONT_FACING :: 1; SDL_CAMERA_POSITION_BACK_FACING :: 2; } /** * Use this function to get the number of built-in camera drivers. * * This function returns a hardcoded number. This never returns a negative * value; if there are no drivers compiled into this build of SDL, this * function returns zero. The presence of a driver in this list does not mean * it will function, it just means SDL is capable of interacting with that * interface. For example, a build of SDL might have v4l2 support, but if * there's no kernel support available, SDL's v4l2 driver would fail if used. * * By default, SDL tries all drivers, in its preferred order, until one is * found to be usable. * * \returns the number of built-in camera drivers. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameraDriver */ SDL_GetNumCameraDrivers :: () -> s32 #foreign libsdl3; /** * Use this function to get the name of a built in camera driver. * * The list of camera drivers is given in the order that they are normally * initialized by default; the drivers that seem more reasonable to choose * first (as far as the SDL developers believe) are earlier in the list. * * The names of drivers are all simple, low-ASCII identifiers, like "v4l2", * "coremedia" or "android". These never have Unicode characters, and are not * meant to be proper names. * * \param index the index of the camera driver; the value ranges from 0 to * SDL_GetNumCameraDrivers() - 1. * \returns the name of the camera driver at the requested index, or NULL if * an invalid index was specified. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumCameraDrivers */ SDL_GetCameraDriver :: (index: s32) -> *u8 #foreign libsdl3; /** * Get the name of the current camera driver. * * The names of drivers are all simple, low-ASCII identifiers, like "v4l2", * "coremedia" or "android". These never have Unicode characters, and are not * meant to be proper names. * * \returns the name of the current camera driver or NULL if no driver has * been initialized. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetCurrentCameraDriver :: () -> *u8 #foreign libsdl3; /** * Get a list of currently connected camera devices. * * \param count a pointer filled in with the number of cameras returned, may * be NULL. * \returns a 0 terminated array of camera instance IDs or NULL on failure; * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera */ SDL_GetCameras :: (count: *s32) -> *SDL_CameraID #foreign libsdl3; /** * Get the list of native formats/sizes a camera supports. * * This returns a list of all formats and frame sizes that a specific camera * can offer. This is useful if your app can accept a variety of image formats * and sizes and so want to find the optimal spec that doesn't require * conversion. * * This function isn't strictly required; if you call SDL_OpenCamera with a * NULL spec, SDL will choose a native format for you, and if you instead * specify a desired format, it will transparently convert to the requested * format on your behalf. * * If `count` is not NULL, it will be filled with the number of elements in * the returned array. * * Note that it's legal for a camera to supply an empty list. This is what * will happen on Emscripten builds, since that platform won't tell _anything_ * about available cameras until you've opened one, and won't even tell if * there _is_ a camera until the user has given you permission to check * through a scary warning popup. * * \param devid the camera device instance ID to query. * \param count a pointer filled in with the number of elements in the list, * may be NULL. * \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on * failure; call SDL_GetError() for more information. This is a * single allocation that should be freed with SDL_free() when it is * no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameras * \sa SDL_OpenCamera */ SDL_GetCameraSupportedFormats :: (devid: SDL_CameraID, count: *s32) -> **SDL_CameraSpec #foreign libsdl3; /** * Get the human-readable device name for a camera. * * \param instance_id the camera device instance ID. * \returns a human-readable device name or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameras */ SDL_GetCameraName :: (instance_id: SDL_CameraID) -> *u8 #foreign libsdl3; /** * Get the position of the camera in relation to the system. * * Most platforms will report UNKNOWN, but mobile devices, like phones, can * often make a distinction between cameras on the front of the device (that * points towards the user, for taking "selfies") and cameras on the back (for * filming in the direction the user is facing). * * \param instance_id the camera device instance ID. * \returns the position of the camera on the system hardware. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameras */ SDL_GetCameraPosition :: (instance_id: SDL_CameraID) -> SDL_CameraPosition #foreign libsdl3; /** * Open a video recording device (a "camera"). * * You can open the device with any reasonable spec, and if the hardware can't * directly support it, it will convert data seamlessly to the requested * format. This might incur overhead, including scaling of image data. * * If you would rather accept whatever format the device offers, you can pass * a NULL spec here and it will choose one for you (and you can use * SDL_Surface's conversion/scaling functions directly if necessary). * * You can call SDL_GetCameraFormat() to get the actual data format if passing * a NULL spec here. You can see the exact specs a device can support without * conversion with SDL_GetCameraSupportedFormats(). * * SDL will not attempt to emulate framerate; it will try to set the hardware * to the rate closest to the requested speed, but it won't attempt to limit * or duplicate frames artificially; call SDL_GetCameraFormat() to see the * actual framerate of the opened the device, and check your timestamps if * this is crucial to your app! * * Note that the camera is not usable until the user approves its use! On some * platforms, the operating system will prompt the user to permit access to * the camera, and they can choose Yes or No at that point. Until they do, the * camera will not be usable. The app should either wait for an * SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event, * or poll SDL_GetCameraPermissionState() occasionally until it returns * non-zero. On platforms that don't require explicit user approval (and * perhaps in places where the user previously permitted access), the approval * event might come immediately, but it might come seconds, minutes, or hours * later! * * \param instance_id the camera device instance ID. * \param spec the desired format for data the device will provide. Can be * NULL. * \returns an SDL_Camera object or NULL on failure; call SDL_GetError() for * more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCameras * \sa SDL_GetCameraFormat */ SDL_OpenCamera :: (instance_id: SDL_CameraID, spec: *SDL_CameraSpec) -> *SDL_Camera #foreign libsdl3; /** * Query if camera access has been approved by the user. * * Cameras will not function between when the device is opened by the app and * when the user permits access to the hardware. On some platforms, this * presents as a popup dialog where the user has to explicitly approve access; * on others the approval might be implicit and not alert the user at all. * * This function can be used to check the status of that approval. It will * return 0 if still waiting for user response, 1 if the camera is approved * for use, and -1 if the user denied access. * * Instead of polling with this function, you can wait for a * SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event * in the standard SDL event loop, which is guaranteed to be sent once when * permission to use the camera is decided. * * If a camera is declined, there's nothing to be done but call * SDL_CloseCamera() to dispose of it. * * \param camera the opened camera device to query. * \returns -1 if user denied access to the camera, 1 if user approved access, * 0 if no decision has been made yet. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera * \sa SDL_CloseCamera */ SDL_GetCameraPermissionState :: (camera: *SDL_Camera) -> s32 #foreign libsdl3; /** * Get the instance ID of an opened camera. * * \param camera an SDL_Camera to query. * \returns the instance ID of the specified camera on success or 0 on * failure; call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera */ SDL_GetCameraID :: (camera: *SDL_Camera) -> SDL_CameraID #foreign libsdl3; /** * Get the properties associated with an opened camera. * * \param camera the SDL_Camera obtained from SDL_OpenCamera(). * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetCameraProperties :: (camera: *SDL_Camera) -> SDL_PropertiesID #foreign libsdl3; /** * Get the spec that a camera is using when generating images. * * Note that this might not be the native format of the hardware, as SDL might * be converting to this format behind the scenes. * * If the system is waiting for the user to approve access to the camera, as * some platforms require, this will return false, but this isn't necessarily * a fatal error; you should either wait for an * SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event, * or poll SDL_GetCameraPermissionState() occasionally until it returns * non-zero. * * \param camera opened camera device. * \param spec the SDL_CameraSpec to be initialized by this function. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera */ SDL_GetCameraFormat :: (camera: *SDL_Camera, spec: *SDL_CameraSpec) -> bool #foreign libsdl3; /** * Acquire a frame. * * The frame is a memory pointer to the image data, whose size and format are * given by the spec requested when opening the device. * * This is a non blocking API. If there is a frame available, a non-NULL * surface is returned, and timestampNS will be filled with a non-zero value. * * Note that an error case can also return NULL, but a NULL by itself is * normal and just signifies that a new frame is not yet available. Note that * even if a camera device fails outright (a USB camera is unplugged while in * use, etc), SDL will send an event separately to notify the app, but * continue to provide blank frames at ongoing intervals until * SDL_CloseCamera() is called, so real failure here is almost always an out * of memory condition. * * After use, the frame should be released with SDL_ReleaseCameraFrame(). If * you don't do this, the system may stop providing more video! * * Do not call SDL_DestroySurface() on the returned surface! It must be given * back to the camera subsystem with SDL_ReleaseCameraFrame! * * If the system is waiting for the user to approve access to the camera, as * some platforms require, this will return NULL (no frames available); you * should either wait for an SDL_EVENT_CAMERA_DEVICE_APPROVED (or * SDL_EVENT_CAMERA_DEVICE_DENIED) event, or poll * SDL_GetCameraPermissionState() occasionally until it returns non-zero. * * \param camera opened camera device. * \param timestampNS a pointer filled in with the frame's timestamp, or 0 on * error. Can be NULL. * \returns a new frame of video on success, NULL if none is currently * available. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ReleaseCameraFrame */ SDL_AcquireCameraFrame :: (camera: *SDL_Camera, timestampNS: *Uint64) -> *SDL_Surface #foreign libsdl3; /** * Release a frame of video acquired from a camera. * * Let the back-end re-use the internal buffer for camera. * * This function _must_ be called only on surface objects returned by * SDL_AcquireCameraFrame(). This function should be called as quickly as * possible after acquisition, as SDL keeps a small FIFO queue of surfaces for * video frames; if surfaces aren't released in a timely manner, SDL may drop * upcoming video frames from the camera. * * If the app needs to keep the surface for a significant time, they should * make a copy of it and release the original. * * The app should not use the surface again after calling this function; * assume the surface is freed and the pointer is invalid. * * \param camera opened camera device. * \param frame the video frame surface to release. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AcquireCameraFrame */ SDL_ReleaseCameraFrame :: (camera: *SDL_Camera, frame: *SDL_Surface) -> void #foreign libsdl3; /** * Use this function to shut down camera processing and close the camera * device. * * \param camera opened camera device. * * \threadsafety It is safe to call this function from any thread, but no * thread may reference `device` once this function is called. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenCamera */ SDL_CloseCamera :: (camera: *SDL_Camera) -> void #foreign libsdl3; /** * Put UTF-8 text into the clipboard. * * \param text the text to store in the clipboard. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetClipboardText * \sa SDL_HasClipboardText */ SDL_SetClipboardText :: (text: *u8) -> bool #foreign libsdl3; /** * Get UTF-8 text from the clipboard. * * This functions returns an empty string if there was not enough memory left * for a copy of the clipboard's content. * * \returns the clipboard text on success or an empty string on failure; call * SDL_GetError() for more information. This should be freed with * SDL_free() when it is no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText */ SDL_GetClipboardText :: () -> *u8 #foreign libsdl3; /** * Query whether the clipboard exists and contains a non-empty text string. * * \returns true if the clipboard has text, or false if it does not. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetClipboardText * \sa SDL_SetClipboardText */ SDL_HasClipboardText :: () -> bool #foreign libsdl3; /** * Put UTF-8 text into the primary selection. * * \param text the text to store in the primary selection. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_HasPrimarySelectionText */ SDL_SetPrimarySelectionText :: (text: *u8) -> bool #foreign libsdl3; /** * Get UTF-8 text from the primary selection. * * This functions returns an empty string if there was not enough memory left * for a copy of the primary selection's content. * * \returns the primary selection text on success or an empty string on * failure; call SDL_GetError() for more information. This should be * freed with SDL_free() when it is no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText */ SDL_GetPrimarySelectionText :: () -> *u8 #foreign libsdl3; /** * Query whether the primary selection exists and contains a non-empty text * string. * * \returns true if the primary selection has text, or false if it does not. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_SetPrimarySelectionText */ SDL_HasPrimarySelectionText :: () -> bool #foreign libsdl3; /** * Callback function that will be called when data for the specified mime-type * is requested by the OS. * * The callback function is called with NULL as the mime_type when the * clipboard is cleared or new data is set. The clipboard is automatically * cleared in SDL_Quit(). * * \param userdata a pointer to provided user data. * \param mime_type the requested mime-type. * \param size a pointer filled in with the length of the returned data. * \returns a pointer to the data for the provided mime-type. Returning NULL * or setting length to 0 will cause no data to be sent to the * "receiver". It is up to the receiver to handle this. Essentially * returning no data is more or less undefined behavior and may cause * breakage in receiving applications. The returned data will not be * freed so it needs to be retained and dealt with internally. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData */ SDL_ClipboardDataCallback :: #type (userdata: *void, mime_type: *u8, size: *u64) -> *void #c_call; /** * Callback function that will be called when the clipboard is cleared, or new * data is set. * * \param userdata a pointer to provided user data. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData */ SDL_ClipboardCleanupCallback :: #type (userdata: *void) -> void #c_call; /** * Offer clipboard data to the OS. * * Tell the operating system that the application is offering clipboard data * for each of the provided mime-types. Once another application requests the * data the callback function will be called, allowing it to generate and * respond with the data for the requested mime-type. * * The size of text data does not include any terminator, and the text does * not need to be null terminated (e.g. you can directly copy a portion of a * document). * * \param callback a function pointer to the function that provides the * clipboard data. * \param cleanup a function pointer to the function that cleans up the * clipboard data. * \param userdata an opaque pointer that will be forwarded to the callbacks. * \param mime_types a list of mime-types that are being offered. * \param num_mime_types the number of mime-types in the mime_types list. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClearClipboardData * \sa SDL_GetClipboardData * \sa SDL_HasClipboardData */ SDL_SetClipboardData :: (callback: SDL_ClipboardDataCallback, cleanup: SDL_ClipboardCleanupCallback, userdata: *void, mime_types: **u8, num_mime_types: u64) -> bool #foreign libsdl3; /** * Clear the clipboard data. * * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData */ SDL_ClearClipboardData :: () -> bool #foreign libsdl3; /** * Get the data from clipboard for a given mime type. * * The size of text data does not include the terminator, but the text is * guaranteed to be null terminated. * * \param mime_type the mime type to read from the clipboard. * \param size a pointer filled in with the length of the returned data. * \returns the retrieved data buffer or NULL on failure; call SDL_GetError() * for more information. This should be freed with SDL_free() when it * is no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasClipboardData * \sa SDL_SetClipboardData */ SDL_GetClipboardData :: (mime_type: *u8, size: *u64) -> *void #foreign libsdl3; /** * Query whether there is data in the clipboard for the provided mime type. * * \param mime_type the mime type to check for data for. * \returns true if there exists data in clipboard for the provided mime type, * false if it does not. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData * \sa SDL_GetClipboardData */ SDL_HasClipboardData :: (mime_type: *u8) -> bool #foreign libsdl3; /** * Retrieve the list of mime types available in the clipboard. * * \param num_mime_types a pointer filled with the number of mime types, may * be NULL. * \returns a null terminated array of strings with mime types, or NULL on * failure; call SDL_GetError() for more information. This should be * freed with SDL_free() when it is no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetClipboardData */ SDL_GetClipboardMimeTypes :: (num_mime_types: *u64) -> **u8 #foreign libsdl3; /** * Get the number of logical CPU cores available. * * \returns the total number of logical CPU cores. On CPUs that include * technologies such as hyperthreading, the number of logical cores * may be more than the number of physical cores. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetNumLogicalCPUCores :: () -> s32 #foreign libsdl3; /** * Determine the L1 cache line size of the CPU. * * This is useful for determining multi-threaded structure padding or SIMD * prefetch sizes. * * \returns the L1 cache line size of the CPU, in bytes. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetCPUCacheLineSize :: () -> s32 #foreign libsdl3; /** * Determine whether the CPU has AltiVec features. * * This always returns false on CPUs that aren't using PowerPC instruction * sets. * * \returns true if the CPU has AltiVec features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_HasAltiVec :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has MMX features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has MMX features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_HasMMX :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has SSE features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has SSE features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE2 * \sa SDL_HasSSE3 * \sa SDL_HasSSE41 * \sa SDL_HasSSE42 */ SDL_HasSSE :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has SSE2 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has SSE2 features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE * \sa SDL_HasSSE3 * \sa SDL_HasSSE41 * \sa SDL_HasSSE42 */ SDL_HasSSE2 :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has SSE3 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has SSE3 features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE * \sa SDL_HasSSE2 * \sa SDL_HasSSE41 * \sa SDL_HasSSE42 */ SDL_HasSSE3 :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has SSE4.1 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has SSE4.1 features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE * \sa SDL_HasSSE2 * \sa SDL_HasSSE3 * \sa SDL_HasSSE42 */ SDL_HasSSE41 :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has SSE4.2 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has SSE4.2 features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasSSE * \sa SDL_HasSSE2 * \sa SDL_HasSSE3 * \sa SDL_HasSSE41 */ SDL_HasSSE42 :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has AVX features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has AVX features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasAVX2 * \sa SDL_HasAVX512F */ SDL_HasAVX :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has AVX2 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has AVX2 features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasAVX * \sa SDL_HasAVX512F */ SDL_HasAVX2 :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has AVX-512F (foundation) features. * * This always returns false on CPUs that aren't using Intel instruction sets. * * \returns true if the CPU has AVX-512F features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasAVX * \sa SDL_HasAVX2 */ SDL_HasAVX512F :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has ARM SIMD (ARMv6) features. * * This is different from ARM NEON, which is a different instruction set. * * This always returns false on CPUs that aren't using ARM instruction sets. * * \returns true if the CPU has ARM SIMD features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasNEON */ SDL_HasARMSIMD :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has NEON (ARM SIMD) features. * * This always returns false on CPUs that aren't using ARM instruction sets. * * \returns true if the CPU has ARM NEON features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_HasNEON :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has LSX (LOONGARCH SIMD) features. * * This always returns false on CPUs that aren't using LOONGARCH instruction * sets. * * \returns true if the CPU has LOONGARCH LSX features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_HasLSX :: () -> bool #foreign libsdl3; /** * Determine whether the CPU has LASX (LOONGARCH SIMD) features. * * This always returns false on CPUs that aren't using LOONGARCH instruction * sets. * * \returns true if the CPU has LOONGARCH LASX features or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_HasLASX :: () -> bool #foreign libsdl3; /** * Get the amount of RAM configured in the system. * * \returns the amount of RAM configured in the system in MiB. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetSystemRAM :: () -> s32 #foreign libsdl3; /** * Report the alignment this system needs for SIMD allocations. * * This will return the minimum number of bytes to which a pointer must be * aligned to be compatible with SIMD instructions on the current machine. For * example, if the machine supports SSE only, it will return 16, but if it * supports AVX-512F, it'll return 64 (etc). This only reports values for * instruction sets SDL knows about, so if your SDL build doesn't have * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. * Plan accordingly. * * \returns the alignment in bytes needed for available, known SIMD * instructions. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_aligned_alloc * \sa SDL_aligned_free */ SDL_GetSIMDAlignment :: () -> u64 #foreign libsdl3; /** * This is a unique ID for a display for the time it is connected to the * system, and is never reused for the lifetime of the application. * * If the display is disconnected and reconnected, it will get a new ID. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_DisplayID :: Uint32; /** * This is a unique ID for a window. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_WindowID :: Uint32; /** * System theme. * * \since This enum is available since SDL 3.2.0. */ using SDL_SystemTheme :: enum u32 { SDL_SYSTEM_THEME_UNKNOWN :: 0; SDL_SYSTEM_THEME_LIGHT :: 1; SDL_SYSTEM_THEME_DARK :: 2; } SDL_DisplayModeData :: struct {} /** * The structure that defines a display mode. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetFullscreenDisplayModes * \sa SDL_GetDesktopDisplayMode * \sa SDL_GetCurrentDisplayMode * \sa SDL_SetWindowFullscreenMode * \sa SDL_GetWindowFullscreenMode */ SDL_DisplayMode :: struct { displayID: SDL_DisplayID; /**< the display this mode is associated with */ format: SDL_PixelFormat; /**< pixel format */ w: s32; /**< width */ h: s32; /**< height */ pixel_density: float; /**< scale converting size to pixels (e.g. a 1920x1080 mode with 2.0 scale would have 3840x2160 pixels) */ refresh_rate: float; /**< refresh rate (or 0.0f for unspecified) */ refresh_rate_numerator: s32; /**< precise refresh rate numerator (or 0 for unspecified) */ refresh_rate_denominator: s32; /**< precise refresh rate denominator */ internal: *SDL_DisplayModeData; /**< Private */ } /** * Display orientation values; the way a display is rotated. * * \since This enum is available since SDL 3.2.0. */ using SDL_DisplayOrientation :: enum u32 { SDL_ORIENTATION_UNKNOWN :: 0; SDL_ORIENTATION_LANDSCAPE :: 1; SDL_ORIENTATION_LANDSCAPE_FLIPPED :: 2; SDL_ORIENTATION_PORTRAIT :: 3; SDL_ORIENTATION_PORTRAIT_FLIPPED :: 4; } SDL_Window :: struct {} /** * The flags on a window. * * These cover a lot of true/false, or on/off, window state. Some of it is * immutable after being set through SDL_CreateWindow(), some of it can be * changed on existing windows by the app, and some of it might be altered by * the user or system outside of the app's control. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetWindowFlags */ SDL_WindowFlags :: Uint64; /** * Window flash operation. * * \since This enum is available since SDL 3.2.0. */ using SDL_FlashOperation :: enum u32 { SDL_FLASH_CANCEL :: 0; SDL_FLASH_BRIEFLY :: 1; SDL_FLASH_UNTIL_FOCUSED :: 2; } SDL_GLContextState :: struct {} /** * An opaque handle to an OpenGL context. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GL_CreateContext */ SDL_GLContext :: *SDL_GLContextState; /** * Opaque type for an EGL display. * * \since This datatype is available since SDL 3.2.0. */ SDL_EGLDisplay :: *void; /** * Opaque type for an EGL config. * * \since This datatype is available since SDL 3.2.0. */ SDL_EGLConfig :: *void; /** * Opaque type for an EGL surface. * * \since This datatype is available since SDL 3.2.0. */ SDL_EGLSurface :: *void; /** * An EGL attribute, used when creating an EGL context. * * \since This datatype is available since SDL 3.2.0. */ SDL_EGLAttrib :: s64; /** * An EGL integer attribute, used when creating an EGL surface. * * \since This datatype is available since SDL 3.2.0. */ SDL_EGLint :: s32; /** * EGL platform attribute initialization callback. * * This is called when SDL is attempting to create an EGL context, to let the * app add extra attributes to its eglGetPlatformDisplay() call. * * The callback should return a pointer to an EGL attribute array terminated * with `EGL_NONE`. If this function returns NULL, the SDL_CreateWindow * process will fail gracefully. * * The returned pointer should be allocated with SDL_malloc() and will be * passed to SDL_free(). * * The arrays returned by each callback will be appended to the existing * attribute arrays defined by SDL. * * \param userdata an app-controlled pointer that is passed to the callback. * \returns a newly-allocated array of attributes, terminated with `EGL_NONE`. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_EGL_SetAttributeCallbacks */ SDL_EGLAttribArrayCallback :: #type (userdata: *void) -> *SDL_EGLAttrib #c_call; /** * EGL surface/context attribute initialization callback types. * * This is called when SDL is attempting to create an EGL surface, to let the * app add extra attributes to its eglCreateWindowSurface() or * eglCreateContext calls. * * For convenience, the EGLDisplay and EGLConfig to use are provided to the * callback. * * The callback should return a pointer to an EGL attribute array terminated * with `EGL_NONE`. If this function returns NULL, the SDL_CreateWindow * process will fail gracefully. * * The returned pointer should be allocated with SDL_malloc() and will be * passed to SDL_free(). * * The arrays returned by each callback will be appended to the existing * attribute arrays defined by SDL. * * \param userdata an app-controlled pointer that is passed to the callback. * \param display the EGL display to be used. * \param config the EGL config to be used. * \returns a newly-allocated array of attributes, terminated with `EGL_NONE`. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_EGL_SetAttributeCallbacks */ SDL_EGLIntArrayCallback :: #type (userdata: *void, display: SDL_EGLDisplay, config: SDL_EGLConfig) -> *SDL_EGLint #c_call; /** * An enumeration of OpenGL configuration attributes. * * While you can set most OpenGL attributes normally, the attributes listed * above must be known before SDL creates the window that will be used with * the OpenGL context. These attributes are set and read with * SDL_GL_SetAttribute() and SDL_GL_GetAttribute(). * * In some cases, these attributes are minimum requests; the GL does not * promise to give you exactly what you asked for. It's possible to ask for a * 16-bit depth buffer and get a 24-bit one instead, for example, or to ask * for no stencil buffer and still have one available. Context creation should * fail if the GL can't provide your requested attributes at a minimum, but * you should check to see exactly what you got. * * \since This enum is available since SDL 3.2.0. */ using SDL_GLAttr :: enum u32 { SDL_GL_RED_SIZE :: 0; SDL_GL_GREEN_SIZE :: 1; SDL_GL_BLUE_SIZE :: 2; SDL_GL_ALPHA_SIZE :: 3; SDL_GL_BUFFER_SIZE :: 4; SDL_GL_DOUBLEBUFFER :: 5; SDL_GL_DEPTH_SIZE :: 6; SDL_GL_STENCIL_SIZE :: 7; SDL_GL_ACCUM_RED_SIZE :: 8; SDL_GL_ACCUM_GREEN_SIZE :: 9; SDL_GL_ACCUM_BLUE_SIZE :: 10; SDL_GL_ACCUM_ALPHA_SIZE :: 11; SDL_GL_STEREO :: 12; SDL_GL_MULTISAMPLEBUFFERS :: 13; SDL_GL_MULTISAMPLESAMPLES :: 14; SDL_GL_ACCELERATED_VISUAL :: 15; SDL_GL_RETAINED_BACKING :: 16; SDL_GL_CONTEXT_MAJOR_VERSION :: 17; SDL_GL_CONTEXT_MINOR_VERSION :: 18; SDL_GL_CONTEXT_FLAGS :: 19; SDL_GL_CONTEXT_PROFILE_MASK :: 20; SDL_GL_SHARE_WITH_CURRENT_CONTEXT :: 21; SDL_GL_FRAMEBUFFER_SRGB_CAPABLE :: 22; SDL_GL_CONTEXT_RELEASE_BEHAVIOR :: 23; SDL_GL_CONTEXT_RESET_NOTIFICATION :: 24; SDL_GL_CONTEXT_NO_ERROR :: 25; SDL_GL_FLOATBUFFERS :: 26; SDL_GL_EGL_PLATFORM :: 27; } /** * Possible values to be set for the SDL_GL_CONTEXT_PROFILE_MASK attribute. * * \since This datatype is available since SDL 3.2.0. */ SDL_GLProfile :: Uint32; /** * Possible flags to be set for the SDL_GL_CONTEXT_FLAGS attribute. * * \since This datatype is available since SDL 3.2.0. */ SDL_GLContextFlag :: Uint32; /** * Possible values to be set for the SDL_GL_CONTEXT_RELEASE_BEHAVIOR * attribute. * * \since This datatype is available since SDL 3.2.0. */ SDL_GLContextReleaseFlag :: Uint32; /** * Possible values to be set SDL_GL_CONTEXT_RESET_NOTIFICATION attribute. * * \since This datatype is available since SDL 3.2.0. */ SDL_GLContextResetNotification :: Uint32; /** * Get the number of video drivers compiled into SDL. * * \returns the number of built in video drivers. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetVideoDriver */ SDL_GetNumVideoDrivers :: () -> s32 #foreign libsdl3; /** * Get the name of a built in video driver. * * The video drivers are presented in the order in which they are normally * checked during initialization. * * The names of drivers are all simple, low-ASCII identifiers, like "cocoa", * "x11" or "windows". These never have Unicode characters, and are not meant * to be proper names. * * \param index the index of a video driver. * \returns the name of the video driver with the given **index**. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumVideoDrivers */ SDL_GetVideoDriver :: (index: s32) -> *u8 #foreign libsdl3; /** * Get the name of the currently initialized video driver. * * The names of drivers are all simple, low-ASCII identifiers, like "cocoa", * "x11" or "windows". These never have Unicode characters, and are not meant * to be proper names. * * \returns the name of the current video driver or NULL if no driver has been * initialized. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumVideoDrivers * \sa SDL_GetVideoDriver */ SDL_GetCurrentVideoDriver :: () -> *u8 #foreign libsdl3; /** * Get the current system theme. * * \returns the current system theme, light, dark, or unknown. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetSystemTheme :: () -> SDL_SystemTheme #foreign libsdl3; /** * Get a list of currently connected displays. * * \param count a pointer filled in with the number of displays returned, may * be NULL. * \returns a 0 terminated array of display instance IDs or NULL on failure; * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetDisplays :: (count: *s32) -> *SDL_DisplayID #foreign libsdl3; /** * Return the primary display. * * \returns the instance ID of the primary display on success or 0 on failure; * call SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ SDL_GetPrimaryDisplay :: () -> SDL_DisplayID #foreign libsdl3; /** * Get the properties associated with a display. * * The following read-only properties are provided by SDL: * * - `SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN`: true if the display has HDR * headroom above the SDR white point. This is for informational and * diagnostic purposes only, as not all platforms provide this information * at the display level. * * On KMS/DRM: * * - `SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER`: the "panel * orientation" property for the display in degrees of clockwise rotation. * Note that this is provided only as a hint, and the application is * responsible for any coordinate transformations needed to conform to the * requested display orientation. * * \param displayID the instance ID of the display to query. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetDisplayProperties :: (displayID: SDL_DisplayID) -> SDL_PropertiesID #foreign libsdl3; /** * Get the name of a display in UTF-8 encoding. * * \param displayID the instance ID of the display to query. * \returns the name of a display or NULL on failure; call SDL_GetError() for * more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ SDL_GetDisplayName :: (displayID: SDL_DisplayID) -> *u8 #foreign libsdl3; /** * Get the desktop area represented by a display. * * The primary display is often located at (0,0), but may be placed at a * different location depending on monitor layout. * * \param displayID the instance ID of the display to query. * \param rect the SDL_Rect structure filled in with the display bounds. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayUsableBounds * \sa SDL_GetDisplays */ SDL_GetDisplayBounds :: (displayID: SDL_DisplayID, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Get the usable desktop area represented by a display, in screen * coordinates. * * This is the same area as SDL_GetDisplayBounds() reports, but with portions * reserved by the system removed. For example, on Apple's macOS, this * subtracts the area occupied by the menu bar and dock. * * Setting a window to be fullscreen generally bypasses these unusable areas, * so these are good guidelines for the maximum space available to a * non-fullscreen window. * * \param displayID the instance ID of the display to query. * \param rect the SDL_Rect structure filled in with the display bounds. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays */ SDL_GetDisplayUsableBounds :: (displayID: SDL_DisplayID, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Get the orientation of a display when it is unrotated. * * \param displayID the instance ID of the display to query. * \returns the SDL_DisplayOrientation enum value of the display, or * `SDL_ORIENTATION_UNKNOWN` if it isn't available. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ SDL_GetNaturalDisplayOrientation :: (displayID: SDL_DisplayID) -> SDL_DisplayOrientation #foreign libsdl3; /** * Get the orientation of a display. * * \param displayID the instance ID of the display to query. * \returns the SDL_DisplayOrientation enum value of the display, or * `SDL_ORIENTATION_UNKNOWN` if it isn't available. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ SDL_GetCurrentDisplayOrientation :: (displayID: SDL_DisplayID) -> SDL_DisplayOrientation #foreign libsdl3; /** * Get the content scale of a display. * * The content scale is the expected scale for content based on the DPI * settings of the display. For example, a 4K display might have a 2.0 (200%) * display scale, which means that the user expects UI elements to be twice as * big on this display, to aid in readability. * * After window creation, SDL_GetWindowDisplayScale() should be used to query * the content scale factor for individual windows instead of querying the * display for a window and calling this function, as the per-window content * scale factor may differ from the base value of the display it is on, * particularly on high-DPI and/or multi-monitor desktop configurations. * * \param displayID the instance ID of the display to query. * \returns the content scale of the display, or 0.0f on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowDisplayScale * \sa SDL_GetDisplays */ SDL_GetDisplayContentScale :: (displayID: SDL_DisplayID) -> float #foreign libsdl3; /** * Get a list of fullscreen display modes available on a display. * * The display modes are sorted in this priority: * * - w -> largest to smallest * - h -> largest to smallest * - bits per pixel -> more colors to fewer colors * - packed pixel layout -> largest to smallest * - refresh rate -> highest to lowest * - pixel density -> lowest to highest * * \param displayID the instance ID of the display to query. * \param count a pointer filled in with the number of display modes returned, * may be NULL. * \returns a NULL terminated array of display mode pointers or NULL on * failure; call SDL_GetError() for more information. This is a * single allocation that should be freed with SDL_free() when it is * no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays */ SDL_GetFullscreenDisplayModes :: (displayID: SDL_DisplayID, count: *s32) -> **SDL_DisplayMode #foreign libsdl3; /** * Get the closest match to the requested display mode. * * The available display modes are scanned and `closest` is filled in with the * closest mode matching the requested mode and returned. The mode format and * refresh rate default to the desktop mode if they are set to 0. The modes * are scanned with size being first priority, format being second priority, * and finally checking the refresh rate. If all the available modes are too * small, then false is returned. * * \param displayID the instance ID of the display to query. * \param w the width in pixels of the desired display mode. * \param h the height in pixels of the desired display mode. * \param refresh_rate the refresh rate of the desired display mode, or 0.0f * for the desktop refresh rate. * \param include_high_density_modes boolean to include high density modes in * the search. * \param closest a pointer filled in with the closest display mode equal to * or larger than the desired mode. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplays * \sa SDL_GetFullscreenDisplayModes */ SDL_GetClosestFullscreenDisplayMode :: (displayID: SDL_DisplayID, w: s32, h: s32, refresh_rate: float, include_high_density_modes: bool, closest: *SDL_DisplayMode) -> bool #foreign libsdl3; /** * Get information about the desktop's display mode. * * There's a difference between this function and SDL_GetCurrentDisplayMode() * when SDL runs fullscreen and has changed the resolution. In that case this * function will return the previous native display mode, and not the current * display mode. * * \param displayID the instance ID of the display to query. * \returns a pointer to the desktop display mode or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCurrentDisplayMode * \sa SDL_GetDisplays */ SDL_GetDesktopDisplayMode :: (displayID: SDL_DisplayID) -> *SDL_DisplayMode #foreign libsdl3; /** * Get information about the current display mode. * * There's a difference between this function and SDL_GetDesktopDisplayMode() * when SDL runs fullscreen and has changed the resolution. In that case this * function will return the current display mode, and not the previous native * display mode. * * \param displayID the instance ID of the display to query. * \returns a pointer to the desktop display mode or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDesktopDisplayMode * \sa SDL_GetDisplays */ SDL_GetCurrentDisplayMode :: (displayID: SDL_DisplayID) -> *SDL_DisplayMode #foreign libsdl3; /** * Get the display containing a point. * * \param point the point to query. * \returns the instance ID of the display containing the point or 0 on * failure; call SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays */ SDL_GetDisplayForPoint :: (point: *SDL_Point) -> SDL_DisplayID #foreign libsdl3; /** * Get the display primarily containing a rect. * * \param rect the rect to query. * \returns the instance ID of the display entirely containing the rect or * closest to the center of the rect on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays */ SDL_GetDisplayForRect :: (rect: *SDL_Rect) -> SDL_DisplayID #foreign libsdl3; /** * Get the display associated with a window. * * \param window the window to query. * \returns the instance ID of the display containing the center of the window * on success or 0 on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays */ SDL_GetDisplayForWindow :: (window: *SDL_Window) -> SDL_DisplayID #foreign libsdl3; /** * Get the pixel density of a window. * * This is a ratio of pixel size to window size. For example, if the window is * 1920x1080 and it has a high density back buffer of 3840x2160 pixels, it * would have a pixel density of 2.0. * * \param window the window to query. * \returns the pixel density or 0.0f on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowDisplayScale */ SDL_GetWindowPixelDensity :: (window: *SDL_Window) -> float #foreign libsdl3; /** * Get the content display scale relative to a window's pixel size. * * This is a combination of the window pixel density and the display content * scale, and is the expected scale for displaying content in this window. For * example, if a 3840x2160 window had a display scale of 2.0, the user expects * the content to take twice as many pixels and be the same physical size as * if it were being displayed in a 1920x1080 window with a display scale of * 1.0. * * Conceptually this value corresponds to the scale display setting, and is * updated when that setting is changed, or the window moves to a display with * a different scale setting. * * \param window the window to query. * \returns the display scale, or 0.0f on failure; call SDL_GetError() for * more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetWindowDisplayScale :: (window: *SDL_Window) -> float #foreign libsdl3; /** * Set the display mode to use when a window is visible and fullscreen. * * This only affects the display mode used when the window is fullscreen. To * change the window size when the window is not fullscreen, use * SDL_SetWindowSize(). * * If the window is currently in the fullscreen state, this request is * asynchronous on some windowing systems and the new mode dimensions may not * be applied immediately upon the return of this function. If an immediate * change is required, call SDL_SyncWindow() to block until the changes have * taken effect. * * When the new mode takes effect, an SDL_EVENT_WINDOW_RESIZED and/or an * SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED event will be emitted with the new mode * dimensions. * * \param window the window to affect. * \param mode a pointer to the display mode to use, which can be NULL for * borderless fullscreen desktop mode, or one of the fullscreen * modes returned by SDL_GetFullscreenDisplayModes() to set an * exclusive fullscreen mode. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFullscreenMode * \sa SDL_SetWindowFullscreen * \sa SDL_SyncWindow */ SDL_SetWindowFullscreenMode :: (window: *SDL_Window, mode: *SDL_DisplayMode) -> bool #foreign libsdl3; /** * Query the display mode to use when a window is visible at fullscreen. * * \param window the window to query. * \returns a pointer to the exclusive fullscreen mode to use or NULL for * borderless fullscreen desktop mode. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowFullscreenMode * \sa SDL_SetWindowFullscreen */ SDL_GetWindowFullscreenMode :: (window: *SDL_Window) -> *SDL_DisplayMode #foreign libsdl3; /** * Get the raw ICC profile data for the screen the window is currently on. * * \param window the window to query. * \param size the size of the ICC profile. * \returns the raw ICC profile data on success or NULL on failure; call * SDL_GetError() for more information. This should be freed with * SDL_free() when it is no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetWindowICCProfile :: (window: *SDL_Window, size: *u64) -> *void #foreign libsdl3; /** * Get the pixel format associated with the window. * * \param window the window to query. * \returns the pixel format of the window on success or * SDL_PIXELFORMAT_UNKNOWN on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetWindowPixelFormat :: (window: *SDL_Window) -> SDL_PixelFormat #foreign libsdl3; /** * Get a list of valid windows. * * \param count a pointer filled in with the number of windows returned, may * be NULL. * \returns a NULL terminated array of SDL_Window pointers or NULL on failure; * call SDL_GetError() for more information. This is a single * allocation that should be freed with SDL_free() when it is no * longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetWindows :: (count: *s32) -> **SDL_Window #foreign libsdl3; /** * Create a window with the specified dimensions and flags. * * `flags` may be any of the following OR'd together: * * - `SDL_WINDOW_FULLSCREEN`: fullscreen window at desktop resolution * - `SDL_WINDOW_OPENGL`: window usable with an OpenGL context * - `SDL_WINDOW_OCCLUDED`: window partially or completely obscured by another * window * - `SDL_WINDOW_HIDDEN`: window is not visible * - `SDL_WINDOW_BORDERLESS`: no window decoration * - `SDL_WINDOW_RESIZABLE`: window can be resized * - `SDL_WINDOW_MINIMIZED`: window is minimized * - `SDL_WINDOW_MAXIMIZED`: window is maximized * - `SDL_WINDOW_MOUSE_GRABBED`: window has grabbed mouse focus * - `SDL_WINDOW_INPUT_FOCUS`: window has input focus * - `SDL_WINDOW_MOUSE_FOCUS`: window has mouse focus * - `SDL_WINDOW_EXTERNAL`: window not created by SDL * - `SDL_WINDOW_MODAL`: window is modal * - `SDL_WINDOW_HIGH_PIXEL_DENSITY`: window uses high pixel density back * buffer if possible * - `SDL_WINDOW_MOUSE_CAPTURE`: window has mouse captured (unrelated to * MOUSE_GRABBED) * - `SDL_WINDOW_ALWAYS_ON_TOP`: window should always be above others * - `SDL_WINDOW_UTILITY`: window should be treated as a utility window, not * showing in the task bar and window list * - `SDL_WINDOW_TOOLTIP`: window should be treated as a tooltip and does not * get mouse or keyboard focus, requires a parent window * - `SDL_WINDOW_POPUP_MENU`: window should be treated as a popup menu, * requires a parent window * - `SDL_WINDOW_KEYBOARD_GRABBED`: window has grabbed keyboard input * - `SDL_WINDOW_VULKAN`: window usable with a Vulkan instance * - `SDL_WINDOW_METAL`: window usable with a Metal instance * - `SDL_WINDOW_TRANSPARENT`: window with transparent buffer * - `SDL_WINDOW_NOT_FOCUSABLE`: window should not be focusable * * The SDL_Window is implicitly shown if SDL_WINDOW_HIDDEN is not set. * * On Apple's macOS, you **must** set the NSHighResolutionCapable Info.plist * property to YES, otherwise you will not receive a High-DPI OpenGL canvas. * * The window pixel size may differ from its window coordinate size if the * window is on a high pixel density display. Use SDL_GetWindowSize() to query * the client area's size in window coordinates, and * SDL_GetWindowSizeInPixels() or SDL_GetRenderOutputSize() to query the * drawable size in pixels. Note that the drawable size can vary after the * window is created and should be queried again if you get an * SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED event. * * If the window is created with any of the SDL_WINDOW_OPENGL or * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). * * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, * SDL_CreateWindow() will fail, because SDL_Vulkan_LoadLibrary() will fail. * * If SDL_WINDOW_METAL is specified on an OS that does not support Metal, * SDL_CreateWindow() will fail. * * If you intend to use this window with an SDL_Renderer, you should use * SDL_CreateWindowAndRenderer() instead of this function, to avoid window * flicker. * * On non-Apple devices, SDL requires you to either not link to the Vulkan * loader or link to a dynamic library version. This limitation may be removed * in a future version of SDL. * * \param title the title of the window, in UTF-8 encoding. * \param w the width of the window. * \param h the height of the window. * \param flags 0, or one or more SDL_WindowFlags OR'd together. * \returns the window that was created or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateWindowAndRenderer * \sa SDL_CreatePopupWindow * \sa SDL_CreateWindowWithProperties * \sa SDL_DestroyWindow */ SDL_CreateWindow :: (title: *u8, w: s32, h: s32, flags: SDL_WindowFlags) -> *SDL_Window #foreign libsdl3; /** * Create a child popup window of the specified parent window. * * The flags parameter **must** contain at least one of the following: * * - `SDL_WINDOW_TOOLTIP`: The popup window is a tooltip and will not pass any * input events. * - `SDL_WINDOW_POPUP_MENU`: The popup window is a popup menu. The topmost * popup menu will implicitly gain the keyboard focus. * * The following flags are not relevant to popup window creation and will be * ignored: * * - `SDL_WINDOW_MINIMIZED` * - `SDL_WINDOW_MAXIMIZED` * - `SDL_WINDOW_FULLSCREEN` * - `SDL_WINDOW_BORDERLESS` * * The following flags are incompatible with popup window creation and will * cause it to fail: * * - `SDL_WINDOW_UTILITY` * - `SDL_WINDOW_MODAL` * * The parent parameter **must** be non-null and a valid window. The parent of * a popup window can be either a regular, toplevel window, or another popup * window. * * Popup windows cannot be minimized, maximized, made fullscreen, raised, * flash, be made a modal window, be the parent of a toplevel window, or grab * the mouse and/or keyboard. Attempts to do so will fail. * * Popup windows implicitly do not have a border/decorations and do not appear * on the taskbar/dock or in lists of windows such as alt-tab menus. * * If a parent window is hidden or destroyed, any child popup windows will be * recursively hidden or destroyed as well. Child popup windows not explicitly * hidden will be restored when the parent is shown. * * \param parent the parent of the window, must not be NULL. * \param offset_x the x position of the popup window relative to the origin * of the parent. * \param offset_y the y position of the popup window relative to the origin * of the parent window. * \param w the width of the window. * \param h the height of the window. * \param flags SDL_WINDOW_TOOLTIP or SDL_WINDOW_POPUP_MENU, and zero or more * additional SDL_WindowFlags OR'd together. * \returns the window that was created or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateWindow * \sa SDL_CreateWindowWithProperties * \sa SDL_DestroyWindow * \sa SDL_GetWindowParent */ SDL_CreatePopupWindow :: (parent: *SDL_Window, offset_x: s32, offset_y: s32, w: s32, h: s32, flags: SDL_WindowFlags) -> *SDL_Window #foreign libsdl3; /** * Create a window with the specified properties. * * These are the supported properties: * * - `SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN`: true if the window should * be always on top * - `SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN`: true if the window has no * window decoration * - `SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN`: true if the * window will be used with an externally managed graphics context. * - `SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN`: true if the window should * accept keyboard input (defaults true) * - `SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN`: true if the window should * start in fullscreen mode at desktop resolution * - `SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER`: the height of the window * - `SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN`: true if the window should start * hidden * - `SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN`: true if the window * uses a high pixel density buffer if possible * - `SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN`: true if the window should * start maximized * - `SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN`: true if the window is a popup menu * - `SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN`: true if the window will be used * with Metal rendering * - `SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN`: true if the window should * start minimized * - `SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN`: true if the window is modal to * its parent * - `SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN`: true if the window starts * with grabbed mouse focus * - `SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN`: true if the window will be used * with OpenGL rendering * - `SDL_PROP_WINDOW_CREATE_PARENT_POINTER`: an SDL_Window that will be the * parent of this window, required for windows with the "tooltip", "menu", * and "modal" properties * - `SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN`: true if the window should be * resizable * - `SDL_PROP_WINDOW_CREATE_TITLE_STRING`: the title of the window, in UTF-8 * encoding * - `SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN`: true if the window show * transparent in the areas with alpha of 0 * - `SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN`: true if the window is a tooltip * - `SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN`: true if the window is a utility * window, not showing in the task bar and window list * - `SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN`: true if the window will be used * with Vulkan rendering * - `SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER`: the width of the window * - `SDL_PROP_WINDOW_CREATE_X_NUMBER`: the x position of the window, or * `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is * relative to the parent for windows with the "tooltip" or "menu" property * set. * - `SDL_PROP_WINDOW_CREATE_Y_NUMBER`: the y position of the window, or * `SDL_WINDOWPOS_CENTERED`, defaults to `SDL_WINDOWPOS_UNDEFINED`. This is * relative to the parent for windows with the "tooltip" or "menu" property * set. * * These are additional supported properties on macOS: * * - `SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`: the * `(__unsafe_unretained)` NSWindow associated with the window, if you want * to wrap an existing window. * - `SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER`: the `(__unsafe_unretained)` * NSView associated with the window, defaults to `[window contentView]` * * These are additional supported properties on Wayland: * * - `SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN` - true if * the application wants to use the Wayland surface for a custom role and * does not want it attached to an XDG toplevel window. See * [README/wayland](README/wayland) for more information on using custom * surfaces. * - `SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN` - true if the * application wants an associated `wl_egl_window` object to be created and * attached to the window, even if the window does not have the OpenGL * property or `SDL_WINDOW_OPENGL` flag set. * - `SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER` - the wl_surface * associated with the window, if you want to wrap an existing window. See * [README/wayland](README/wayland) for more information. * * These are additional supported properties on Windows: * * - `SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER`: the HWND associated with the * window, if you want to wrap an existing window. * - `SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER`: optional, * another window to share pixel format with, useful for OpenGL windows * * These are additional supported properties with X11: * * - `SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER`: the X11 Window associated * with the window, if you want to wrap an existing window. * * The window is implicitly shown if the "hidden" property is not set. * * Windows with the "tooltip" and "menu" properties are popup windows and have * the behaviors and guidelines outlined in SDL_CreatePopupWindow(). * * If this window is being created to be used with an SDL_Renderer, you should * not add a graphics API specific property * (`SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN`, etc), as SDL will handle that * internally when it chooses a renderer. However, SDL might need to recreate * your window at that point, which may cause the window to appear briefly, * and then flicker as it is recreated. The correct approach to this is to * create the window with the `SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN` property * set to true, then create the renderer, then show the window with * SDL_ShowWindow(). * * \param props the properties to use. * \returns the window that was created or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProperties * \sa SDL_CreateWindow * \sa SDL_DestroyWindow */ SDL_CreateWindowWithProperties :: (props: SDL_PropertiesID) -> *SDL_Window #foreign libsdl3; /** * Get the numeric ID of a window. * * The numeric ID is what SDL_WindowEvent references, and is necessary to map * these events to specific SDL_Window objects. * * \param window the window to query. * \returns the ID of the window on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFromID */ SDL_GetWindowID :: (window: *SDL_Window) -> SDL_WindowID #foreign libsdl3; /** * Get a window from a stored ID. * * The numeric ID is what SDL_WindowEvent references, and is necessary to map * these events to specific SDL_Window objects. * * \param id the ID of the window. * \returns the window associated with `id` or NULL if it doesn't exist; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowID */ SDL_GetWindowFromID :: (id: SDL_WindowID) -> *SDL_Window #foreign libsdl3; /** * Get parent of a window. * * \param window the window to query. * \returns the parent of the window on success or NULL if the window has no * parent. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreatePopupWindow */ SDL_GetWindowParent :: (window: *SDL_Window) -> *SDL_Window #foreign libsdl3; /** * Get the properties associated with a window. * * The following read-only properties are provided by SDL: * * - `SDL_PROP_WINDOW_SHAPE_POINTER`: the surface associated with a shaped * window * - `SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN`: true if the window has HDR * headroom above the SDR white point. This property can change dynamically * when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. * - `SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT`: the value of SDR white in the * SDL_COLORSPACE_SRGB_LINEAR colorspace. On Windows this corresponds to the * SDR white level in scRGB colorspace, and on Apple platforms this is * always 1.0 for EDR content. This property can change dynamically when * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. * - `SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT`: the additional high dynamic range * that can be displayed, in terms of the SDR white point. When HDR is not * enabled, this will be 1.0. This property can change dynamically when * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. * * On Android: * * - `SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER`: the ANativeWindow associated * with the window * - `SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER`: the EGLSurface associated with * the window * * On iOS: * * - `SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER`: the `(__unsafe_unretained)` * UIWindow associated with the window * - `SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER`: the NSInteger tag * associated with metal views on the window * - `SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER`: the OpenGL view's * framebuffer object. It must be bound when rendering to the screen using * OpenGL. * - `SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER`: the OpenGL view's * renderbuffer object. It must be bound when SDL_GL_SwapWindow is called. * - `SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER`: the OpenGL * view's resolve framebuffer, when MSAA is used. * * On KMS/DRM: * * - `SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER`: the device index associated * with the window (e.g. the X in /dev/dri/cardX) * - `SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER`: the DRM FD associated with the * window * - `SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER`: the GBM device associated * with the window * * On macOS: * * - `SDL_PROP_WINDOW_COCOA_WINDOW_POINTER`: the `(__unsafe_unretained)` * NSWindow associated with the window * - `SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER`: the NSInteger tag * assocated with metal views on the window * * On OpenVR: * * - `SDL_PROP_WINDOW_OPENVR_OVERLAY_ID`: the OpenVR Overlay Handle ID for the * associated overlay window. * * On Vivante: * * - `SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER`: the EGLNativeDisplayType * associated with the window * - `SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER`: the EGLNativeWindowType * associated with the window * - `SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER`: the EGLSurface associated with * the window * * On Windows: * * - `SDL_PROP_WINDOW_WIN32_HWND_POINTER`: the HWND associated with the window * - `SDL_PROP_WINDOW_WIN32_HDC_POINTER`: the HDC associated with the window * - `SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER`: the HINSTANCE associated with * the window * * On Wayland: * * Note: The `xdg_*` window objects do not internally persist across window * show/hide calls. They will be null if the window is hidden and must be * queried each time it is shown. * * - `SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER`: the wl_display associated with * the window * - `SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER`: the wl_surface associated with * the window * - `SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER`: the wp_viewport associated * with the window * - `SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER`: the wl_egl_window * associated with the window * - `SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER`: the xdg_surface associated * with the window * - `SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER`: the xdg_toplevel role * associated with the window * - 'SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING': the export * handle associated with the window * - `SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER`: the xdg_popup role * associated with the window * - `SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER`: the xdg_positioner * associated with the window, in popup mode * * On X11: * * - `SDL_PROP_WINDOW_X11_DISPLAY_POINTER`: the X11 Display associated with * the window * - `SDL_PROP_WINDOW_X11_SCREEN_NUMBER`: the screen number associated with * the window * - `SDL_PROP_WINDOW_X11_WINDOW_NUMBER`: the X11 Window associated with the * window * * \param window the window to query. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetWindowProperties :: (window: *SDL_Window) -> SDL_PropertiesID #foreign libsdl3; /** * Get the window flags. * * \param window the window to query. * \returns a mask of the SDL_WindowFlags associated with `window`. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateWindow * \sa SDL_HideWindow * \sa SDL_MaximizeWindow * \sa SDL_MinimizeWindow * \sa SDL_SetWindowFullscreen * \sa SDL_SetWindowMouseGrab * \sa SDL_ShowWindow */ SDL_GetWindowFlags :: (window: *SDL_Window) -> SDL_WindowFlags #foreign libsdl3; /** * Set the title of a window. * * This string is expected to be in UTF-8 encoding. * * \param window the window to change. * \param title the desired window title in UTF-8 format. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowTitle */ SDL_SetWindowTitle :: (window: *SDL_Window, title: *u8) -> bool #foreign libsdl3; /** * Get the title of a window. * * \param window the window to query. * \returns the title of the window in UTF-8 format or "" if there is no * title. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowTitle */ SDL_GetWindowTitle :: (window: *SDL_Window) -> *u8 #foreign libsdl3; /** * Set the icon for a window. * * If this function is passed a surface with alternate representations, the * surface will be interpreted as the content to be used for 100% display * scale, and the alternate representations will be used for high DPI * situations. For example, if the original surface is 32x32, then on a 2x * macOS display or 200% display scale on Windows, a 64x64 version of the * image will be used, if available. If a matching version of the image isn't * available, the closest larger size image will be downscaled to the * appropriate size and be used instead, if available. Otherwise, the closest * smaller image will be upscaled and be used instead. * * \param window the window to change. * \param icon an SDL_Surface structure containing the icon for the window. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_SetWindowIcon :: (window: *SDL_Window, icon: *SDL_Surface) -> bool #foreign libsdl3; /** * Request that the window's position be set. * * If the window is in an exclusive fullscreen or maximized state, this * request has no effect. * * This can be used to reposition fullscreen-desktop windows onto a different * display, however, as exclusive fullscreen windows are locked to a specific * display, they can only be repositioned programmatically via * SDL_SetWindowFullscreenMode(). * * On some windowing systems this request is asynchronous and the new * coordinates may not have have been applied immediately upon the return of * this function. If an immediate change is required, call SDL_SyncWindow() to * block until the changes have taken effect. * * When the window position changes, an SDL_EVENT_WINDOW_MOVED event will be * emitted with the window's new coordinates. Note that the new coordinates * may not match the exact coordinates requested, as some windowing systems * can restrict the position of the window in certain scenarios (e.g. * constraining the position so the window is always within desktop bounds). * Additionally, as this is just a request, it can be denied by the windowing * system. * * \param window the window to reposition. * \param x the x coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or * `SDL_WINDOWPOS_UNDEFINED`. * \param y the y coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or * `SDL_WINDOWPOS_UNDEFINED`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowPosition * \sa SDL_SyncWindow */ SDL_SetWindowPosition :: (window: *SDL_Window, x: s32, y: s32) -> bool #foreign libsdl3; /** * Get the position of a window. * * This is the current position of the window as last reported by the * windowing system. * * If you do not need the value for one of the positions a NULL may be passed * in the `x` or `y` parameter. * * \param window the window to query. * \param x a pointer filled in with the x position of the window, may be * NULL. * \param y a pointer filled in with the y position of the window, may be * NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowPosition */ SDL_GetWindowPosition :: (window: *SDL_Window, x: *s32, y: *s32) -> bool #foreign libsdl3; /** * Request that the size of a window's client area be set. * * If the window is in a fullscreen or maximized state, this request has no * effect. * * To change the exclusive fullscreen mode of a window, use * SDL_SetWindowFullscreenMode(). * * On some windowing systems, this request is asynchronous and the new window * size may not have have been applied immediately upon the return of this * function. If an immediate change is required, call SDL_SyncWindow() to * block until the changes have taken effect. * * When the window size changes, an SDL_EVENT_WINDOW_RESIZED event will be * emitted with the new window dimensions. Note that the new dimensions may * not match the exact size requested, as some windowing systems can restrict * the window size in certain scenarios (e.g. constraining the size of the * content area to remain within the usable desktop bounds). Additionally, as * this is just a request, it can be denied by the windowing system. * * \param window the window to change. * \param w the width of the window, must be > 0. * \param h the height of the window, must be > 0. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSize * \sa SDL_SetWindowFullscreenMode * \sa SDL_SyncWindow */ SDL_SetWindowSize :: (window: *SDL_Window, w: s32, h: s32) -> bool #foreign libsdl3; /** * Get the size of a window's client area. * * The window pixel size may differ from its window coordinate size if the * window is on a high pixel density display. Use SDL_GetWindowSizeInPixels() * or SDL_GetRenderOutputSize() to get the real client area size in pixels. * * \param window the window to query the width and height from. * \param w a pointer filled in with the width of the window, may be NULL. * \param h a pointer filled in with the height of the window, may be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderOutputSize * \sa SDL_GetWindowSizeInPixels * \sa SDL_SetWindowSize */ SDL_GetWindowSize :: (window: *SDL_Window, w: *s32, h: *s32) -> bool #foreign libsdl3; /** * Get the safe area for this window. * * Some devices have portions of the screen which are partially obscured or * not interactive, possibly due to on-screen controls, curved edges, camera * notches, TV overscan, etc. This function provides the area of the window * which is safe to have interactable content. You should continue rendering * into the rest of the window, but it should not contain visually important * or interactible content. * * \param window the window to query. * \param rect a pointer filled in with the client area that is safe for * interactive content. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetWindowSafeArea :: (window: *SDL_Window, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Request that the aspect ratio of a window's client area be set. * * The aspect ratio is the ratio of width divided by height, e.g. 2560x1600 * would be 1.6. Larger aspect ratios are wider and smaller aspect ratios are * narrower. * * If, at the time of this request, the window in a fixed-size state, such as * maximized or fullscreen, the request will be deferred until the window * exits this state and becomes resizable again. * * On some windowing systems, this request is asynchronous and the new window * aspect ratio may not have have been applied immediately upon the return of * this function. If an immediate change is required, call SDL_SyncWindow() to * block until the changes have taken effect. * * When the window size changes, an SDL_EVENT_WINDOW_RESIZED event will be * emitted with the new window dimensions. Note that the new dimensions may * not match the exact aspect ratio requested, as some windowing systems can * restrict the window size in certain scenarios (e.g. constraining the size * of the content area to remain within the usable desktop bounds). * Additionally, as this is just a request, it can be denied by the windowing * system. * * \param window the window to change. * \param min_aspect the minimum aspect ratio of the window, or 0.0f for no * limit. * \param max_aspect the maximum aspect ratio of the window, or 0.0f for no * limit. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowAspectRatio * \sa SDL_SyncWindow */ SDL_SetWindowAspectRatio :: (window: *SDL_Window, min_aspect: float, max_aspect: float) -> bool #foreign libsdl3; /** * Get the size of a window's client area. * * \param window the window to query the width and height from. * \param min_aspect a pointer filled in with the minimum aspect ratio of the * window, may be NULL. * \param max_aspect a pointer filled in with the maximum aspect ratio of the * window, may be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowAspectRatio */ SDL_GetWindowAspectRatio :: (window: *SDL_Window, min_aspect: *float, max_aspect: *float) -> bool #foreign libsdl3; /** * Get the size of a window's borders (decorations) around the client area. * * Note: If this function fails (returns false), the size values will be * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the * window in question was borderless. * * Note: This function may fail on systems where the window has not yet been * decorated by the display server (for example, immediately after calling * SDL_CreateWindow). It is recommended that you wait at least until the * window has been presented and composited, so that the window system has a * chance to decorate the window and provide the border dimensions to SDL. * * This function also returns false if getting the information is not * supported. * * \param window the window to query the size values of the border * (decorations) from. * \param top pointer to variable for storing the size of the top border; NULL * is permitted. * \param left pointer to variable for storing the size of the left border; * NULL is permitted. * \param bottom pointer to variable for storing the size of the bottom * border; NULL is permitted. * \param right pointer to variable for storing the size of the right border; * NULL is permitted. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSize */ SDL_GetWindowBordersSize :: (window: *SDL_Window, top: *s32, left: *s32, bottom: *s32, right: *s32) -> bool #foreign libsdl3; /** * Get the size of a window's client area, in pixels. * * \param window the window from which the drawable size should be queried. * \param w a pointer to variable for storing the width in pixels, may be * NULL. * \param h a pointer to variable for storing the height in pixels, may be * NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateWindow * \sa SDL_GetWindowSize */ SDL_GetWindowSizeInPixels :: (window: *SDL_Window, w: *s32, h: *s32) -> bool #foreign libsdl3; /** * Set the minimum size of a window's client area. * * \param window the window to change. * \param min_w the minimum width of the window, or 0 for no limit. * \param min_h the minimum height of the window, or 0 for no limit. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMinimumSize * \sa SDL_SetWindowMaximumSize */ SDL_SetWindowMinimumSize :: (window: *SDL_Window, min_w: s32, min_h: s32) -> bool #foreign libsdl3; /** * Get the minimum size of a window's client area. * * \param window the window to query. * \param w a pointer filled in with the minimum width of the window, may be * NULL. * \param h a pointer filled in with the minimum height of the window, may be * NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMaximumSize * \sa SDL_SetWindowMinimumSize */ SDL_GetWindowMinimumSize :: (window: *SDL_Window, w: *s32, h: *s32) -> bool #foreign libsdl3; /** * Set the maximum size of a window's client area. * * \param window the window to change. * \param max_w the maximum width of the window, or 0 for no limit. * \param max_h the maximum height of the window, or 0 for no limit. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMaximumSize * \sa SDL_SetWindowMinimumSize */ SDL_SetWindowMaximumSize :: (window: *SDL_Window, max_w: s32, max_h: s32) -> bool #foreign libsdl3; /** * Get the maximum size of a window's client area. * * \param window the window to query. * \param w a pointer filled in with the maximum width of the window, may be * NULL. * \param h a pointer filled in with the maximum height of the window, may be * NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMinimumSize * \sa SDL_SetWindowMaximumSize */ SDL_GetWindowMaximumSize :: (window: *SDL_Window, w: *s32, h: *s32) -> bool #foreign libsdl3; /** * Set the border state of a window. * * This will add or remove the window's `SDL_WINDOW_BORDERLESS` flag and add * or remove the border from the actual window. This is a no-op if the * window's border already matches the requested state. * * You can't change the border state of a fullscreen window. * * \param window the window of which to change the border state. * \param bordered false to remove border, true to add border. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFlags */ SDL_SetWindowBordered :: (window: *SDL_Window, bordered: bool) -> bool #foreign libsdl3; /** * Set the user-resizable state of a window. * * This will add or remove the window's `SDL_WINDOW_RESIZABLE` flag and * allow/disallow user resizing of the window. This is a no-op if the window's * resizable state already matches the requested state. * * You can't change the resizable state of a fullscreen window. * * \param window the window of which to change the resizable state. * \param resizable true to allow resizing, false to disallow. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFlags */ SDL_SetWindowResizable :: (window: *SDL_Window, resizable: bool) -> bool #foreign libsdl3; /** * Set the window to always be above the others. * * This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This * will bring the window to the front and keep the window above the rest. * * \param window the window of which to change the always on top state. * \param on_top true to set the window always on top, false to disable. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFlags */ SDL_SetWindowAlwaysOnTop :: (window: *SDL_Window, on_top: bool) -> bool #foreign libsdl3; /** * Show a window. * * \param window the window to show. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HideWindow * \sa SDL_RaiseWindow */ SDL_ShowWindow :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Hide a window. * * \param window the window to hide. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ShowWindow * \sa SDL_WINDOW_HIDDEN */ SDL_HideWindow :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Request that a window be raised above other windows and gain the input * focus. * * The result of this request is subject to desktop window manager policy, * particularly if raising the requested window would result in stealing focus * from another application. If the window is successfully raised and gains * input focus, an SDL_EVENT_WINDOW_FOCUS_GAINED event will be emitted, and * the window will have the SDL_WINDOW_INPUT_FOCUS flag set. * * \param window the window to raise. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_RaiseWindow :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Request that the window be made as large as possible. * * Non-resizable windows can't be maximized. The window must have the * SDL_WINDOW_RESIZABLE flag set, or this will have no effect. * * On some windowing systems this request is asynchronous and the new window * state may not have have been applied immediately upon the return of this * function. If an immediate change is required, call SDL_SyncWindow() to * block until the changes have taken effect. * * When the window state changes, an SDL_EVENT_WINDOW_MAXIMIZED event will be * emitted. Note that, as this is just a request, the windowing system can * deny the state change. * * When maximizing a window, whether the constraints set via * SDL_SetWindowMaximumSize() are honored depends on the policy of the window * manager. Win32 and macOS enforce the constraints when maximizing, while X11 * and Wayland window managers may vary. * * \param window the window to maximize. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_MinimizeWindow * \sa SDL_RestoreWindow * \sa SDL_SyncWindow */ SDL_MaximizeWindow :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Request that the window be minimized to an iconic representation. * * If the window is in a fullscreen state, this request has no direct effect. * It may alter the state the window is returned to when leaving fullscreen. * * On some windowing systems this request is asynchronous and the new window * state may not have been applied immediately upon the return of this * function. If an immediate change is required, call SDL_SyncWindow() to * block until the changes have taken effect. * * When the window state changes, an SDL_EVENT_WINDOW_MINIMIZED event will be * emitted. Note that, as this is just a request, the windowing system can * deny the state change. * * \param window the window to minimize. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_MaximizeWindow * \sa SDL_RestoreWindow * \sa SDL_SyncWindow */ SDL_MinimizeWindow :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Request that the size and position of a minimized or maximized window be * restored. * * If the window is in a fullscreen state, this request has no direct effect. * It may alter the state the window is returned to when leaving fullscreen. * * On some windowing systems this request is asynchronous and the new window * state may not have have been applied immediately upon the return of this * function. If an immediate change is required, call SDL_SyncWindow() to * block until the changes have taken effect. * * When the window state changes, an SDL_EVENT_WINDOW_RESTORED event will be * emitted. Note that, as this is just a request, the windowing system can * deny the state change. * * \param window the window to restore. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_MaximizeWindow * \sa SDL_MinimizeWindow * \sa SDL_SyncWindow */ SDL_RestoreWindow :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Request that the window's fullscreen state be changed. * * By default a window in fullscreen state uses borderless fullscreen desktop * mode, but a specific exclusive display mode can be set using * SDL_SetWindowFullscreenMode(). * * On some windowing systems this request is asynchronous and the new * fullscreen state may not have have been applied immediately upon the return * of this function. If an immediate change is required, call SDL_SyncWindow() * to block until the changes have taken effect. * * When the window state changes, an SDL_EVENT_WINDOW_ENTER_FULLSCREEN or * SDL_EVENT_WINDOW_LEAVE_FULLSCREEN event will be emitted. Note that, as this * is just a request, it can be denied by the windowing system. * * \param window the window to change. * \param fullscreen true for fullscreen mode, false for windowed mode. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowFullscreenMode * \sa SDL_SetWindowFullscreenMode * \sa SDL_SyncWindow * \sa SDL_WINDOW_FULLSCREEN */ SDL_SetWindowFullscreen :: (window: *SDL_Window, fullscreen: bool) -> bool #foreign libsdl3; /** * Block until any pending window state is finalized. * * On asynchronous windowing systems, this acts as a synchronization barrier * for pending window state. It will attempt to wait until any pending window * state has been applied and is guaranteed to return within finite time. Note * that for how long it can potentially block depends on the underlying window * system, as window state changes may involve somewhat lengthy animations * that must complete before the window is in its final requested state. * * On windowing systems where changes are immediate, this does nothing. * * \param window the window for which to wait for the pending state to be * applied. * \returns true on success or false if the operation timed out before the * window was in the requested state. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowSize * \sa SDL_SetWindowPosition * \sa SDL_SetWindowFullscreen * \sa SDL_MinimizeWindow * \sa SDL_MaximizeWindow * \sa SDL_RestoreWindow * \sa SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS */ SDL_SyncWindow :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Return whether the window has a surface associated with it. * * \param window the window to query. * \returns true if there is a surface associated with the window, or false * otherwise. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurface */ SDL_WindowHasSurface :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Get the SDL surface associated with the window. * * A new surface will be created with the optimal format for the window, if * necessary. This surface will be freed when the window is destroyed. Do not * free this surface. * * This surface will be invalidated if the window is resized. After resizing a * window this function must be called again to return a valid surface. * * You may not combine this with 3D or the rendering API on this window. * * This function is affected by `SDL_HINT_FRAMEBUFFER_ACCELERATION`. * * \param window the window to query. * \returns the surface associated with the window, or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyWindowSurface * \sa SDL_WindowHasSurface * \sa SDL_UpdateWindowSurface * \sa SDL_UpdateWindowSurfaceRects */ SDL_GetWindowSurface :: (window: *SDL_Window) -> *SDL_Surface #foreign libsdl3; /** * Toggle VSync for the window surface. * * When a window surface is created, vsync defaults to * SDL_WINDOW_SURFACE_VSYNC_DISABLED. * * The `vsync` parameter can be 1 to synchronize present with every vertical * refresh, 2 to synchronize present with every second vertical refresh, etc., * SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE for late swap tearing (adaptive vsync), * or SDL_WINDOW_SURFACE_VSYNC_DISABLED to disable. Not every value is * supported by every driver, so you should check the return value to see * whether the requested setting is supported. * * \param window the window. * \param vsync the vertical refresh sync interval. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurfaceVSync */ SDL_SetWindowSurfaceVSync :: (window: *SDL_Window, vsync: s32) -> bool #foreign libsdl3; /** * Get VSync for the window surface. * * \param window the window to query. * \param vsync an int filled with the current vertical refresh sync interval. * See SDL_SetWindowSurfaceVSync() for the meaning of the value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowSurfaceVSync */ SDL_GetWindowSurfaceVSync :: (window: *SDL_Window, vsync: *s32) -> bool #foreign libsdl3; /** * Copy the window surface to the screen. * * This is the function you use to reflect any changes to the surface on the * screen. * * This function is equivalent to the SDL 1.2 API SDL_Flip(). * * \param window the window to update. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurface * \sa SDL_UpdateWindowSurfaceRects */ SDL_UpdateWindowSurface :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Copy areas of the window surface to the screen. * * This is the function you use to reflect changes to portions of the surface * on the screen. * * This function is equivalent to the SDL 1.2 API SDL_UpdateRects(). * * Note that this function will update _at least_ the rectangles specified, * but this is only intended as an optimization; in practice, this might * update more of the screen (or all of the screen!), depending on what method * SDL uses to send pixels to the system. * * \param window the window to update. * \param rects an array of SDL_Rect structures representing areas of the * surface to copy, in pixels. * \param numrects the number of rectangles. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurface * \sa SDL_UpdateWindowSurface */ SDL_UpdateWindowSurfaceRects :: (window: *SDL_Window, rects: *SDL_Rect, numrects: s32) -> bool #foreign libsdl3; /** * Destroy the surface associated with the window. * * \param window the window to update. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowSurface * \sa SDL_WindowHasSurface */ SDL_DestroyWindowSurface :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Set a window's keyboard grab mode. * * Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or * the Meta/Super key. Note that not all system keyboard shortcuts can be * captured by applications (one example is Ctrl+Alt+Del on Windows). * * This is primarily intended for specialized applications such as VNC clients * or VM frontends. Normal games should not use keyboard grab. * * When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the * window is full-screen to ensure the user is not trapped in your * application. If you have a custom keyboard shortcut to exit fullscreen * mode, you may suppress this behavior with * `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`. * * If the caller enables a grab while another window is currently grabbed, the * other window loses its grab in favor of the caller's window. * * \param window the window for which the keyboard grab mode should be set. * \param grabbed this is true to grab keyboard, and false to release. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowKeyboardGrab * \sa SDL_SetWindowMouseGrab */ SDL_SetWindowKeyboardGrab :: (window: *SDL_Window, grabbed: bool) -> bool #foreign libsdl3; /** * Set a window's mouse grab mode. * * Mouse grab confines the mouse cursor to the window. * * \param window the window for which the mouse grab mode should be set. * \param grabbed this is true to grab mouse, and false to release. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMouseRect * \sa SDL_SetWindowMouseRect * \sa SDL_SetWindowMouseGrab * \sa SDL_SetWindowKeyboardGrab */ SDL_SetWindowMouseGrab :: (window: *SDL_Window, grabbed: bool) -> bool #foreign libsdl3; /** * Get a window's keyboard grab mode. * * \param window the window to query. * \returns true if keyboard is grabbed, and false otherwise. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowKeyboardGrab */ SDL_GetWindowKeyboardGrab :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Get a window's mouse grab mode. * * \param window the window to query. * \returns true if mouse is grabbed, and false otherwise. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMouseRect * \sa SDL_SetWindowMouseRect * \sa SDL_SetWindowMouseGrab * \sa SDL_SetWindowKeyboardGrab */ SDL_GetWindowMouseGrab :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Get the window that currently has an input grab enabled. * * \returns the window if input is grabbed or NULL otherwise. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowMouseGrab * \sa SDL_SetWindowKeyboardGrab */ SDL_GetGrabbedWindow :: () -> *SDL_Window #foreign libsdl3; /** * Confines the cursor to the specified area of a window. * * Note that this does NOT grab the cursor, it only defines the area a cursor * is restricted to when the window has mouse focus. * * \param window the window that will be associated with the barrier. * \param rect a rectangle area in window-relative coordinates. If NULL the * barrier for the specified window will be destroyed. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowMouseRect * \sa SDL_GetWindowMouseGrab * \sa SDL_SetWindowMouseGrab */ SDL_SetWindowMouseRect :: (window: *SDL_Window, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Get the mouse confinement rectangle of a window. * * \param window the window to query. * \returns a pointer to the mouse confinement rectangle of a window, or NULL * if there isn't one. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowMouseRect * \sa SDL_GetWindowMouseGrab * \sa SDL_SetWindowMouseGrab */ SDL_GetWindowMouseRect :: (window: *SDL_Window) -> *SDL_Rect #foreign libsdl3; /** * Set the opacity for a window. * * The parameter `opacity` will be clamped internally between 0.0f * (transparent) and 1.0f (opaque). * * This function also returns false if setting the opacity isn't supported. * * \param window the window which will be made transparent or opaque. * \param opacity the opacity value (0.0f - transparent, 1.0f - opaque). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowOpacity */ SDL_SetWindowOpacity :: (window: *SDL_Window, opacity: float) -> bool #foreign libsdl3; /** * Get the opacity of a window. * * If transparency isn't supported on this platform, opacity will be returned * as 1.0f without error. * * \param window the window to get the current opacity value from. * \returns the opacity, (0.0f - transparent, 1.0f - opaque), or -1.0f on * failure; call SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowOpacity */ SDL_GetWindowOpacity :: (window: *SDL_Window) -> float #foreign libsdl3; /** * Set the window as a child of a parent window. * * If the window is already the child of an existing window, it will be * reparented to the new owner. Setting the parent window to NULL unparents * the window and removes child window status. * * If a parent window is hidden or destroyed, the operation will be * recursively applied to child windows. Child windows hidden with the parent * that did not have their hidden status explicitly set will be restored when * the parent is shown. * * Attempting to set the parent of a window that is currently in the modal * state will fail. Use SDL_SetWindowModal() to cancel the modal status before * attempting to change the parent. * * Popup windows cannot change parents and attempts to do so will fail. * * Setting a parent window that is currently the sibling or descendent of the * child window results in undefined behavior. * * \param window the window that should become the child of a parent. * \param parent the new parent window for the child window. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowModal */ SDL_SetWindowParent :: (window: *SDL_Window, parent: *SDL_Window) -> bool #foreign libsdl3; /** * Toggle the state of the window as modal. * * To enable modal status on a window, the window must currently be the child * window of a parent, or toggling modal status on will fail. * * \param window the window on which to set the modal state. * \param modal true to toggle modal status on, false to toggle it off. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowParent * \sa SDL_WINDOW_MODAL */ SDL_SetWindowModal :: (window: *SDL_Window, modal: bool) -> bool #foreign libsdl3; /** * Set whether the window may have input focus. * * \param window the window to set focusable state. * \param focusable true to allow input focus, false to not allow input focus. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_SetWindowFocusable :: (window: *SDL_Window, focusable: bool) -> bool #foreign libsdl3; /** * Display the system-level window menu. * * This default window menu is provided by the system and on some platforms * provides functionality for setting or changing privileged state on the * window, such as moving it between workspaces or displays, or toggling the * always-on-top property. * * On platforms or desktops where this is unsupported, this function does * nothing. * * \param window the window for which the menu will be displayed. * \param x the x coordinate of the menu, relative to the origin (top-left) of * the client area. * \param y the y coordinate of the menu, relative to the origin (top-left) of * the client area. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_ShowWindowSystemMenu :: (window: *SDL_Window, x: s32, y: s32) -> bool #foreign libsdl3; /** * Possible return values from the SDL_HitTest callback. * * \threadsafety This function should only be called on the main thread. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_HitTest */ using SDL_HitTestResult :: enum u32 { SDL_HITTEST_NORMAL :: 0; SDL_HITTEST_DRAGGABLE :: 1; SDL_HITTEST_RESIZE_TOPLEFT :: 2; SDL_HITTEST_RESIZE_TOP :: 3; SDL_HITTEST_RESIZE_TOPRIGHT :: 4; SDL_HITTEST_RESIZE_RIGHT :: 5; SDL_HITTEST_RESIZE_BOTTOMRIGHT :: 6; SDL_HITTEST_RESIZE_BOTTOM :: 7; SDL_HITTEST_RESIZE_BOTTOMLEFT :: 8; SDL_HITTEST_RESIZE_LEFT :: 9; } /** * Callback used for hit-testing. * * \param win the SDL_Window where hit-testing was set on. * \param area an SDL_Point which should be hit-tested. * \param data what was passed as `callback_data` to SDL_SetWindowHitTest(). * \returns an SDL_HitTestResult value. * * \sa SDL_SetWindowHitTest */ SDL_HitTest :: #type (win: *SDL_Window, area: *SDL_Point, data: *void) -> SDL_HitTestResult #c_call; /** * Provide a callback that decides if a window region has special properties. * * Normally windows are dragged and resized by decorations provided by the * system window manager (a title bar, borders, etc), but for some apps, it * makes sense to drag them from somewhere else inside the window itself; for * example, one might have a borderless window that wants to be draggable from * any part, or simulate its own title bar, etc. * * This function lets the app provide a callback that designates pieces of a * given window as special. This callback is run during event processing if we * need to tell the OS to treat a region of the window specially; the use of * this callback is known as "hit testing." * * Mouse input may not be delivered to your application if it is within a * special area; the OS will often apply that input to moving the window or * resizing the window and not deliver it to the application. * * Specifying NULL for a callback disables hit-testing. Hit-testing is * disabled by default. * * Platforms that don't support this functionality will return false * unconditionally, even if you're attempting to disable hit-testing. * * Your callback may fire at any time, and its firing does not indicate any * specific behavior (for example, on Windows, this certainly might fire when * the OS is deciding whether to drag your window, but it fires for lots of * other reasons, too, some unrelated to anything you probably care about _and * when the mouse isn't actually at the location it is testing_). Since this * can fire at any time, you should try to keep your callback efficient, * devoid of allocations, etc. * * \param window the window to set hit-testing on. * \param callback the function to call when doing a hit-test. * \param callback_data an app-defined void pointer passed to **callback**. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_SetWindowHitTest :: (window: *SDL_Window, callback: SDL_HitTest, callback_data: *void) -> bool #foreign libsdl3; /** * Set the shape of a transparent window. * * This sets the alpha channel of a transparent window and any fully * transparent areas are also transparent to mouse clicks. If you are using * something besides the SDL render API, then you are responsible for drawing * the alpha channel of the window to match the shape alpha channel to get * consistent cross-platform results. * * The shape is copied inside this function, so you can free it afterwards. If * your shape surface changes, you should call SDL_SetWindowShape() again to * update the window. This is an expensive operation, so should be done * sparingly. * * The window must have been created with the SDL_WINDOW_TRANSPARENT flag. * * \param window the window. * \param shape the surface representing the shape of the window, or NULL to * remove any current shape. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_SetWindowShape :: (window: *SDL_Window, shape: *SDL_Surface) -> bool #foreign libsdl3; /** * Request a window to demand attention from the user. * * \param window the window to be flashed. * \param operation the operation to perform. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_FlashWindow :: (window: *SDL_Window, operation: SDL_FlashOperation) -> bool #foreign libsdl3; /** * Destroy a window. * * Any child windows owned by the window will be recursively destroyed as * well. * * Note that on some platforms, the visible window may not actually be removed * from the screen until the SDL event loop is pumped again, even though the * SDL_Window is no longer valid after this call. * * \param window the window to destroy. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreatePopupWindow * \sa SDL_CreateWindow * \sa SDL_CreateWindowWithProperties */ SDL_DestroyWindow :: (window: *SDL_Window) -> void #foreign libsdl3; /** * Check whether the screensaver is currently enabled. * * The screensaver is disabled by default. * * The default can also be changed using `SDL_HINT_VIDEO_ALLOW_SCREENSAVER`. * * \returns true if the screensaver is enabled, false if it is disabled. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DisableScreenSaver * \sa SDL_EnableScreenSaver */ SDL_ScreenSaverEnabled :: () -> bool #foreign libsdl3; /** * Allow the screen to be blanked by a screen saver. * * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DisableScreenSaver * \sa SDL_ScreenSaverEnabled */ SDL_EnableScreenSaver :: () -> bool #foreign libsdl3; /** * Prevent the screen from being blanked by a screen saver. * * If you disable the screensaver, it is automatically re-enabled when SDL * quits. * * The screensaver is disabled by default, but this may by changed by * SDL_HINT_VIDEO_ALLOW_SCREENSAVER. * * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_EnableScreenSaver * \sa SDL_ScreenSaverEnabled */ SDL_DisableScreenSaver :: () -> bool #foreign libsdl3; /** * Dynamically load an OpenGL library. * * This should be done after initializing the video driver, but before * creating any OpenGL windows. If no OpenGL library is loaded, the default * library will be loaded upon creation of the first OpenGL window. * * If you do this, you need to retrieve all of the GL functions used in your * program from the dynamic library using SDL_GL_GetProcAddress(). * * \param path the platform dependent OpenGL library name, or NULL to open the * default OpenGL library. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_GetProcAddress * \sa SDL_GL_UnloadLibrary */ SDL_GL_LoadLibrary :: (path: *u8) -> bool #foreign libsdl3; /** * Get an OpenGL function by name. * * If the GL library is loaded at runtime with SDL_GL_LoadLibrary(), then all * GL functions must be retrieved this way. Usually this is used to retrieve * function pointers to OpenGL extensions. * * There are some quirks to looking up OpenGL functions that require some * extra care from the application. If you code carefully, you can handle * these quirks without any platform-specific code, though: * * - On Windows, function pointers are specific to the current GL context; * this means you need to have created a GL context and made it current * before calling SDL_GL_GetProcAddress(). If you recreate your context or * create a second context, you should assume that any existing function * pointers aren't valid to use with it. This is (currently) a * Windows-specific limitation, and in practice lots of drivers don't suffer * this limitation, but it is still the way the wgl API is documented to * work and you should expect crashes if you don't respect it. Store a copy * of the function pointers that comes and goes with context lifespan. * - On X11, function pointers returned by this function are valid for any * context, and can even be looked up before a context is created at all. * This means that, for at least some common OpenGL implementations, if you * look up a function that doesn't exist, you'll get a non-NULL result that * is _NOT_ safe to call. You must always make sure the function is actually * available for a given GL context before calling it, by checking for the * existence of the appropriate extension with SDL_GL_ExtensionSupported(), * or verifying that the version of OpenGL you're using offers the function * as core functionality. * - Some OpenGL drivers, on all platforms, *will* return NULL if a function * isn't supported, but you can't count on this behavior. Check for * extensions you use, and if you get a NULL anyway, act as if that * extension wasn't available. This is probably a bug in the driver, but you * can code defensively for this scenario anyhow. * - Just because you're on Linux/Unix, don't assume you'll be using X11. * Next-gen display servers are waiting to replace it, and may or may not * make the same promises about function pointers. * - OpenGL function pointers must be declared `APIENTRY` as in the example * code. This will ensure the proper calling convention is followed on * platforms where this matters (Win32) thereby avoiding stack corruption. * * \param proc the name of an OpenGL function. * \returns a pointer to the named OpenGL function. The returned pointer * should be cast to the appropriate function signature. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_ExtensionSupported * \sa SDL_GL_LoadLibrary * \sa SDL_GL_UnloadLibrary */ SDL_GL_GetProcAddress :: (proc: *u8) -> SDL_FunctionPointer #foreign libsdl3; /** * Get an EGL library function by name. * * If an EGL library is loaded, this function allows applications to get entry * points for EGL functions. This is useful to provide to an EGL API and * extension loader. * * \param proc the name of an EGL function. * \returns a pointer to the named EGL function. The returned pointer should * be cast to the appropriate function signature. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_EGL_GetCurrentDisplay */ SDL_EGL_GetProcAddress :: (proc: *u8) -> SDL_FunctionPointer #foreign libsdl3; /** * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_LoadLibrary */ SDL_GL_UnloadLibrary :: () -> void #foreign libsdl3; /** * Check if an OpenGL extension is supported for the current context. * * This function operates on the current GL context; you must have created a * context and it must be current before calling this function. Do not assume * that all contexts you create will have the same set of extensions * available, or that recreating an existing context will offer the same * extensions again. * * While it's probably not a massive overhead, this function is not an O(1) * operation. Check the extensions you care about after creating the GL * context and save that information somewhere instead of calling the function * every time you need to know. * * \param extension the name of the extension to check. * \returns true if the extension is supported, false otherwise. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GL_ExtensionSupported :: (extension: *u8) -> bool #foreign libsdl3; /** * Reset all previously set OpenGL context attributes to their default values. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_GetAttribute * \sa SDL_GL_SetAttribute */ SDL_GL_ResetAttributes :: () -> void #foreign libsdl3; /** * Set an OpenGL window attribute before window creation. * * This function sets the OpenGL attribute `attr` to `value`. The requested * attributes should be set before creating an OpenGL window. You should use * SDL_GL_GetAttribute() to check the values after creating the OpenGL * context, since the values obtained can differ from the requested ones. * * \param attr an SDL_GLAttr enum value specifying the OpenGL attribute to * set. * \param value the desired value for the attribute. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_GetAttribute * \sa SDL_GL_ResetAttributes */ SDL_GL_SetAttribute :: (attr: SDL_GLAttr, value: s32) -> bool #foreign libsdl3; /** * Get the actual value for an attribute from the current context. * * \param attr an SDL_GLAttr enum value specifying the OpenGL attribute to * get. * \param value a pointer filled in with the current value of `attr`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_ResetAttributes * \sa SDL_GL_SetAttribute */ SDL_GL_GetAttribute :: (attr: SDL_GLAttr, value: *s32) -> bool #foreign libsdl3; /** * Create an OpenGL context for an OpenGL window, and make it current. * * Windows users new to OpenGL should note that, for historical reasons, GL * functions added after OpenGL version 1.1 are not available by default. * Those functions must be loaded at run-time, either with an OpenGL * extension-handling library or with SDL_GL_GetProcAddress() and its related * functions. * * SDL_GLContext is opaque to the application. * * \param window the window to associate with the context. * \returns the OpenGL context associated with `window` or NULL on failure; * call SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_DestroyContext * \sa SDL_GL_MakeCurrent */ SDL_GL_CreateContext :: (window: *SDL_Window) -> SDL_GLContext #foreign libsdl3; /** * Set up an OpenGL context for rendering into an OpenGL window. * * The context must have been created with a compatible window. * * \param window the window to associate with the context. * \param context the OpenGL context to associate with the window. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_CreateContext */ SDL_GL_MakeCurrent :: (window: *SDL_Window, _context: SDL_GLContext) -> bool #foreign libsdl3; /** * Get the currently active OpenGL window. * * \returns the currently active OpenGL window on success or NULL on failure; * call SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GL_GetCurrentWindow :: () -> *SDL_Window #foreign libsdl3; /** * Get the currently active OpenGL context. * * \returns the currently active OpenGL context or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_MakeCurrent */ SDL_GL_GetCurrentContext :: () -> SDL_GLContext #foreign libsdl3; /** * Get the currently active EGL display. * * \returns the currently active EGL display or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_EGL_GetCurrentDisplay :: () -> SDL_EGLDisplay #foreign libsdl3; /** * Get the currently active EGL config. * * \returns the currently active EGL config or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_EGL_GetCurrentConfig :: () -> SDL_EGLConfig #foreign libsdl3; /** * Get the EGL surface associated with the window. * * \param window the window to query. * \returns the EGLSurface pointer associated with the window, or NULL on * failure. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_EGL_GetWindowSurface :: (window: *SDL_Window) -> SDL_EGLSurface #foreign libsdl3; /** * Sets the callbacks for defining custom EGLAttrib arrays for EGL * initialization. * * Callbacks that aren't needed can be set to NULL. * * NOTE: These callback pointers will be reset after SDL_GL_ResetAttributes. * * \param platformAttribCallback callback for attributes to pass to * eglGetPlatformDisplay. May be NULL. * \param surfaceAttribCallback callback for attributes to pass to * eglCreateSurface. May be NULL. * \param contextAttribCallback callback for attributes to pass to * eglCreateContext. May be NULL. * \param userdata a pointer that is passed to the callbacks. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_EGL_SetAttributeCallbacks :: (platformAttribCallback: SDL_EGLAttribArrayCallback, surfaceAttribCallback: SDL_EGLIntArrayCallback, contextAttribCallback: SDL_EGLIntArrayCallback, userdata: *void) -> void #foreign libsdl3; /** * Set the swap interval for the current OpenGL context. * * Some systems allow specifying -1 for the interval, to enable adaptive * vsync. Adaptive vsync works the same as vsync, but if you've already missed * the vertical retrace for a given frame, it swaps buffers immediately, which * might be less jarring for the user during occasional framerate drops. If an * application requests adaptive vsync and the system does not support it, * this function will fail and return false. In such a case, you should * probably retry the call with 1 for the interval. * * Adaptive vsync is implemented for some glX drivers with * GLX_EXT_swap_control_tear, and for some Windows drivers with * WGL_EXT_swap_control_tear. * * Read more on the Khronos wiki: * https://www.khronos.org/opengl/wiki/Swap_Interval#Adaptive_Vsync * * \param interval 0 for immediate updates, 1 for updates synchronized with * the vertical retrace, -1 for adaptive vsync. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_GetSwapInterval */ SDL_GL_SetSwapInterval :: (interval: s32) -> bool #foreign libsdl3; /** * Get the swap interval for the current OpenGL context. * * If the system can't determine the swap interval, or there isn't a valid * current context, this function will set *interval to 0 as a safe default. * * \param interval output interval value. 0 if there is no vertical retrace * synchronization, 1 if the buffer swap is synchronized with * the vertical retrace, and -1 if late swaps happen * immediately instead of waiting for the next retrace. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_SetSwapInterval */ SDL_GL_GetSwapInterval :: (interval: *s32) -> bool #foreign libsdl3; /** * Update a window with OpenGL rendering. * * This is used with double-buffered OpenGL contexts, which are the default. * * On macOS, make sure you bind 0 to the draw framebuffer before swapping the * window, otherwise nothing will happen. If you aren't using * glBindFramebuffer(), this is the default and you won't have to do anything * extra. * * \param window the window to change. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GL_SwapWindow :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Delete an OpenGL context. * * \param context the OpenGL context to be deleted. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GL_CreateContext */ SDL_GL_DestroyContext :: (_context: SDL_GLContext) -> bool #foreign libsdl3; /** * An entry for filters for file dialogs. * * `name` is a user-readable label for the filter (for example, "Office * document"). * * `pattern` is a semicolon-separated list of file extensions (for example, * "doc;docx"). File extensions may only contain alphanumeric characters, * hyphens, underscores and periods. Alternatively, the whole string can be a * single asterisk ("*"), which serves as an "All files" filter. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_DialogFileCallback * \sa SDL_ShowOpenFileDialog * \sa SDL_ShowSaveFileDialog * \sa SDL_ShowOpenFolderDialog * \sa SDL_ShowFileDialogWithProperties */ SDL_DialogFileFilter :: struct { name: *u8; pattern: *u8; } /** * Callback used by file dialog functions. * * The specific usage is described in each function. * * If `filelist` is: * * - NULL, an error occurred. Details can be obtained with SDL_GetError(). * - A pointer to NULL, the user either didn't choose any file or canceled the * dialog. * - A pointer to non-`NULL`, the user chose one or more files. The argument * is a null-terminated list of pointers to C strings, each containing a * path. * * The filelist argument should not be freed; it will automatically be freed * when the callback returns. * * The filter argument is the index of the filter that was selected, or -1 if * no filter was selected or if the platform or method doesn't support * fetching the selected filter. * * In Android, the `filelist` are `content://` URIs. They should be opened * using SDL_IOFromFile() with appropriate modes. This applies both to open * and save file dialog. * * \param userdata an app-provided pointer, for the callback's use. * \param filelist the file(s) chosen by the user. * \param filter index of the selected filter. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_DialogFileFilter * \sa SDL_ShowOpenFileDialog * \sa SDL_ShowSaveFileDialog * \sa SDL_ShowOpenFolderDialog * \sa SDL_ShowFileDialogWithProperties */ SDL_DialogFileCallback :: #type (userdata: *void, filelist: **u8, filter: s32) -> void #c_call; /** * Displays a dialog that lets the user select a file on their filesystem. * * This is an asynchronous function; it will return immediately, and the * result will be passed to the callback. * * The callback will be invoked with a null-terminated list of files the user * chose. The list will be empty if the user canceled the dialog, and it will * be NULL if an error occurred. * * Note that the callback may be called from a different thread than the one * the function was invoked on. * * Depending on the platform, the user may be allowed to input paths that * don't yet exist. * * On Linux, dialogs may require XDG Portals, which requires DBus, which * requires an event-handling loop. Apps that do not use SDL to handle events * should add a call to SDL_PumpEvents in their main loop. * * \param callback a function pointer to be invoked when the user selects a * file and accepts, or cancels the dialog, or an error * occurs. * \param userdata an optional pointer to pass extra data to the callback when * it will be invoked. * \param window the window that the dialog should be modal for, may be NULL. * Not all platforms support this option. * \param filters a list of filters, may be NULL. Not all platforms support * this option, and platforms that do support it may allow the * user to ignore the filters. If non-NULL, it must remain * valid at least until the callback is invoked. * \param nfilters the number of filters. Ignored if filters is NULL. * \param default_location the default folder or file to start the dialog at, * may be NULL. Not all platforms support this option. * \param allow_many if non-zero, the user will be allowed to select multiple * entries. Not all platforms support this option. * * \threadsafety This function should be called only from the main thread. The * callback may be invoked from the same thread or from a * different one, depending on the OS's constraints. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DialogFileCallback * \sa SDL_DialogFileFilter * \sa SDL_ShowSaveFileDialog * \sa SDL_ShowOpenFolderDialog * \sa SDL_ShowFileDialogWithProperties */ SDL_ShowOpenFileDialog :: (callback: SDL_DialogFileCallback, userdata: *void, window: *SDL_Window, filters: *SDL_DialogFileFilter, nfilters: s32, default_location: *u8, allow_many: bool) -> void #foreign libsdl3; /** * Displays a dialog that lets the user choose a new or existing file on their * filesystem. * * This is an asynchronous function; it will return immediately, and the * result will be passed to the callback. * * The callback will be invoked with a null-terminated list of files the user * chose. The list will be empty if the user canceled the dialog, and it will * be NULL if an error occurred. * * Note that the callback may be called from a different thread than the one * the function was invoked on. * * The chosen file may or may not already exist. * * On Linux, dialogs may require XDG Portals, which requires DBus, which * requires an event-handling loop. Apps that do not use SDL to handle events * should add a call to SDL_PumpEvents in their main loop. * * \param callback a function pointer to be invoked when the user selects a * file and accepts, or cancels the dialog, or an error * occurs. * \param userdata an optional pointer to pass extra data to the callback when * it will be invoked. * \param window the window that the dialog should be modal for, may be NULL. * Not all platforms support this option. * \param filters a list of filters, may be NULL. Not all platforms support * this option, and platforms that do support it may allow the * user to ignore the filters. If non-NULL, it must remain * valid at least until the callback is invoked. * \param nfilters the number of filters. Ignored if filters is NULL. * \param default_location the default folder or file to start the dialog at, * may be NULL. Not all platforms support this option. * * \threadsafety This function should be called only from the main thread. The * callback may be invoked from the same thread or from a * different one, depending on the OS's constraints. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DialogFileCallback * \sa SDL_DialogFileFilter * \sa SDL_ShowOpenFileDialog * \sa SDL_ShowOpenFolderDialog * \sa SDL_ShowFileDialogWithProperties */ SDL_ShowSaveFileDialog :: (callback: SDL_DialogFileCallback, userdata: *void, window: *SDL_Window, filters: *SDL_DialogFileFilter, nfilters: s32, default_location: *u8) -> void #foreign libsdl3; /** * Displays a dialog that lets the user select a folder on their filesystem. * * This is an asynchronous function; it will return immediately, and the * result will be passed to the callback. * * The callback will be invoked with a null-terminated list of files the user * chose. The list will be empty if the user canceled the dialog, and it will * be NULL if an error occurred. * * Note that the callback may be called from a different thread than the one * the function was invoked on. * * Depending on the platform, the user may be allowed to input paths that * don't yet exist. * * On Linux, dialogs may require XDG Portals, which requires DBus, which * requires an event-handling loop. Apps that do not use SDL to handle events * should add a call to SDL_PumpEvents in their main loop. * * \param callback a function pointer to be invoked when the user selects a * file and accepts, or cancels the dialog, or an error * occurs. * \param userdata an optional pointer to pass extra data to the callback when * it will be invoked. * \param window the window that the dialog should be modal for, may be NULL. * Not all platforms support this option. * \param default_location the default folder or file to start the dialog at, * may be NULL. Not all platforms support this option. * \param allow_many if non-zero, the user will be allowed to select multiple * entries. Not all platforms support this option. * * \threadsafety This function should be called only from the main thread. The * callback may be invoked from the same thread or from a * different one, depending on the OS's constraints. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DialogFileCallback * \sa SDL_ShowOpenFileDialog * \sa SDL_ShowSaveFileDialog * \sa SDL_ShowFileDialogWithProperties */ SDL_ShowOpenFolderDialog :: (callback: SDL_DialogFileCallback, userdata: *void, window: *SDL_Window, default_location: *u8, allow_many: bool) -> void #foreign libsdl3; /** * Various types of file dialogs. * * This is used by SDL_ShowFileDialogWithProperties() to decide what kind of * dialog to present to the user. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_ShowFileDialogWithProperties */ using SDL_FileDialogType :: enum u32 { SDL_FILEDIALOG_OPENFILE :: 0; SDL_FILEDIALOG_SAVEFILE :: 1; SDL_FILEDIALOG_OPENFOLDER :: 2; } /** * Create and launch a file dialog with the specified properties. * * These are the supported properties: * * - `SDL_PROP_FILE_DIALOG_FILTERS_POINTER`: a pointer to a list of * SDL_DialogFileFilter structs, which will be used as filters for * file-based selections. Ignored if the dialog is an "Open Folder" dialog. * If non-NULL, the array of filters must remain valid at least until the * callback is invoked. * - `SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER`: the number of filters in the * array of filters, if it exists. * - `SDL_PROP_FILE_DIALOG_WINDOW_POINTER`: the window that the dialog should * be modal for. * - `SDL_PROP_FILE_DIALOG_LOCATION_STRING`: the default folder or file to * start the dialog at. * - `SDL_PROP_FILE_DIALOG_MANY_BOOLEAN`: true to allow the user to select * more than one entry. * - `SDL_PROP_FILE_DIALOG_TITLE_STRING`: the title for the dialog. * - `SDL_PROP_FILE_DIALOG_ACCEPT_STRING`: the label that the accept button * should have. * - `SDL_PROP_FILE_DIALOG_CANCEL_STRING`: the label that the cancel button * should have. * * Note that each platform may or may not support any of the properties. * * \param type the type of file dialog. * \param callback a function pointer to be invoked when the user selects a * file and accepts, or cancels the dialog, or an error * occurs. * \param userdata an optional pointer to pass extra data to the callback when * it will be invoked. * \param props the properties to use. * * \threadsafety This function should be called only from the main thread. The * callback may be invoked from the same thread or from a * different one, depending on the OS's constraints. * * \since This function is available since SDL 3.2.0. * * \sa SDL_FileDialogType * \sa SDL_DialogFileCallback * \sa SDL_DialogFileFilter * \sa SDL_ShowOpenFileDialog * \sa SDL_ShowSaveFileDialog * \sa SDL_ShowOpenFolderDialog */ SDL_ShowFileDialogWithProperties :: (type: SDL_FileDialogType, callback: SDL_DialogFileCallback, userdata: *void, props: SDL_PropertiesID) -> void #foreign libsdl3; /** * An SDL_GUID is a 128-bit identifier for an input device that identifies * that device across runs of SDL programs on the same platform. * * If the device is detached and then re-attached to a different port, or if * the base system is rebooted, the device should still report the same GUID. * * GUIDs are as precise as possible but are not guaranteed to distinguish * physically distinct but equivalent devices. For example, two game * controllers from the same vendor with the same product ID and revision may * have the same GUID. * * GUIDs may be platform-dependent (i.e., the same device may report different * GUIDs on different operating systems). * * \since This struct is available since SDL 3.2.0. */ SDL_GUID :: struct { data: [16] Uint8; } /** * Get an ASCII string representation for a given SDL_GUID. * * \param guid the SDL_GUID you wish to convert to string. * \param pszGUID buffer in which to write the ASCII string. * \param cbGUID the size of pszGUID, should be at least 33 bytes. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StringToGUID */ SDL_GUIDToString :: (guid: SDL_GUID, pszGUID: *u8, cbGUID: s32) -> void #foreign libsdl3; /** * Convert a GUID string into a SDL_GUID structure. * * Performs no error checking. If this function is given a string containing * an invalid GUID, the function will silently succeed, but the GUID generated * will not be useful. * * \param pchGUID string containing an ASCII representation of a GUID. * \returns a SDL_GUID structure. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GUIDToString */ SDL_StringToGUID :: (pchGUID: *u8) -> SDL_GUID #foreign libsdl3; /** * The basic state for the system's power supply. * * These are results returned by SDL_GetPowerInfo(). * * \since This enum is available since SDL 3.2.0. */ using SDL_PowerState :: enum s32 { SDL_POWERSTATE_ERROR :: -1; SDL_POWERSTATE_UNKNOWN :: 0; SDL_POWERSTATE_ON_BATTERY :: 1; SDL_POWERSTATE_NO_BATTERY :: 2; SDL_POWERSTATE_CHARGING :: 3; SDL_POWERSTATE_CHARGED :: 4; } /** * Get the current power supply details. * * You should never take a battery status as absolute truth. Batteries * (especially failing batteries) are delicate hardware, and the values * reported here are best estimates based on what that hardware reports. It's * not uncommon for older batteries to lose stored power much faster than it * reports, or completely drain when reporting it has 20 percent left, etc. * * Battery status can change at any time; if you are concerned with power * state, you should call this function frequently, and perhaps ignore changes * until they seem to be stable for a few seconds. * * It's possible a platform can only report battery percentage or time left * but not both. * * \param seconds a pointer filled in with the seconds of battery life left, * or NULL to ignore. This will be filled in with -1 if we * can't determine a value or there is no battery. * \param percent a pointer filled in with the percentage of battery life * left, between 0 and 100, or NULL to ignore. This will be * filled in with -1 we can't determine a value or there is no * battery. * \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetPowerInfo :: (seconds: *s32, percent: *s32) -> SDL_PowerState #foreign libsdl3; SDL_Sensor :: struct {} /** * This is a unique ID for a sensor for the time it is connected to the * system, and is never reused for the lifetime of the application. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_SensorID :: Uint32; /** * The different sensors defined by SDL. * * Additional sensors may be available, using platform dependent semantics. * * Here are the additional Android sensors: * * https://developer.android.com/reference/android/hardware/SensorEvent.html#values * * Accelerometer sensor notes: * * The accelerometer returns the current acceleration in SI meters per second * squared. This measurement includes the force of gravity, so a device at * rest will have an value of SDL_STANDARD_GRAVITY away from the center of the * earth, which is a positive Y value. * * - `values[0]`: Acceleration on the x axis * - `values[1]`: Acceleration on the y axis * - `values[2]`: Acceleration on the z axis * * For phones and tablets held in natural orientation and game controllers * held in front of you, the axes are defined as follows: * * - -X ... +X : left ... right * - -Y ... +Y : bottom ... top * - -Z ... +Z : farther ... closer * * The accelerometer axis data is not changed when the device is rotated. * * Gyroscope sensor notes: * * The gyroscope returns the current rate of rotation in radians per second. * The rotation is positive in the counter-clockwise direction. That is, an * observer looking from a positive location on one of the axes would see * positive rotation on that axis when it appeared to be rotating * counter-clockwise. * * - `values[0]`: Angular speed around the x axis (pitch) * - `values[1]`: Angular speed around the y axis (yaw) * - `values[2]`: Angular speed around the z axis (roll) * * For phones and tablets held in natural orientation and game controllers * held in front of you, the axes are defined as follows: * * - -X ... +X : left ... right * - -Y ... +Y : bottom ... top * - -Z ... +Z : farther ... closer * * The gyroscope axis data is not changed when the device is rotated. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetCurrentDisplayOrientation */ using SDL_SensorType :: enum s32 { SDL_SENSOR_INVALID :: -1; SDL_SENSOR_UNKNOWN :: 0; SDL_SENSOR_ACCEL :: 1; SDL_SENSOR_GYRO :: 2; SDL_SENSOR_ACCEL_L :: 3; SDL_SENSOR_GYRO_L :: 4; SDL_SENSOR_ACCEL_R :: 5; SDL_SENSOR_GYRO_R :: 6; } /** * Get a list of currently connected sensors. * * \param count a pointer filled in with the number of sensors returned, may * be NULL. * \returns a 0 terminated array of sensor instance IDs or NULL on failure; * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensors :: (count: *s32) -> *SDL_SensorID #foreign libsdl3; /** * Get the implementation dependent name of a sensor. * * This can be called before any sensors are opened. * * \param instance_id the sensor instance ID. * \returns the sensor name, or NULL if `instance_id` is not valid. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorNameForID :: (instance_id: SDL_SensorID) -> *u8 #foreign libsdl3; /** * Get the type of a sensor. * * This can be called before any sensors are opened. * * \param instance_id the sensor instance ID. * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `instance_id` is * not valid. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorTypeForID :: (instance_id: SDL_SensorID) -> SDL_SensorType #foreign libsdl3; /** * Get the platform dependent type of a sensor. * * This can be called before any sensors are opened. * * \param instance_id the sensor instance ID. * \returns the sensor platform dependent type, or -1 if `instance_id` is not * valid. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorNonPortableTypeForID :: (instance_id: SDL_SensorID) -> s32 #foreign libsdl3; /** * Open a sensor for use. * * \param instance_id the sensor instance ID. * \returns an SDL_Sensor object or NULL on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. */ SDL_OpenSensor :: (instance_id: SDL_SensorID) -> *SDL_Sensor #foreign libsdl3; /** * Return the SDL_Sensor associated with an instance ID. * * \param instance_id the sensor instance ID. * \returns an SDL_Sensor object or NULL on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorFromID :: (instance_id: SDL_SensorID) -> *SDL_Sensor #foreign libsdl3; /** * Get the properties associated with a sensor. * * \param sensor the SDL_Sensor object. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorProperties :: (sensor: *SDL_Sensor) -> SDL_PropertiesID #foreign libsdl3; /** * Get the implementation dependent name of a sensor. * * \param sensor the SDL_Sensor object. * \returns the sensor name or NULL on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorName :: (sensor: *SDL_Sensor) -> *u8 #foreign libsdl3; /** * Get the type of a sensor. * * \param sensor the SDL_Sensor object to inspect. * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is * NULL. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorType :: (sensor: *SDL_Sensor) -> SDL_SensorType #foreign libsdl3; /** * Get the platform dependent type of a sensor. * * \param sensor the SDL_Sensor object to inspect. * \returns the sensor platform dependent type, or -1 if `sensor` is NULL. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorNonPortableType :: (sensor: *SDL_Sensor) -> s32 #foreign libsdl3; /** * Get the instance ID of a sensor. * * \param sensor the SDL_Sensor object to inspect. * \returns the sensor instance ID, or 0 on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorID :: (sensor: *SDL_Sensor) -> SDL_SensorID #foreign libsdl3; /** * Get the current state of an opened sensor. * * The number of values and interpretation of the data is sensor dependent. * * \param sensor the SDL_Sensor object to query. * \param data a pointer filled with the current sensor state. * \param num_values the number of values to write to data. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_GetSensorData :: (sensor: *SDL_Sensor, data: *float, num_values: s32) -> bool #foreign libsdl3; /** * Close a sensor previously opened with SDL_OpenSensor(). * * \param sensor the SDL_Sensor object to close. * * \since This function is available since SDL 3.2.0. */ SDL_CloseSensor :: (sensor: *SDL_Sensor) -> void #foreign libsdl3; /** * Update the current state of the open sensors. * * This is called automatically by the event loop if sensor events are * enabled. * * This needs to be called from the thread that initialized the sensor * subsystem. * * \since This function is available since SDL 3.2.0. */ SDL_UpdateSensors :: () -> void #foreign libsdl3; SDL_Joystick :: struct {} /** * This is a unique ID for a joystick for the time it is connected to the * system, and is never reused for the lifetime of the application. * * If the joystick is disconnected and reconnected, it will get a new ID. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_JoystickID :: Uint32; /** * An enum of some common joystick types. * * In some cases, SDL can identify a low-level joystick as being a certain * type of device, and will report it through SDL_GetJoystickType (or * SDL_GetJoystickTypeForID). * * This is by no means a complete list of everything that can be plugged into * a computer. * * \since This enum is available since SDL 3.2.0. */ using SDL_JoystickType :: enum u32 { SDL_JOYSTICK_TYPE_UNKNOWN :: 0; SDL_JOYSTICK_TYPE_GAMEPAD :: 1; SDL_JOYSTICK_TYPE_WHEEL :: 2; SDL_JOYSTICK_TYPE_ARCADE_STICK :: 3; SDL_JOYSTICK_TYPE_FLIGHT_STICK :: 4; SDL_JOYSTICK_TYPE_DANCE_PAD :: 5; SDL_JOYSTICK_TYPE_GUITAR :: 6; SDL_JOYSTICK_TYPE_DRUM_KIT :: 7; SDL_JOYSTICK_TYPE_ARCADE_PAD :: 8; SDL_JOYSTICK_TYPE_THROTTLE :: 9; SDL_JOYSTICK_TYPE_COUNT :: 10; } /** * Possible connection states for a joystick device. * * This is used by SDL_GetJoystickConnectionState to report how a device is * connected to the system. * * \since This enum is available since SDL 3.2.0. */ using SDL_JoystickConnectionState :: enum s32 { SDL_JOYSTICK_CONNECTION_INVALID :: -1; SDL_JOYSTICK_CONNECTION_UNKNOWN :: 0; SDL_JOYSTICK_CONNECTION_WIRED :: 1; SDL_JOYSTICK_CONNECTION_WIRELESS :: 2; } /** * Locking for atomic access to the joystick API. * * The SDL joystick functions are thread-safe, however you can lock the * joysticks while processing to guarantee that the joystick list won't change * and joystick and gamepad events will not be delivered. * * \since This function is available since SDL 3.2.0. */ SDL_LockJoysticks :: () -> void #foreign libsdl3; /** * Unlocking for atomic access to the joystick API. * * \since This function is available since SDL 3.2.0. */ SDL_UnlockJoysticks :: () -> void #foreign libsdl3; /** * Return whether a joystick is currently connected. * * \returns true if a joystick is connected, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoysticks */ SDL_HasJoystick :: () -> bool #foreign libsdl3; /** * Get a list of currently connected joysticks. * * \param count a pointer filled in with the number of joysticks returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasJoystick * \sa SDL_OpenJoystick */ SDL_GetJoysticks :: (count: *s32) -> *SDL_JoystickID #foreign libsdl3; /** * Get the implementation dependent name of a joystick. * * This can be called before any joysticks are opened. * * \param instance_id the joystick instance ID. * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickName * \sa SDL_GetJoysticks */ SDL_GetJoystickNameForID :: (instance_id: SDL_JoystickID) -> *u8 #foreign libsdl3; /** * Get the implementation dependent path of a joystick. * * This can be called before any joysticks are opened. * * \param instance_id the joystick instance ID. * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPath * \sa SDL_GetJoysticks */ SDL_GetJoystickPathForID :: (instance_id: SDL_JoystickID) -> *u8 #foreign libsdl3; /** * Get the player index of a joystick. * * This can be called before any joysticks are opened. * * \param instance_id the joystick instance ID. * \returns the player index of a joystick, or -1 if it's not available. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPlayerIndex * \sa SDL_GetJoysticks */ SDL_GetJoystickPlayerIndexForID :: (instance_id: SDL_JoystickID) -> s32 #foreign libsdl3; /** * Get the implementation-dependent GUID of a joystick. * * This can be called before any joysticks are opened. * * \param instance_id the joystick instance ID. * \returns the GUID of the selected joystick. If called with an invalid * instance_id, this function returns a zero GUID. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickGUID * \sa SDL_GUIDToString */ SDL_GetJoystickGUIDForID :: (instance_id: SDL_JoystickID) -> SDL_GUID #foreign libsdl3; /** * Get the USB vendor ID of a joystick, if available. * * This can be called before any joysticks are opened. If the vendor ID isn't * available this function returns 0. * * \param instance_id the joystick instance ID. * \returns the USB vendor ID of the selected joystick. If called with an * invalid instance_id, this function returns 0. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickVendor * \sa SDL_GetJoysticks */ SDL_GetJoystickVendorForID :: (instance_id: SDL_JoystickID) -> Uint16 #foreign libsdl3; /** * Get the USB product ID of a joystick, if available. * * This can be called before any joysticks are opened. If the product ID isn't * available this function returns 0. * * \param instance_id the joystick instance ID. * \returns the USB product ID of the selected joystick. If called with an * invalid instance_id, this function returns 0. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickProduct * \sa SDL_GetJoysticks */ SDL_GetJoystickProductForID :: (instance_id: SDL_JoystickID) -> Uint16 #foreign libsdl3; /** * Get the product version of a joystick, if available. * * This can be called before any joysticks are opened. If the product version * isn't available this function returns 0. * * \param instance_id the joystick instance ID. * \returns the product version of the selected joystick. If called with an * invalid instance_id, this function returns 0. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickProductVersion * \sa SDL_GetJoysticks */ SDL_GetJoystickProductVersionForID :: (instance_id: SDL_JoystickID) -> Uint16 #foreign libsdl3; /** * Get the type of a joystick, if available. * * This can be called before any joysticks are opened. * * \param instance_id the joystick instance ID. * \returns the SDL_JoystickType of the selected joystick. If called with an * invalid instance_id, this function returns * `SDL_JOYSTICK_TYPE_UNKNOWN`. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickType * \sa SDL_GetJoysticks */ SDL_GetJoystickTypeForID :: (instance_id: SDL_JoystickID) -> SDL_JoystickType #foreign libsdl3; /** * Open a joystick for use. * * The joystick subsystem must be initialized before a joystick can be opened * for use. * * \param instance_id the joystick instance ID. * \returns a joystick identifier or NULL on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseJoystick */ SDL_OpenJoystick :: (instance_id: SDL_JoystickID) -> *SDL_Joystick #foreign libsdl3; /** * Get the SDL_Joystick associated with an instance ID, if it has been opened. * * \param instance_id the instance ID to get the SDL_Joystick for. * \returns an SDL_Joystick on success or NULL on failure or if it hasn't been * opened yet; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetJoystickFromID :: (instance_id: SDL_JoystickID) -> *SDL_Joystick #foreign libsdl3; /** * Get the SDL_Joystick associated with a player index. * * \param player_index the player index to get the SDL_Joystick for. * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPlayerIndex * \sa SDL_SetJoystickPlayerIndex */ SDL_GetJoystickFromPlayerIndex :: (player_index: s32) -> *SDL_Joystick #foreign libsdl3; /** * The structure that describes a virtual joystick touchpad. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_VirtualJoystickDesc */ SDL_VirtualJoystickTouchpadDesc :: struct { nfingers: Uint16; /**< the number of simultaneous fingers on this touchpad */ padding: [3] Uint16; } /** * The structure that describes a virtual joystick sensor. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_VirtualJoystickDesc */ SDL_VirtualJoystickSensorDesc :: struct { type: SDL_SensorType; /**< the type of this sensor */ rate: float; /**< the update frequency of this sensor, may be 0.0f */ } /** * The structure that describes a virtual joystick. * * This structure should be initialized using SDL_INIT_INTERFACE(). All * elements of this structure are optional. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_AttachVirtualJoystick * \sa SDL_INIT_INTERFACE * \sa SDL_VirtualJoystickSensorDesc * \sa SDL_VirtualJoystickTouchpadDesc */ SDL_VirtualJoystickDesc :: struct { version: Uint32; /**< the version of this interface */ type: Uint16; /**< `SDL_JoystickType` */ padding: Uint16; /**< unused */ vendor_id: Uint16; /**< the USB vendor ID of this joystick */ product_id: Uint16; /**< the USB product ID of this joystick */ naxes: Uint16; /**< the number of axes on this joystick */ nbuttons: Uint16; /**< the number of buttons on this joystick */ nballs: Uint16; /**< the number of balls on this joystick */ nhats: Uint16; /**< the number of hats on this joystick */ ntouchpads: Uint16; /**< the number of touchpads on this joystick, requires `touchpads` to point at valid descriptions */ nsensors: Uint16; /**< the number of sensors on this joystick, requires `sensors` to point at valid descriptions */ padding2: [2] Uint16; /**< unused */ /**< A mask of which buttons are valid for this controller e.g. (1 << SDL_GAMEPAD_BUTTON_SOUTH) */ button_mask: Uint32; /**< A mask of which axes are valid for this controller e.g. (1 << SDL_GAMEPAD_AXIS_LEFTX) */ axis_mask: Uint32; name: *u8; /**< the name of the joystick */ touchpads: *SDL_VirtualJoystickTouchpadDesc; /**< A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0 */ sensors: *SDL_VirtualJoystickSensorDesc; /**< A pointer to an array of sensor descriptions, required if `nsensors` is > 0 */ userdata: *void; /**< User data pointer passed to callbacks */ Update: #type (userdata: *void) -> void #c_call; /**< Called when the joystick state should be updated */ SetPlayerIndex: #type (userdata: *void, player_index: s32) -> void #c_call; /**< Called when the player index is set */ Rumble: #type (userdata: *void, low_frequency_rumble: Uint16, high_frequency_rumble: Uint16) -> bool #c_call; /**< Implements SDL_RumbleJoystick() */ RumbleTriggers: #type (userdata: *void, left_rumble: Uint16, right_rumble: Uint16) -> bool #c_call; /**< Implements SDL_RumbleJoystickTriggers() */ SetLED: #type (userdata: *void, red: Uint8, green: Uint8, blue: Uint8) -> bool #c_call; /**< Implements SDL_SetJoystickLED() */ SendEffect: #type (userdata: *void, data: *void, size: s32) -> bool #c_call; /**< Implements SDL_SendJoystickEffect() */ SetSensorsEnabled: #type (userdata: *void, enabled: bool) -> bool #c_call; /**< Implements SDL_SetGamepadSensorEnabled() */ Cleanup: #type (userdata: *void) -> void #c_call; /**< Cleans up the userdata when the joystick is detached */ } /** * Attach a new virtual joystick. * * \param desc joystick description, initialized using SDL_INIT_INTERFACE(). * \returns the joystick instance ID, or 0 on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DetachVirtualJoystick */ SDL_AttachVirtualJoystick :: (desc: *SDL_VirtualJoystickDesc) -> SDL_JoystickID #foreign libsdl3; /** * Detach a virtual joystick. * * \param instance_id the joystick instance ID, previously returned from * SDL_AttachVirtualJoystick(). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AttachVirtualJoystick */ SDL_DetachVirtualJoystick :: (instance_id: SDL_JoystickID) -> bool #foreign libsdl3; /** * Query whether or not a joystick is virtual. * * \param instance_id the joystick instance ID. * \returns true if the joystick is virtual, false otherwise. * * \since This function is available since SDL 3.2.0. */ SDL_IsJoystickVirtual :: (instance_id: SDL_JoystickID) -> bool #foreign libsdl3; /** * Set the state of an axis on an opened virtual joystick. * * Please note that values set here will not be applied until the next call to * SDL_UpdateJoysticks, which can either be called directly, or can be called * indirectly through various other SDL APIs, including, but not limited to * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, * SDL_WaitEvent. * * Note that when sending trigger axes, you should scale the value to the full * range of Sint16. For example, a trigger at rest would have the value of * `SDL_JOYSTICK_AXIS_MIN`. * * \param joystick the virtual joystick on which to set state. * \param axis the index of the axis on the virtual joystick to update. * \param value the new value for the specified axis. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetJoystickVirtualAxis :: (joystick: *SDL_Joystick, axis: s32, value: Sint16) -> bool #foreign libsdl3; /** * Generate ball motion on an opened virtual joystick. * * Please note that values set here will not be applied until the next call to * SDL_UpdateJoysticks, which can either be called directly, or can be called * indirectly through various other SDL APIs, including, but not limited to * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, * SDL_WaitEvent. * * \param joystick the virtual joystick on which to set state. * \param ball the index of the ball on the virtual joystick to update. * \param xrel the relative motion on the X axis. * \param yrel the relative motion on the Y axis. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetJoystickVirtualBall :: (joystick: *SDL_Joystick, ball: s32, xrel: Sint16, yrel: Sint16) -> bool #foreign libsdl3; /** * Set the state of a button on an opened virtual joystick. * * Please note that values set here will not be applied until the next call to * SDL_UpdateJoysticks, which can either be called directly, or can be called * indirectly through various other SDL APIs, including, but not limited to * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, * SDL_WaitEvent. * * \param joystick the virtual joystick on which to set state. * \param button the index of the button on the virtual joystick to update. * \param down true if the button is pressed, false otherwise. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetJoystickVirtualButton :: (joystick: *SDL_Joystick, button: s32, down: bool) -> bool #foreign libsdl3; /** * Set the state of a hat on an opened virtual joystick. * * Please note that values set here will not be applied until the next call to * SDL_UpdateJoysticks, which can either be called directly, or can be called * indirectly through various other SDL APIs, including, but not limited to * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, * SDL_WaitEvent. * * \param joystick the virtual joystick on which to set state. * \param hat the index of the hat on the virtual joystick to update. * \param value the new value for the specified hat. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetJoystickVirtualHat :: (joystick: *SDL_Joystick, hat: s32, value: Uint8) -> bool #foreign libsdl3; /** * Set touchpad finger state on an opened virtual joystick. * * Please note that values set here will not be applied until the next call to * SDL_UpdateJoysticks, which can either be called directly, or can be called * indirectly through various other SDL APIs, including, but not limited to * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, * SDL_WaitEvent. * * \param joystick the virtual joystick on which to set state. * \param touchpad the index of the touchpad on the virtual joystick to * update. * \param finger the index of the finger on the touchpad to set. * \param down true if the finger is pressed, false if the finger is released. * \param x the x coordinate of the finger on the touchpad, normalized 0 to 1, * with the origin in the upper left. * \param y the y coordinate of the finger on the touchpad, normalized 0 to 1, * with the origin in the upper left. * \param pressure the pressure of the finger. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetJoystickVirtualTouchpad :: (joystick: *SDL_Joystick, touchpad: s32, finger: s32, down: bool, x: float, y: float, pressure: float) -> bool #foreign libsdl3; /** * Send a sensor update for an opened virtual joystick. * * Please note that values set here will not be applied until the next call to * SDL_UpdateJoysticks, which can either be called directly, or can be called * indirectly through various other SDL APIs, including, but not limited to * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, * SDL_WaitEvent. * * \param joystick the virtual joystick on which to set state. * \param type the type of the sensor on the virtual joystick to update. * \param sensor_timestamp a 64-bit timestamp in nanoseconds associated with * the sensor reading. * \param data the data associated with the sensor reading. * \param num_values the number of values pointed to by `data`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SendJoystickVirtualSensorData :: (joystick: *SDL_Joystick, type: SDL_SensorType, sensor_timestamp: Uint64, data: *float, num_values: s32) -> bool #foreign libsdl3; /** * Get the properties associated with a joystick. * * The following read-only properties are provided by SDL: * * - `SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN`: true if this joystick has an * LED that has adjustable brightness * - `SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN`: true if this joystick has an LED * that has adjustable color * - `SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN`: true if this joystick has a * player LED * - `SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN`: true if this joystick has * left/right rumble * - `SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN`: true if this joystick has * simple trigger rumble * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetJoystickProperties :: (joystick: *SDL_Joystick) -> SDL_PropertiesID #foreign libsdl3; /** * Get the implementation dependent name of a joystick. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickNameForID */ SDL_GetJoystickName :: (joystick: *SDL_Joystick) -> *u8 #foreign libsdl3; /** * Get the implementation dependent path of a joystick. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPathForID */ SDL_GetJoystickPath :: (joystick: *SDL_Joystick) -> *u8 #foreign libsdl3; /** * Get the player index of an opened joystick. * * For XInput controllers this returns the XInput user index. Many joysticks * will not be able to supply this information. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the player index, or -1 if it's not available. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetJoystickPlayerIndex */ SDL_GetJoystickPlayerIndex :: (joystick: *SDL_Joystick) -> s32 #foreign libsdl3; /** * Set the player index of an opened joystick. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \param player_index player index to assign to this joystick, or -1 to clear * the player index and turn off player LEDs. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickPlayerIndex */ SDL_SetJoystickPlayerIndex :: (joystick: *SDL_Joystick, player_index: s32) -> bool #foreign libsdl3; /** * Get the implementation-dependent GUID for the joystick. * * This function requires an open joystick. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the GUID of the given joystick. If called on an invalid index, * this function returns a zero GUID; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickGUIDForID * \sa SDL_GUIDToString */ SDL_GetJoystickGUID :: (joystick: *SDL_Joystick) -> SDL_GUID #foreign libsdl3; /** * Get the USB vendor ID of an opened joystick, if available. * * If the vendor ID isn't available this function returns 0. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the USB vendor ID of the selected joystick, or 0 if unavailable. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickVendorForID */ SDL_GetJoystickVendor :: (joystick: *SDL_Joystick) -> Uint16 #foreign libsdl3; /** * Get the USB product ID of an opened joystick, if available. * * If the product ID isn't available this function returns 0. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the USB product ID of the selected joystick, or 0 if unavailable. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickProductForID */ SDL_GetJoystickProduct :: (joystick: *SDL_Joystick) -> Uint16 #foreign libsdl3; /** * Get the product version of an opened joystick, if available. * * If the product version isn't available this function returns 0. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the product version of the selected joystick, or 0 if unavailable. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickProductVersionForID */ SDL_GetJoystickProductVersion :: (joystick: *SDL_Joystick) -> Uint16 #foreign libsdl3; /** * Get the firmware version of an opened joystick, if available. * * If the firmware version isn't available this function returns 0. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the firmware version of the selected joystick, or 0 if * unavailable. * * \since This function is available since SDL 3.2.0. */ SDL_GetJoystickFirmwareVersion :: (joystick: *SDL_Joystick) -> Uint16 #foreign libsdl3; /** * Get the serial number of an opened joystick, if available. * * Returns the serial number of the joystick, or NULL if it is not available. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the serial number of the selected joystick, or NULL if * unavailable. * * \since This function is available since SDL 3.2.0. */ SDL_GetJoystickSerial :: (joystick: *SDL_Joystick) -> *u8 #foreign libsdl3; /** * Get the type of an opened joystick. * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the SDL_JoystickType of the selected joystick. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickTypeForID */ SDL_GetJoystickType :: (joystick: *SDL_Joystick) -> SDL_JoystickType #foreign libsdl3; /** * Get the device information encoded in a SDL_GUID structure. * * \param guid the SDL_GUID you wish to get info about. * \param vendor a pointer filled in with the device VID, or 0 if not * available. * \param product a pointer filled in with the device PID, or 0 if not * available. * \param version a pointer filled in with the device version, or 0 if not * available. * \param crc16 a pointer filled in with a CRC used to distinguish different * products with the same VID/PID, or 0 if not available. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickGUIDForID */ SDL_GetJoystickGUIDInfo :: (guid: SDL_GUID, vendor: *Uint16, product: *Uint16, version: *Uint16, crc16: *Uint16) -> void #foreign libsdl3; /** * Get the status of a specified joystick. * * \param joystick the joystick to query. * \returns true if the joystick has been opened, false if it has not; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_JoystickConnected :: (joystick: *SDL_Joystick) -> bool #foreign libsdl3; /** * Get the instance ID of an opened joystick. * * \param joystick an SDL_Joystick structure containing joystick information. * \returns the instance ID of the specified joystick on success or 0 on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetJoystickID :: (joystick: *SDL_Joystick) -> SDL_JoystickID #foreign libsdl3; /** * Get the number of general axis controls on a joystick. * * Often, the directional pad on a game controller will either look like 4 * separate buttons or a POV hat, and not axes, but all of this is up to the * device and platform. * * \param joystick an SDL_Joystick structure containing joystick information. * \returns the number of axis controls/number of axes on success or -1 on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickAxis * \sa SDL_GetNumJoystickBalls * \sa SDL_GetNumJoystickButtons * \sa SDL_GetNumJoystickHats */ SDL_GetNumJoystickAxes :: (joystick: *SDL_Joystick) -> s32 #foreign libsdl3; /** * Get the number of trackballs on a joystick. * * Joystick trackballs have only relative motion events associated with them * and their state cannot be polled. * * Most joysticks do not have trackballs. * * \param joystick an SDL_Joystick structure containing joystick information. * \returns the number of trackballs on success or -1 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickBall * \sa SDL_GetNumJoystickAxes * \sa SDL_GetNumJoystickButtons * \sa SDL_GetNumJoystickHats */ SDL_GetNumJoystickBalls :: (joystick: *SDL_Joystick) -> s32 #foreign libsdl3; /** * Get the number of POV hats on a joystick. * * \param joystick an SDL_Joystick structure containing joystick information. * \returns the number of POV hats on success or -1 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickHat * \sa SDL_GetNumJoystickAxes * \sa SDL_GetNumJoystickBalls * \sa SDL_GetNumJoystickButtons */ SDL_GetNumJoystickHats :: (joystick: *SDL_Joystick) -> s32 #foreign libsdl3; /** * Get the number of buttons on a joystick. * * \param joystick an SDL_Joystick structure containing joystick information. * \returns the number of buttons on success or -1 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickButton * \sa SDL_GetNumJoystickAxes * \sa SDL_GetNumJoystickBalls * \sa SDL_GetNumJoystickHats */ SDL_GetNumJoystickButtons :: (joystick: *SDL_Joystick) -> s32 #foreign libsdl3; /** * Set the state of joystick event processing. * * If joystick events are disabled, you must call SDL_UpdateJoysticks() * yourself and check the state of the joystick when you want joystick * information. * * \param enabled whether to process joystick events or not. * * \since This function is available since SDL 3.2.0. * * \sa SDL_JoystickEventsEnabled * \sa SDL_UpdateJoysticks */ SDL_SetJoystickEventsEnabled :: (enabled: bool) -> void #foreign libsdl3; /** * Query the state of joystick event processing. * * If joystick events are disabled, you must call SDL_UpdateJoysticks() * yourself and check the state of the joystick when you want joystick * information. * * \returns true if joystick events are being processed, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetJoystickEventsEnabled */ SDL_JoystickEventsEnabled :: () -> bool #foreign libsdl3; /** * Update the current state of the open joysticks. * * This is called automatically by the event loop if any joystick events are * enabled. * * \since This function is available since SDL 3.2.0. */ SDL_UpdateJoysticks :: () -> void #foreign libsdl3; /** * Get the current state of an axis control on a joystick. * * SDL makes no promises about what part of the joystick any given axis refers * to. Your game should have some sort of configuration UI to let users * specify what each axis should be bound to. Alternately, SDL's higher-level * Game Controller API makes a great effort to apply order to this lower-level * interface, so you know that a specific axis is the "left thumb stick," etc. * * The value returned by SDL_GetJoystickAxis() is a signed integer (-32768 to * 32767) representing the current position of the axis. It may be necessary * to impose certain tolerances on these values to account for jitter. * * \param joystick an SDL_Joystick structure containing joystick information. * \param axis the axis to query; the axis indices start at index 0. * \returns a 16-bit signed integer representing the current position of the * axis or 0 on failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumJoystickAxes */ SDL_GetJoystickAxis :: (joystick: *SDL_Joystick, axis: s32) -> Sint16 #foreign libsdl3; /** * Get the initial state of an axis control on a joystick. * * The state is a value ranging from -32768 to 32767. * * The axis indices start at index 0. * * \param joystick an SDL_Joystick structure containing joystick information. * \param axis the axis to query; the axis indices start at index 0. * \param state upon return, the initial value is supplied here. * \returns true if this axis has any initial value, or false if not. * * \since This function is available since SDL 3.2.0. */ SDL_GetJoystickAxisInitialState :: (joystick: *SDL_Joystick, axis: s32, state: *Sint16) -> bool #foreign libsdl3; /** * Get the ball axis change since the last poll. * * Trackballs can only return relative motion since the last call to * SDL_GetJoystickBall(), these motion deltas are placed into `dx` and `dy`. * * Most joysticks do not have trackballs. * * \param joystick the SDL_Joystick to query. * \param ball the ball index to query; ball indices start at index 0. * \param dx stores the difference in the x axis position since the last poll. * \param dy stores the difference in the y axis position since the last poll. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumJoystickBalls */ SDL_GetJoystickBall :: (joystick: *SDL_Joystick, ball: s32, dx: *s32, dy: *s32) -> bool #foreign libsdl3; /** * Get the current state of a POV hat on a joystick. * * The returned value will be one of the `SDL_HAT_*` values. * * \param joystick an SDL_Joystick structure containing joystick information. * \param hat the hat index to get the state from; indices start at index 0. * \returns the current hat position. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumJoystickHats */ SDL_GetJoystickHat :: (joystick: *SDL_Joystick, hat: s32) -> Uint8 #foreign libsdl3; /** * Get the current state of a button on a joystick. * * \param joystick an SDL_Joystick structure containing joystick information. * \param button the button index to get the state from; indices start at * index 0. * \returns true if the button is pressed, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumJoystickButtons */ SDL_GetJoystickButton :: (joystick: *SDL_Joystick, button: s32) -> bool #foreign libsdl3; /** * Start a rumble effect. * * Each call to this function cancels any previous rumble effect, and calling * it with 0 intensity stops any rumbling. * * This function requires you to process SDL events or call * SDL_UpdateJoysticks() to update rumble state. * * \param joystick the joystick to vibrate. * \param low_frequency_rumble the intensity of the low frequency (left) * rumble motor, from 0 to 0xFFFF. * \param high_frequency_rumble the intensity of the high frequency (right) * rumble motor, from 0 to 0xFFFF. * \param duration_ms the duration of the rumble effect, in milliseconds. * \returns true, or false if rumble isn't supported on this joystick. * * \since This function is available since SDL 3.2.0. */ SDL_RumbleJoystick :: (joystick: *SDL_Joystick, low_frequency_rumble: Uint16, high_frequency_rumble: Uint16, duration_ms: Uint32) -> bool #foreign libsdl3; /** * Start a rumble effect in the joystick's triggers. * * Each call to this function cancels any previous trigger rumble effect, and * calling it with 0 intensity stops any rumbling. * * Note that this is rumbling of the _triggers_ and not the game controller as * a whole. This is currently only supported on Xbox One controllers. If you * want the (more common) whole-controller rumble, use SDL_RumbleJoystick() * instead. * * This function requires you to process SDL events or call * SDL_UpdateJoysticks() to update rumble state. * * \param joystick the joystick to vibrate. * \param left_rumble the intensity of the left trigger rumble motor, from 0 * to 0xFFFF. * \param right_rumble the intensity of the right trigger rumble motor, from 0 * to 0xFFFF. * \param duration_ms the duration of the rumble effect, in milliseconds. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RumbleJoystick */ SDL_RumbleJoystickTriggers :: (joystick: *SDL_Joystick, left_rumble: Uint16, right_rumble: Uint16, duration_ms: Uint32) -> bool #foreign libsdl3; /** * Update a joystick's LED color. * * An example of a joystick LED is the light on the back of a PlayStation 4's * DualShock 4 controller. * * For joysticks with a single color LED, the maximum of the RGB values will * be used as the LED brightness. * * \param joystick the joystick to update. * \param red the intensity of the red LED. * \param green the intensity of the green LED. * \param blue the intensity of the blue LED. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetJoystickLED :: (joystick: *SDL_Joystick, red: Uint8, green: Uint8, blue: Uint8) -> bool #foreign libsdl3; /** * Send a joystick specific effect packet. * * \param joystick the joystick to affect. * \param data the data to send to the joystick. * \param size the size of the data to send to the joystick. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SendJoystickEffect :: (joystick: *SDL_Joystick, data: *void, size: s32) -> bool #foreign libsdl3; /** * Close a joystick previously opened with SDL_OpenJoystick(). * * \param joystick the joystick device to close. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenJoystick */ SDL_CloseJoystick :: (joystick: *SDL_Joystick) -> void #foreign libsdl3; /** * Get the connection state of a joystick. * * \param joystick the joystick to query. * \returns the connection state on success or * `SDL_JOYSTICK_CONNECTION_INVALID` on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetJoystickConnectionState :: (joystick: *SDL_Joystick) -> SDL_JoystickConnectionState #foreign libsdl3; /** * Get the battery state of a joystick. * * You should never take a battery status as absolute truth. Batteries * (especially failing batteries) are delicate hardware, and the values * reported here are best estimates based on what that hardware reports. It's * not uncommon for older batteries to lose stored power much faster than it * reports, or completely drain when reporting it has 20 percent left, etc. * * \param joystick the joystick to query. * \param percent a pointer filled in with the percentage of battery life * left, between 0 and 100, or NULL to ignore. This will be * filled in with -1 we can't determine a value or there is no * battery. * \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetJoystickPowerInfo :: (joystick: *SDL_Joystick, percent: *s32) -> SDL_PowerState #foreign libsdl3; SDL_Gamepad :: struct {} /** * Standard gamepad types. * * This type does not necessarily map to first-party controllers from * Microsoft/Sony/Nintendo; in many cases, third-party controllers can report * as these, either because they were designed for a specific console, or they * simply most closely match that console's controllers (does it have A/B/X/Y * buttons or X/O/Square/Triangle? Does it have a touchpad? etc). */ using SDL_GamepadType :: enum u32 { SDL_GAMEPAD_TYPE_UNKNOWN :: 0; SDL_GAMEPAD_TYPE_STANDARD :: 1; SDL_GAMEPAD_TYPE_XBOX360 :: 2; SDL_GAMEPAD_TYPE_XBOXONE :: 3; SDL_GAMEPAD_TYPE_PS3 :: 4; SDL_GAMEPAD_TYPE_PS4 :: 5; SDL_GAMEPAD_TYPE_PS5 :: 6; SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO :: 7; SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT :: 8; SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT :: 9; SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR :: 10; SDL_GAMEPAD_TYPE_COUNT :: 11; } /** * The list of buttons available on a gamepad * * For controllers that use a diamond pattern for the face buttons, the * south/east/west/north buttons below correspond to the locations in the * diamond pattern. For Xbox controllers, this would be A/B/X/Y, for Nintendo * Switch controllers, this would be B/A/Y/X, for PlayStation controllers this * would be Cross/Circle/Square/Triangle. * * For controllers that don't use a diamond pattern for the face buttons, the * south/east/west/north buttons indicate the buttons labeled A, B, C, D, or * 1, 2, 3, 4, or for controllers that aren't labeled, they are the primary, * secondary, etc. buttons. * * The activate action is often the south button and the cancel action is * often the east button, but in some regions this is reversed, so your game * should allow remapping actions based on user preferences. * * You can query the labels for the face buttons using * SDL_GetGamepadButtonLabel() * * \since This enum is available since SDL 3.2.0. */ using SDL_GamepadButton :: enum s32 { SDL_GAMEPAD_BUTTON_INVALID :: -1; SDL_GAMEPAD_BUTTON_SOUTH :: 0; SDL_GAMEPAD_BUTTON_EAST :: 1; SDL_GAMEPAD_BUTTON_WEST :: 2; SDL_GAMEPAD_BUTTON_NORTH :: 3; SDL_GAMEPAD_BUTTON_BACK :: 4; SDL_GAMEPAD_BUTTON_GUIDE :: 5; SDL_GAMEPAD_BUTTON_START :: 6; SDL_GAMEPAD_BUTTON_LEFT_STICK :: 7; SDL_GAMEPAD_BUTTON_RIGHT_STICK :: 8; SDL_GAMEPAD_BUTTON_LEFT_SHOULDER :: 9; SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER :: 10; SDL_GAMEPAD_BUTTON_DPAD_UP :: 11; SDL_GAMEPAD_BUTTON_DPAD_DOWN :: 12; SDL_GAMEPAD_BUTTON_DPAD_LEFT :: 13; SDL_GAMEPAD_BUTTON_DPAD_RIGHT :: 14; SDL_GAMEPAD_BUTTON_MISC1 :: 15; SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1 :: 16; SDL_GAMEPAD_BUTTON_LEFT_PADDLE1 :: 17; SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2 :: 18; SDL_GAMEPAD_BUTTON_LEFT_PADDLE2 :: 19; SDL_GAMEPAD_BUTTON_TOUCHPAD :: 20; SDL_GAMEPAD_BUTTON_MISC2 :: 21; SDL_GAMEPAD_BUTTON_MISC3 :: 22; SDL_GAMEPAD_BUTTON_MISC4 :: 23; SDL_GAMEPAD_BUTTON_MISC5 :: 24; SDL_GAMEPAD_BUTTON_MISC6 :: 25; SDL_GAMEPAD_BUTTON_COUNT :: 26; } /** * The set of gamepad button labels * * This isn't a complete set, just the face buttons to make it easy to show * button prompts. * * For a complete set, you should look at the button and gamepad type and have * a set of symbols that work well with your art style. * * \since This enum is available since SDL 3.2.0. */ using SDL_GamepadButtonLabel :: enum u32 { SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN :: 0; SDL_GAMEPAD_BUTTON_LABEL_A :: 1; SDL_GAMEPAD_BUTTON_LABEL_B :: 2; SDL_GAMEPAD_BUTTON_LABEL_X :: 3; SDL_GAMEPAD_BUTTON_LABEL_Y :: 4; SDL_GAMEPAD_BUTTON_LABEL_CROSS :: 5; SDL_GAMEPAD_BUTTON_LABEL_CIRCLE :: 6; SDL_GAMEPAD_BUTTON_LABEL_SQUARE :: 7; SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE :: 8; } /** * The list of axes available on a gamepad * * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to * SDL_JOYSTICK_AXIS_MAX, and are centered within ~8000 of zero, though * advanced UI will allow users to set or autodetect the dead zone, which * varies between gamepads. * * Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX (fully * pressed) when reported by SDL_GetGamepadAxis(). Note that this is not the * same range that will be reported by the lower-level SDL_GetJoystickAxis(). * * \since This enum is available since SDL 3.2.0. */ using SDL_GamepadAxis :: enum s32 { SDL_GAMEPAD_AXIS_INVALID :: -1; SDL_GAMEPAD_AXIS_LEFTX :: 0; SDL_GAMEPAD_AXIS_LEFTY :: 1; SDL_GAMEPAD_AXIS_RIGHTX :: 2; SDL_GAMEPAD_AXIS_RIGHTY :: 3; SDL_GAMEPAD_AXIS_LEFT_TRIGGER :: 4; SDL_GAMEPAD_AXIS_RIGHT_TRIGGER :: 5; SDL_GAMEPAD_AXIS_COUNT :: 6; } /** * Types of gamepad control bindings. * * A gamepad is a collection of bindings that map arbitrary joystick buttons, * axes and hat switches to specific positions on a generic console-style * gamepad. This enum is used as part of SDL_GamepadBinding to specify those * mappings. * * \since This enum is available since SDL 3.2.0. */ using SDL_GamepadBindingType :: enum u32 { SDL_GAMEPAD_BINDTYPE_NONE :: 0; SDL_GAMEPAD_BINDTYPE_BUTTON :: 1; SDL_GAMEPAD_BINDTYPE_AXIS :: 2; SDL_GAMEPAD_BINDTYPE_HAT :: 3; } /** * A mapping between one joystick input to a gamepad control. * * A gamepad has a collection of several bindings, to say, for example, when * joystick button number 5 is pressed, that should be treated like the * gamepad's "start" button. * * SDL has these bindings built-in for many popular controllers, and can add * more with a simple text string. Those strings are parsed into a collection * of these structs to make it easier to operate on the data. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetGamepadBindings */ SDL_GamepadBinding :: struct { input_type: SDL_GamepadBindingType; input: union { button: s32; axis: struct { axis: s32; axis_min: s32; axis_max: s32; }; hat: struct { hat: s32; hat_mask: s32; }; }; output_type: SDL_GamepadBindingType; output: union { button: SDL_GamepadButton; axis: struct { axis: SDL_GamepadAxis; axis_min: s32; axis_max: s32; }; }; } /** * Add support for gamepads that SDL is unaware of or change the binding of an * existing gamepad. * * The mapping string has the format "GUID,name,mapping", where GUID is the * string value from SDL_GUIDToString(), name is the human readable string for * the device and mappings are gamepad mappings to joystick ones. Under * Windows there is a reserved GUID of "xinput" that covers all XInput * devices. The mapping format for joystick is: * * - `bX`: a joystick button, index X * - `hX.Y`: hat X with value Y * - `aX`: axis X of the joystick * * Buttons can be used as a gamepad axes and vice versa. * * If a device with this GUID is already plugged in, SDL will generate an * SDL_EVENT_GAMEPAD_ADDED event. * * This string shows an example of a valid mapping for a gamepad: * * ```c * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7" * ``` * * \param mapping the mapping string. * \returns 1 if a new mapping is added, 0 if an existing mapping is updated, * -1 on failure; call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMappingsFromFile * \sa SDL_AddGamepadMappingsFromIO * \sa SDL_GetGamepadMapping * \sa SDL_GetGamepadMappingForGUID * \sa SDL_HINT_GAMECONTROLLERCONFIG * \sa SDL_HINT_GAMECONTROLLERCONFIG_FILE * \sa SDL_EVENT_GAMEPAD_ADDED */ SDL_AddGamepadMapping :: (mapping: *u8) -> s32 #foreign libsdl3; /** * Load a set of gamepad mappings from an SDL_IOStream. * * You can call this function several times, if needed, to load different * database files. * * If a new mapping is loaded for an already known gamepad GUID, the later * version will overwrite the one currently loaded. * * Any new mappings for already plugged in controllers will generate * SDL_EVENT_GAMEPAD_ADDED events. * * Mappings not belonging to the current platform or with no platform field * specified will be ignored (i.e. mappings for Linux will be ignored in * Windows, etc). * * This function will load the text database entirely in memory before * processing it, so take this into consideration if you are in a memory * constrained environment. * * \param src the data stream for the mappings to be added. * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even * in the case of an error. * \returns the number of mappings added or -1 on failure; call SDL_GetError() * for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMapping * \sa SDL_AddGamepadMappingsFromFile * \sa SDL_GetGamepadMapping * \sa SDL_GetGamepadMappingForGUID * \sa SDL_HINT_GAMECONTROLLERCONFIG * \sa SDL_HINT_GAMECONTROLLERCONFIG_FILE * \sa SDL_EVENT_GAMEPAD_ADDED */ SDL_AddGamepadMappingsFromIO :: (src: *SDL_IOStream, closeio: bool) -> s32 #foreign libsdl3; /** * Load a set of gamepad mappings from a file. * * You can call this function several times, if needed, to load different * database files. * * If a new mapping is loaded for an already known gamepad GUID, the later * version will overwrite the one currently loaded. * * Any new mappings for already plugged in controllers will generate * SDL_EVENT_GAMEPAD_ADDED events. * * Mappings not belonging to the current platform or with no platform field * specified will be ignored (i.e. mappings for Linux will be ignored in * Windows, etc). * * \param file the mappings file to load. * \returns the number of mappings added or -1 on failure; call SDL_GetError() * for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMapping * \sa SDL_AddGamepadMappingsFromIO * \sa SDL_GetGamepadMapping * \sa SDL_GetGamepadMappingForGUID * \sa SDL_HINT_GAMECONTROLLERCONFIG * \sa SDL_HINT_GAMECONTROLLERCONFIG_FILE * \sa SDL_EVENT_GAMEPAD_ADDED */ SDL_AddGamepadMappingsFromFile :: (file: *u8) -> s32 #foreign libsdl3; /** * Reinitialize the SDL mapping database to its initial state. * * This will generate gamepad events as needed if device mappings change. * * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_ReloadGamepadMappings :: () -> bool #foreign libsdl3; /** * Get the current gamepad mappings. * * \param count a pointer filled in with the number of mappings returned, can * be NULL. * \returns an array of the mapping strings, NULL-terminated, or NULL on * failure; call SDL_GetError() for more information. This is a * single allocation that should be freed with SDL_free() when it is * no longer needed. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadMappings :: (count: *s32) -> **u8 #foreign libsdl3; /** * Get the gamepad mapping string for a given GUID. * * \param guid a structure containing the GUID for which a mapping is desired. * \returns a mapping string or NULL on failure; call SDL_GetError() for more * information. This should be freed with SDL_free() when it is no * longer needed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoystickGUIDForID * \sa SDL_GetJoystickGUID */ SDL_GetGamepadMappingForGUID :: (guid: SDL_GUID) -> *u8 #foreign libsdl3; /** * Get the current mapping of a gamepad. * * Details about mappings are discussed with SDL_AddGamepadMapping(). * * \param gamepad the gamepad you want to get the current mapping for. * \returns a string that has the gamepad's mapping or NULL if no mapping is * available; call SDL_GetError() for more information. This should * be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMapping * \sa SDL_GetGamepadMappingForID * \sa SDL_GetGamepadMappingForGUID * \sa SDL_SetGamepadMapping */ SDL_GetGamepadMapping :: (gamepad: *SDL_Gamepad) -> *u8 #foreign libsdl3; /** * Set the current mapping of a joystick or gamepad. * * Details about mappings are discussed with SDL_AddGamepadMapping(). * * \param instance_id the joystick instance ID. * \param mapping the mapping to use for this device, or NULL to clear the * mapping. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddGamepadMapping * \sa SDL_GetGamepadMapping */ SDL_SetGamepadMapping :: (instance_id: SDL_JoystickID, mapping: *u8) -> bool #foreign libsdl3; /** * Return whether a gamepad is currently connected. * * \returns true if a gamepad is connected, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepads */ SDL_HasGamepad :: () -> bool #foreign libsdl3; /** * Get a list of currently connected gamepads. * * \param count a pointer filled in with the number of gamepads returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasGamepad * \sa SDL_OpenGamepad */ SDL_GetGamepads :: (count: *s32) -> *SDL_JoystickID #foreign libsdl3; /** * Check if the given joystick is supported by the gamepad interface. * * \param instance_id the joystick instance ID. * \returns true if the given joystick is supported by the gamepad interface, * false if it isn't or it's an invalid index. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetJoysticks * \sa SDL_OpenGamepad */ SDL_IsGamepad :: (instance_id: SDL_JoystickID) -> bool #foreign libsdl3; /** * Get the implementation dependent name of a gamepad. * * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. * \returns the name of the selected gamepad. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadName * \sa SDL_GetGamepads */ SDL_GetGamepadNameForID :: (instance_id: SDL_JoystickID) -> *u8 #foreign libsdl3; /** * Get the implementation dependent path of a gamepad. * * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. * \returns the path of the selected gamepad. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPath * \sa SDL_GetGamepads */ SDL_GetGamepadPathForID :: (instance_id: SDL_JoystickID) -> *u8 #foreign libsdl3; /** * Get the player index of a gamepad. * * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. * \returns the player index of a gamepad, or -1 if it's not available. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPlayerIndex * \sa SDL_GetGamepads */ SDL_GetGamepadPlayerIndexForID :: (instance_id: SDL_JoystickID) -> s32 #foreign libsdl3; /** * Get the implementation-dependent GUID of a gamepad. * * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. * \returns the GUID of the selected gamepad. If called on an invalid index, * this function returns a zero GUID. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GUIDToString * \sa SDL_GetGamepads */ SDL_GetGamepadGUIDForID :: (instance_id: SDL_JoystickID) -> SDL_GUID #foreign libsdl3; /** * Get the USB vendor ID of a gamepad, if available. * * This can be called before any gamepads are opened. If the vendor ID isn't * available this function returns 0. * * \param instance_id the joystick instance ID. * \returns the USB vendor ID of the selected gamepad. If called on an invalid * index, this function returns zero. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadVendor * \sa SDL_GetGamepads */ SDL_GetGamepadVendorForID :: (instance_id: SDL_JoystickID) -> Uint16 #foreign libsdl3; /** * Get the USB product ID of a gamepad, if available. * * This can be called before any gamepads are opened. If the product ID isn't * available this function returns 0. * * \param instance_id the joystick instance ID. * \returns the USB product ID of the selected gamepad. If called on an * invalid index, this function returns zero. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadProduct * \sa SDL_GetGamepads */ SDL_GetGamepadProductForID :: (instance_id: SDL_JoystickID) -> Uint16 #foreign libsdl3; /** * Get the product version of a gamepad, if available. * * This can be called before any gamepads are opened. If the product version * isn't available this function returns 0. * * \param instance_id the joystick instance ID. * \returns the product version of the selected gamepad. If called on an * invalid index, this function returns zero. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadProductVersion * \sa SDL_GetGamepads */ SDL_GetGamepadProductVersionForID :: (instance_id: SDL_JoystickID) -> Uint16 #foreign libsdl3; /** * Get the type of a gamepad. * * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. * \returns the gamepad type. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadType * \sa SDL_GetGamepads * \sa SDL_GetRealGamepadTypeForID */ SDL_GetGamepadTypeForID :: (instance_id: SDL_JoystickID) -> SDL_GamepadType #foreign libsdl3; /** * Get the type of a gamepad, ignoring any mapping override. * * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. * \returns the gamepad type. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadTypeForID * \sa SDL_GetGamepads * \sa SDL_GetRealGamepadType */ SDL_GetRealGamepadTypeForID :: (instance_id: SDL_JoystickID) -> SDL_GamepadType #foreign libsdl3; /** * Get the mapping of a gamepad. * * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. * \returns the mapping string. Returns NULL if no mapping is available. This * should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepads * \sa SDL_GetGamepadMapping */ SDL_GetGamepadMappingForID :: (instance_id: SDL_JoystickID) -> *u8 #foreign libsdl3; /** * Open a gamepad for use. * * \param instance_id the joystick instance ID. * \returns a gamepad identifier or NULL if an error occurred; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseGamepad * \sa SDL_IsGamepad */ SDL_OpenGamepad :: (instance_id: SDL_JoystickID) -> *SDL_Gamepad #foreign libsdl3; /** * Get the SDL_Gamepad associated with a joystick instance ID, if it has been * opened. * * \param instance_id the joystick instance ID of the gamepad. * \returns an SDL_Gamepad on success or NULL on failure or if it hasn't been * opened yet; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadFromID :: (instance_id: SDL_JoystickID) -> *SDL_Gamepad #foreign libsdl3; /** * Get the SDL_Gamepad associated with a player index. * * \param player_index the player index, which different from the instance ID. * \returns the SDL_Gamepad associated with a player index. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPlayerIndex * \sa SDL_SetGamepadPlayerIndex */ SDL_GetGamepadFromPlayerIndex :: (player_index: s32) -> *SDL_Gamepad #foreign libsdl3; /** * Get the properties associated with an opened gamepad. * * These properties are shared with the underlying joystick object. * * The following read-only properties are provided by SDL: * * - `SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN`: true if this gamepad has an LED * that has adjustable brightness * - `SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN`: true if this gamepad has an LED * that has adjustable color * - `SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN`: true if this gamepad has a * player LED * - `SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN`: true if this gamepad has * left/right rumble * - `SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN`: true if this gamepad has * simple trigger rumble * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadProperties :: (gamepad: *SDL_Gamepad) -> SDL_PropertiesID #foreign libsdl3; /** * Get the instance ID of an opened gamepad. * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns the instance ID of the specified gamepad on success or 0 on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadID :: (gamepad: *SDL_Gamepad) -> SDL_JoystickID #foreign libsdl3; /** * Get the implementation-dependent name for an opened gamepad. * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns the implementation dependent name for the gamepad, or NULL if * there is no name or the identifier passed is invalid. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadNameForID */ SDL_GetGamepadName :: (gamepad: *SDL_Gamepad) -> *u8 #foreign libsdl3; /** * Get the implementation-dependent path for an opened gamepad. * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns the implementation dependent path for the gamepad, or NULL if * there is no path or the identifier passed is invalid. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPathForID */ SDL_GetGamepadPath :: (gamepad: *SDL_Gamepad) -> *u8 #foreign libsdl3; /** * Get the type of an opened gamepad. * * \param gamepad the gamepad object to query. * \returns the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not * available. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadTypeForID */ SDL_GetGamepadType :: (gamepad: *SDL_Gamepad) -> SDL_GamepadType #foreign libsdl3; /** * Get the type of an opened gamepad, ignoring any mapping override. * * \param gamepad the gamepad object to query. * \returns the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not * available. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRealGamepadTypeForID */ SDL_GetRealGamepadType :: (gamepad: *SDL_Gamepad) -> SDL_GamepadType #foreign libsdl3; /** * Get the player index of an opened gamepad. * * For XInput gamepads this returns the XInput user index. * * \param gamepad the gamepad object to query. * \returns the player index for gamepad, or -1 if it's not available. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetGamepadPlayerIndex */ SDL_GetGamepadPlayerIndex :: (gamepad: *SDL_Gamepad) -> s32 #foreign libsdl3; /** * Set the player index of an opened gamepad. * * \param gamepad the gamepad object to adjust. * \param player_index player index to assign to this gamepad, or -1 to clear * the player index and turn off player LEDs. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadPlayerIndex */ SDL_SetGamepadPlayerIndex :: (gamepad: *SDL_Gamepad, player_index: s32) -> bool #foreign libsdl3; /** * Get the USB vendor ID of an opened gamepad, if available. * * If the vendor ID isn't available this function returns 0. * * \param gamepad the gamepad object to query. * \returns the USB vendor ID, or zero if unavailable. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadVendorForID */ SDL_GetGamepadVendor :: (gamepad: *SDL_Gamepad) -> Uint16 #foreign libsdl3; /** * Get the USB product ID of an opened gamepad, if available. * * If the product ID isn't available this function returns 0. * * \param gamepad the gamepad object to query. * \returns the USB product ID, or zero if unavailable. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadProductForID */ SDL_GetGamepadProduct :: (gamepad: *SDL_Gamepad) -> Uint16 #foreign libsdl3; /** * Get the product version of an opened gamepad, if available. * * If the product version isn't available this function returns 0. * * \param gamepad the gamepad object to query. * \returns the USB product version, or zero if unavailable. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadProductVersionForID */ SDL_GetGamepadProductVersion :: (gamepad: *SDL_Gamepad) -> Uint16 #foreign libsdl3; /** * Get the firmware version of an opened gamepad, if available. * * If the firmware version isn't available this function returns 0. * * \param gamepad the gamepad object to query. * \returns the gamepad firmware version, or zero if unavailable. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadFirmwareVersion :: (gamepad: *SDL_Gamepad) -> Uint16 #foreign libsdl3; /** * Get the serial number of an opened gamepad, if available. * * Returns the serial number of the gamepad, or NULL if it is not available. * * \param gamepad the gamepad object to query. * \returns the serial number, or NULL if unavailable. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadSerial :: (gamepad: *SDL_Gamepad) -> *u8 #foreign libsdl3; /** * Get the Steam Input handle of an opened gamepad, if available. * * Returns an InputHandle_t for the gamepad that can be used with Steam Input * API: https://partner.steamgames.com/doc/api/ISteamInput * * \param gamepad the gamepad object to query. * \returns the gamepad handle, or 0 if unavailable. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadSteamHandle :: (gamepad: *SDL_Gamepad) -> Uint64 #foreign libsdl3; /** * Get the connection state of a gamepad. * * \param gamepad the gamepad object to query. * \returns the connection state on success or * `SDL_JOYSTICK_CONNECTION_INVALID` on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadConnectionState :: (gamepad: *SDL_Gamepad) -> SDL_JoystickConnectionState #foreign libsdl3; /** * Get the battery state of a gamepad. * * You should never take a battery status as absolute truth. Batteries * (especially failing batteries) are delicate hardware, and the values * reported here are best estimates based on what that hardware reports. It's * not uncommon for older batteries to lose stored power much faster than it * reports, or completely drain when reporting it has 20 percent left, etc. * * \param gamepad the gamepad object to query. * \param percent a pointer filled in with the percentage of battery life * left, between 0 and 100, or NULL to ignore. This will be * filled in with -1 we can't determine a value or there is no * battery. * \returns the current battery state. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadPowerInfo :: (gamepad: *SDL_Gamepad, percent: *s32) -> SDL_PowerState #foreign libsdl3; /** * Check if a gamepad has been opened and is currently connected. * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns true if the gamepad has been opened and is currently connected, or * false if not. * * \since This function is available since SDL 3.2.0. */ SDL_GamepadConnected :: (gamepad: *SDL_Gamepad) -> bool #foreign libsdl3; /** * Get the underlying joystick from a gamepad. * * This function will give you a SDL_Joystick object, which allows you to use * the SDL_Joystick functions with a SDL_Gamepad object. This would be useful * for getting a joystick's position at any given time, even if it hasn't * moved (moving it would produce an event, which would have the axis' value). * * The pointer returned is owned by the SDL_Gamepad. You should not call * SDL_CloseJoystick() on it, for example, since doing so will likely cause * SDL to crash. * * \param gamepad the gamepad object that you want to get a joystick from. * \returns an SDL_Joystick object, or NULL on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadJoystick :: (gamepad: *SDL_Gamepad) -> *SDL_Joystick #foreign libsdl3; /** * Set the state of gamepad event processing. * * If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself * and check the state of the gamepad when you want gamepad information. * * \param enabled whether to process gamepad events or not. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadEventsEnabled * \sa SDL_UpdateGamepads */ SDL_SetGamepadEventsEnabled :: (enabled: bool) -> void #foreign libsdl3; /** * Query the state of gamepad event processing. * * If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself * and check the state of the gamepad when you want gamepad information. * * \returns true if gamepad events are being processed, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetGamepadEventsEnabled */ SDL_GamepadEventsEnabled :: () -> bool #foreign libsdl3; /** * Get the SDL joystick layer bindings for a gamepad. * * \param gamepad a gamepad. * \param count a pointer filled in with the number of bindings returned. * \returns a NULL terminated array of pointers to bindings or NULL on * failure; call SDL_GetError() for more information. This is a * single allocation that should be freed with SDL_free() when it is * no longer needed. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadBindings :: (gamepad: *SDL_Gamepad, count: *s32) -> **SDL_GamepadBinding #foreign libsdl3; /** * Manually pump gamepad updates if not using the loop. * * This function is called automatically by the event loop if events are * enabled. Under such circumstances, it will not be necessary to call this * function. * * \since This function is available since SDL 3.2.0. */ SDL_UpdateGamepads :: () -> void #foreign libsdl3; /** * Convert a string into SDL_GamepadType enum. * * This function is called internally to translate SDL_Gamepad mapping strings * for the underlying joystick device into the consistent SDL_Gamepad mapping. * You do not normally need to call this function unless you are parsing * SDL_Gamepad mappings in your own code. * * \param str string representing a SDL_GamepadType type. * \returns the SDL_GamepadType enum corresponding to the input string, or * `SDL_GAMEPAD_TYPE_UNKNOWN` if no match was found. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadStringForType */ SDL_GetGamepadTypeFromString :: (str: *u8) -> SDL_GamepadType #foreign libsdl3; /** * Convert from an SDL_GamepadType enum to a string. * * \param type an enum value for a given SDL_GamepadType. * \returns a string for the given type, or NULL if an invalid type is * specified. The string returned is of the format used by * SDL_Gamepad mapping strings. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadTypeFromString */ SDL_GetGamepadStringForType :: (type: SDL_GamepadType) -> *u8 #foreign libsdl3; /** * Convert a string into SDL_GamepadAxis enum. * * This function is called internally to translate SDL_Gamepad mapping strings * for the underlying joystick device into the consistent SDL_Gamepad mapping. * You do not normally need to call this function unless you are parsing * SDL_Gamepad mappings in your own code. * * Note specially that "righttrigger" and "lefttrigger" map to * `SDL_GAMEPAD_AXIS_RIGHT_TRIGGER` and `SDL_GAMEPAD_AXIS_LEFT_TRIGGER`, * respectively. * * \param str string representing a SDL_Gamepad axis. * \returns the SDL_GamepadAxis enum corresponding to the input string, or * `SDL_GAMEPAD_AXIS_INVALID` if no match was found. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadStringForAxis */ SDL_GetGamepadAxisFromString :: (str: *u8) -> SDL_GamepadAxis #foreign libsdl3; /** * Convert from an SDL_GamepadAxis enum to a string. * * \param axis an enum value for a given SDL_GamepadAxis. * \returns a string for the given axis, or NULL if an invalid axis is * specified. The string returned is of the format used by * SDL_Gamepad mapping strings. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadAxisFromString */ SDL_GetGamepadStringForAxis :: (axis: SDL_GamepadAxis) -> *u8 #foreign libsdl3; /** * Query whether a gamepad has a given axis. * * This merely reports whether the gamepad's mapping defined this axis, as * that is all the information SDL has about the physical device. * * \param gamepad a gamepad. * \param axis an axis enum value (an SDL_GamepadAxis value). * \returns true if the gamepad has this axis, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasButton * \sa SDL_GetGamepadAxis */ SDL_GamepadHasAxis :: (gamepad: *SDL_Gamepad, axis: SDL_GamepadAxis) -> bool #foreign libsdl3; /** * Get the current state of an axis control on a gamepad. * * The axis indices start at index 0. * * For thumbsticks, the state is a value ranging from -32768 (up/left) to * 32767 (down/right). * * Triggers range from 0 when released to 32767 when fully pressed, and never * return a negative value. Note that this differs from the value reported by * the lower-level SDL_GetJoystickAxis(), which normally uses the full range. * * \param gamepad a gamepad. * \param axis an axis index (one of the SDL_GamepadAxis values). * \returns axis state (including 0) on success or 0 (also) on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasAxis * \sa SDL_GetGamepadButton */ SDL_GetGamepadAxis :: (gamepad: *SDL_Gamepad, axis: SDL_GamepadAxis) -> Sint16 #foreign libsdl3; /** * Convert a string into an SDL_GamepadButton enum. * * This function is called internally to translate SDL_Gamepad mapping strings * for the underlying joystick device into the consistent SDL_Gamepad mapping. * You do not normally need to call this function unless you are parsing * SDL_Gamepad mappings in your own code. * * \param str string representing a SDL_Gamepad axis. * \returns the SDL_GamepadButton enum corresponding to the input string, or * `SDL_GAMEPAD_BUTTON_INVALID` if no match was found. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadStringForButton */ SDL_GetGamepadButtonFromString :: (str: *u8) -> SDL_GamepadButton #foreign libsdl3; /** * Convert from an SDL_GamepadButton enum to a string. * * \param button an enum value for a given SDL_GamepadButton. * \returns a string for the given button, or NULL if an invalid button is * specified. The string returned is of the format used by * SDL_Gamepad mapping strings. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadButtonFromString */ SDL_GetGamepadStringForButton :: (button: SDL_GamepadButton) -> *u8 #foreign libsdl3; /** * Query whether a gamepad has a given button. * * This merely reports whether the gamepad's mapping defined this button, as * that is all the information SDL has about the physical device. * * \param gamepad a gamepad. * \param button a button enum value (an SDL_GamepadButton value). * \returns true if the gamepad has this button, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasAxis */ SDL_GamepadHasButton :: (gamepad: *SDL_Gamepad, button: SDL_GamepadButton) -> bool #foreign libsdl3; /** * Get the current state of a button on a gamepad. * * \param gamepad a gamepad. * \param button a button index (one of the SDL_GamepadButton values). * \returns true if the button is pressed, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasButton * \sa SDL_GetGamepadAxis */ SDL_GetGamepadButton :: (gamepad: *SDL_Gamepad, button: SDL_GamepadButton) -> bool #foreign libsdl3; /** * Get the label of a button on a gamepad. * * \param type the type of gamepad to check. * \param button a button index (one of the SDL_GamepadButton values). * \returns the SDL_GamepadButtonLabel enum corresponding to the button label. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadButtonLabel */ SDL_GetGamepadButtonLabelForType :: (type: SDL_GamepadType, button: SDL_GamepadButton) -> SDL_GamepadButtonLabel #foreign libsdl3; /** * Get the label of a button on a gamepad. * * \param gamepad a gamepad. * \param button a button index (one of the SDL_GamepadButton values). * \returns the SDL_GamepadButtonLabel enum corresponding to the button label. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadButtonLabelForType */ SDL_GetGamepadButtonLabel :: (gamepad: *SDL_Gamepad, button: SDL_GamepadButton) -> SDL_GamepadButtonLabel #foreign libsdl3; /** * Get the number of touchpads on a gamepad. * * \param gamepad a gamepad. * \returns number of touchpads. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumGamepadTouchpadFingers */ SDL_GetNumGamepadTouchpads :: (gamepad: *SDL_Gamepad) -> s32 #foreign libsdl3; /** * Get the number of supported simultaneous fingers on a touchpad on a game * gamepad. * * \param gamepad a gamepad. * \param touchpad a touchpad. * \returns number of supported simultaneous fingers. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadTouchpadFinger * \sa SDL_GetNumGamepadTouchpads */ SDL_GetNumGamepadTouchpadFingers :: (gamepad: *SDL_Gamepad, touchpad: s32) -> s32 #foreign libsdl3; /** * Get the current state of a finger on a touchpad on a gamepad. * * \param gamepad a gamepad. * \param touchpad a touchpad. * \param finger a finger. * \param down a pointer filled with true if the finger is down, false * otherwise, may be NULL. * \param x a pointer filled with the x position, normalized 0 to 1, with the * origin in the upper left, may be NULL. * \param y a pointer filled with the y position, normalized 0 to 1, with the * origin in the upper left, may be NULL. * \param pressure a pointer filled with pressure value, may be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumGamepadTouchpadFingers */ SDL_GetGamepadTouchpadFinger :: (gamepad: *SDL_Gamepad, touchpad: s32, finger: s32, down: *bool, x: *float, y: *float, pressure: *float) -> bool #foreign libsdl3; /** * Return whether a gamepad has a particular sensor. * * \param gamepad the gamepad to query. * \param type the type of sensor to query. * \returns true if the sensor exists, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadSensorData * \sa SDL_GetGamepadSensorDataRate * \sa SDL_SetGamepadSensorEnabled */ SDL_GamepadHasSensor :: (gamepad: *SDL_Gamepad, type: SDL_SensorType) -> bool #foreign libsdl3; /** * Set whether data reporting for a gamepad sensor is enabled. * * \param gamepad the gamepad to update. * \param type the type of sensor to enable/disable. * \param enabled whether data reporting should be enabled. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GamepadHasSensor * \sa SDL_GamepadSensorEnabled */ SDL_SetGamepadSensorEnabled :: (gamepad: *SDL_Gamepad, type: SDL_SensorType, enabled: bool) -> bool #foreign libsdl3; /** * Query whether sensor data reporting is enabled for a gamepad. * * \param gamepad the gamepad to query. * \param type the type of sensor to query. * \returns true if the sensor is enabled, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetGamepadSensorEnabled */ SDL_GamepadSensorEnabled :: (gamepad: *SDL_Gamepad, type: SDL_SensorType) -> bool #foreign libsdl3; /** * Get the data rate (number of events per second) of a gamepad sensor. * * \param gamepad the gamepad to query. * \param type the type of sensor to query. * \returns the data rate, or 0.0f if the data rate is not available. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadSensorDataRate :: (gamepad: *SDL_Gamepad, type: SDL_SensorType) -> float #foreign libsdl3; /** * Get the current state of a gamepad sensor. * * The number of values and interpretation of the data is sensor dependent. * See SDL_sensor.h for the details for each type of sensor. * * \param gamepad the gamepad to query. * \param type the type of sensor to query. * \param data a pointer filled with the current sensor state. * \param num_values the number of values to write to data. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_GetGamepadSensorData :: (gamepad: *SDL_Gamepad, type: SDL_SensorType, data: *float, num_values: s32) -> bool #foreign libsdl3; /** * Start a rumble effect on a gamepad. * * Each call to this function cancels any previous rumble effect, and calling * it with 0 intensity stops any rumbling. * * This function requires you to process SDL events or call * SDL_UpdateJoysticks() to update rumble state. * * \param gamepad the gamepad to vibrate. * \param low_frequency_rumble the intensity of the low frequency (left) * rumble motor, from 0 to 0xFFFF. * \param high_frequency_rumble the intensity of the high frequency (right) * rumble motor, from 0 to 0xFFFF. * \param duration_ms the duration of the rumble effect, in milliseconds. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_RumbleGamepad :: (gamepad: *SDL_Gamepad, low_frequency_rumble: Uint16, high_frequency_rumble: Uint16, duration_ms: Uint32) -> bool #foreign libsdl3; /** * Start a rumble effect in the gamepad's triggers. * * Each call to this function cancels any previous trigger rumble effect, and * calling it with 0 intensity stops any rumbling. * * Note that this is rumbling of the _triggers_ and not the gamepad as a * whole. This is currently only supported on Xbox One gamepads. If you want * the (more common) whole-gamepad rumble, use SDL_RumbleGamepad() instead. * * This function requires you to process SDL events or call * SDL_UpdateJoysticks() to update rumble state. * * \param gamepad the gamepad to vibrate. * \param left_rumble the intensity of the left trigger rumble motor, from 0 * to 0xFFFF. * \param right_rumble the intensity of the right trigger rumble motor, from 0 * to 0xFFFF. * \param duration_ms the duration of the rumble effect, in milliseconds. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RumbleGamepad */ SDL_RumbleGamepadTriggers :: (gamepad: *SDL_Gamepad, left_rumble: Uint16, right_rumble: Uint16, duration_ms: Uint32) -> bool #foreign libsdl3; /** * Update a gamepad's LED color. * * An example of a joystick LED is the light on the back of a PlayStation 4's * DualShock 4 controller. * * For gamepads with a single color LED, the maximum of the RGB values will be * used as the LED brightness. * * \param gamepad the gamepad to update. * \param red the intensity of the red LED. * \param green the intensity of the green LED. * \param blue the intensity of the blue LED. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetGamepadLED :: (gamepad: *SDL_Gamepad, red: Uint8, green: Uint8, blue: Uint8) -> bool #foreign libsdl3; /** * Send a gamepad specific effect packet. * * \param gamepad the gamepad to affect. * \param data the data to send to the gamepad. * \param size the size of the data to send to the gamepad. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SendGamepadEffect :: (gamepad: *SDL_Gamepad, data: *void, size: s32) -> bool #foreign libsdl3; /** * Close a gamepad previously opened with SDL_OpenGamepad(). * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenGamepad */ SDL_CloseGamepad :: (gamepad: *SDL_Gamepad) -> void #foreign libsdl3; /** * Return the sfSymbolsName for a given button on a gamepad on Apple * platforms. * * \param gamepad the gamepad to query. * \param button a button on the gamepad. * \returns the sfSymbolsName or NULL if the name can't be found. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadAppleSFSymbolsNameForAxis */ SDL_GetGamepadAppleSFSymbolsNameForButton :: (gamepad: *SDL_Gamepad, button: SDL_GamepadButton) -> *u8 #foreign libsdl3; /** * Return the sfSymbolsName for a given axis on a gamepad on Apple platforms. * * \param gamepad the gamepad to query. * \param axis an axis on the gamepad. * \returns the sfSymbolsName or NULL if the name can't be found. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGamepadAppleSFSymbolsNameForButton */ SDL_GetGamepadAppleSFSymbolsNameForAxis :: (gamepad: *SDL_Gamepad, axis: SDL_GamepadAxis) -> *u8 #foreign libsdl3; /** * The SDL keyboard scancode representation. * * An SDL scancode is the physical representation of a key on the keyboard, * independent of language and keyboard mapping. * * Values of this type are used to represent keyboard keys, among other places * in the `scancode` field of the SDL_KeyboardEvent structure. * * The values in this enumeration are based on the USB usage page standard: * https://usb.org/sites/default/files/hut1_5.pdf * * \since This enum is available since SDL 3.2.0. */ using SDL_Scancode :: enum u32 { SDL_SCANCODE_UNKNOWN :: 0; SDL_SCANCODE_A :: 4; SDL_SCANCODE_B :: 5; SDL_SCANCODE_C :: 6; SDL_SCANCODE_D :: 7; SDL_SCANCODE_E :: 8; SDL_SCANCODE_F :: 9; SDL_SCANCODE_G :: 10; SDL_SCANCODE_H :: 11; SDL_SCANCODE_I :: 12; SDL_SCANCODE_J :: 13; SDL_SCANCODE_K :: 14; SDL_SCANCODE_L :: 15; SDL_SCANCODE_M :: 16; SDL_SCANCODE_N :: 17; SDL_SCANCODE_O :: 18; SDL_SCANCODE_P :: 19; SDL_SCANCODE_Q :: 20; SDL_SCANCODE_R :: 21; SDL_SCANCODE_S :: 22; SDL_SCANCODE_T :: 23; SDL_SCANCODE_U :: 24; SDL_SCANCODE_V :: 25; SDL_SCANCODE_W :: 26; SDL_SCANCODE_X :: 27; SDL_SCANCODE_Y :: 28; SDL_SCANCODE_Z :: 29; SDL_SCANCODE_1 :: 30; SDL_SCANCODE_2 :: 31; SDL_SCANCODE_3 :: 32; SDL_SCANCODE_4 :: 33; SDL_SCANCODE_5 :: 34; SDL_SCANCODE_6 :: 35; SDL_SCANCODE_7 :: 36; SDL_SCANCODE_8 :: 37; SDL_SCANCODE_9 :: 38; SDL_SCANCODE_0 :: 39; SDL_SCANCODE_RETURN :: 40; SDL_SCANCODE_ESCAPE :: 41; SDL_SCANCODE_BACKSPACE :: 42; SDL_SCANCODE_TAB :: 43; SDL_SCANCODE_SPACE :: 44; SDL_SCANCODE_MINUS :: 45; SDL_SCANCODE_EQUALS :: 46; SDL_SCANCODE_LEFTBRACKET :: 47; SDL_SCANCODE_RIGHTBRACKET :: 48; SDL_SCANCODE_BACKSLASH :: 49; SDL_SCANCODE_NONUSHASH :: 50; SDL_SCANCODE_SEMICOLON :: 51; SDL_SCANCODE_APOSTROPHE :: 52; SDL_SCANCODE_GRAVE :: 53; SDL_SCANCODE_COMMA :: 54; SDL_SCANCODE_PERIOD :: 55; SDL_SCANCODE_SLASH :: 56; SDL_SCANCODE_CAPSLOCK :: 57; SDL_SCANCODE_F1 :: 58; SDL_SCANCODE_F2 :: 59; SDL_SCANCODE_F3 :: 60; SDL_SCANCODE_F4 :: 61; SDL_SCANCODE_F5 :: 62; SDL_SCANCODE_F6 :: 63; SDL_SCANCODE_F7 :: 64; SDL_SCANCODE_F8 :: 65; SDL_SCANCODE_F9 :: 66; SDL_SCANCODE_F10 :: 67; SDL_SCANCODE_F11 :: 68; SDL_SCANCODE_F12 :: 69; SDL_SCANCODE_PRINTSCREEN :: 70; SDL_SCANCODE_SCROLLLOCK :: 71; SDL_SCANCODE_PAUSE :: 72; SDL_SCANCODE_INSERT :: 73; SDL_SCANCODE_HOME :: 74; SDL_SCANCODE_PAGEUP :: 75; SDL_SCANCODE_DELETE :: 76; SDL_SCANCODE_END :: 77; SDL_SCANCODE_PAGEDOWN :: 78; SDL_SCANCODE_RIGHT :: 79; SDL_SCANCODE_LEFT :: 80; SDL_SCANCODE_DOWN :: 81; SDL_SCANCODE_UP :: 82; SDL_SCANCODE_NUMLOCKCLEAR :: 83; SDL_SCANCODE_KP_DIVIDE :: 84; SDL_SCANCODE_KP_MULTIPLY :: 85; SDL_SCANCODE_KP_MINUS :: 86; SDL_SCANCODE_KP_PLUS :: 87; SDL_SCANCODE_KP_ENTER :: 88; SDL_SCANCODE_KP_1 :: 89; SDL_SCANCODE_KP_2 :: 90; SDL_SCANCODE_KP_3 :: 91; SDL_SCANCODE_KP_4 :: 92; SDL_SCANCODE_KP_5 :: 93; SDL_SCANCODE_KP_6 :: 94; SDL_SCANCODE_KP_7 :: 95; SDL_SCANCODE_KP_8 :: 96; SDL_SCANCODE_KP_9 :: 97; SDL_SCANCODE_KP_0 :: 98; SDL_SCANCODE_KP_PERIOD :: 99; SDL_SCANCODE_NONUSBACKSLASH :: 100; SDL_SCANCODE_APPLICATION :: 101; SDL_SCANCODE_POWER :: 102; SDL_SCANCODE_KP_EQUALS :: 103; SDL_SCANCODE_F13 :: 104; SDL_SCANCODE_F14 :: 105; SDL_SCANCODE_F15 :: 106; SDL_SCANCODE_F16 :: 107; SDL_SCANCODE_F17 :: 108; SDL_SCANCODE_F18 :: 109; SDL_SCANCODE_F19 :: 110; SDL_SCANCODE_F20 :: 111; SDL_SCANCODE_F21 :: 112; SDL_SCANCODE_F22 :: 113; SDL_SCANCODE_F23 :: 114; SDL_SCANCODE_F24 :: 115; SDL_SCANCODE_EXECUTE :: 116; SDL_SCANCODE_HELP :: 117; SDL_SCANCODE_MENU :: 118; SDL_SCANCODE_SELECT :: 119; SDL_SCANCODE_STOP :: 120; SDL_SCANCODE_AGAIN :: 121; SDL_SCANCODE_UNDO :: 122; SDL_SCANCODE_CUT :: 123; SDL_SCANCODE_COPY :: 124; SDL_SCANCODE_PASTE :: 125; SDL_SCANCODE_FIND :: 126; SDL_SCANCODE_MUTE :: 127; SDL_SCANCODE_VOLUMEUP :: 128; SDL_SCANCODE_VOLUMEDOWN :: 129; SDL_SCANCODE_KP_COMMA :: 133; SDL_SCANCODE_KP_EQUALSAS400 :: 134; SDL_SCANCODE_INTERNATIONAL1 :: 135; SDL_SCANCODE_INTERNATIONAL2 :: 136; SDL_SCANCODE_INTERNATIONAL3 :: 137; SDL_SCANCODE_INTERNATIONAL4 :: 138; SDL_SCANCODE_INTERNATIONAL5 :: 139; SDL_SCANCODE_INTERNATIONAL6 :: 140; SDL_SCANCODE_INTERNATIONAL7 :: 141; SDL_SCANCODE_INTERNATIONAL8 :: 142; SDL_SCANCODE_INTERNATIONAL9 :: 143; SDL_SCANCODE_LANG1 :: 144; SDL_SCANCODE_LANG2 :: 145; SDL_SCANCODE_LANG3 :: 146; SDL_SCANCODE_LANG4 :: 147; SDL_SCANCODE_LANG5 :: 148; SDL_SCANCODE_LANG6 :: 149; SDL_SCANCODE_LANG7 :: 150; SDL_SCANCODE_LANG8 :: 151; SDL_SCANCODE_LANG9 :: 152; SDL_SCANCODE_ALTERASE :: 153; SDL_SCANCODE_SYSREQ :: 154; SDL_SCANCODE_CANCEL :: 155; SDL_SCANCODE_CLEAR :: 156; SDL_SCANCODE_PRIOR :: 157; SDL_SCANCODE_RETURN2 :: 158; SDL_SCANCODE_SEPARATOR :: 159; SDL_SCANCODE_OUT :: 160; SDL_SCANCODE_OPER :: 161; SDL_SCANCODE_CLEARAGAIN :: 162; SDL_SCANCODE_CRSEL :: 163; SDL_SCANCODE_EXSEL :: 164; SDL_SCANCODE_KP_00 :: 176; SDL_SCANCODE_KP_000 :: 177; SDL_SCANCODE_THOUSANDSSEPARATOR :: 178; SDL_SCANCODE_DECIMALSEPARATOR :: 179; SDL_SCANCODE_CURRENCYUNIT :: 180; SDL_SCANCODE_CURRENCYSUBUNIT :: 181; SDL_SCANCODE_KP_LEFTPAREN :: 182; SDL_SCANCODE_KP_RIGHTPAREN :: 183; SDL_SCANCODE_KP_LEFTBRACE :: 184; SDL_SCANCODE_KP_RIGHTBRACE :: 185; SDL_SCANCODE_KP_TAB :: 186; SDL_SCANCODE_KP_BACKSPACE :: 187; SDL_SCANCODE_KP_A :: 188; SDL_SCANCODE_KP_B :: 189; SDL_SCANCODE_KP_C :: 190; SDL_SCANCODE_KP_D :: 191; SDL_SCANCODE_KP_E :: 192; SDL_SCANCODE_KP_F :: 193; SDL_SCANCODE_KP_XOR :: 194; SDL_SCANCODE_KP_POWER :: 195; SDL_SCANCODE_KP_PERCENT :: 196; SDL_SCANCODE_KP_LESS :: 197; SDL_SCANCODE_KP_GREATER :: 198; SDL_SCANCODE_KP_AMPERSAND :: 199; SDL_SCANCODE_KP_DBLAMPERSAND :: 200; SDL_SCANCODE_KP_VERTICALBAR :: 201; SDL_SCANCODE_KP_DBLVERTICALBAR :: 202; SDL_SCANCODE_KP_COLON :: 203; SDL_SCANCODE_KP_HASH :: 204; SDL_SCANCODE_KP_SPACE :: 205; SDL_SCANCODE_KP_AT :: 206; SDL_SCANCODE_KP_EXCLAM :: 207; SDL_SCANCODE_KP_MEMSTORE :: 208; SDL_SCANCODE_KP_MEMRECALL :: 209; SDL_SCANCODE_KP_MEMCLEAR :: 210; SDL_SCANCODE_KP_MEMADD :: 211; SDL_SCANCODE_KP_MEMSUBTRACT :: 212; SDL_SCANCODE_KP_MEMMULTIPLY :: 213; SDL_SCANCODE_KP_MEMDIVIDE :: 214; SDL_SCANCODE_KP_PLUSMINUS :: 215; SDL_SCANCODE_KP_CLEAR :: 216; SDL_SCANCODE_KP_CLEARENTRY :: 217; SDL_SCANCODE_KP_BINARY :: 218; SDL_SCANCODE_KP_OCTAL :: 219; SDL_SCANCODE_KP_DECIMAL :: 220; SDL_SCANCODE_KP_HEXADECIMAL :: 221; SDL_SCANCODE_LCTRL :: 224; SDL_SCANCODE_LSHIFT :: 225; SDL_SCANCODE_LALT :: 226; SDL_SCANCODE_LGUI :: 227; SDL_SCANCODE_RCTRL :: 228; SDL_SCANCODE_RSHIFT :: 229; SDL_SCANCODE_RALT :: 230; SDL_SCANCODE_RGUI :: 231; SDL_SCANCODE_MODE :: 257; SDL_SCANCODE_SLEEP :: 258; SDL_SCANCODE_WAKE :: 259; SDL_SCANCODE_CHANNEL_INCREMENT :: 260; SDL_SCANCODE_CHANNEL_DECREMENT :: 261; SDL_SCANCODE_MEDIA_PLAY :: 262; SDL_SCANCODE_MEDIA_PAUSE :: 263; SDL_SCANCODE_MEDIA_RECORD :: 264; SDL_SCANCODE_MEDIA_FAST_FORWARD :: 265; SDL_SCANCODE_MEDIA_REWIND :: 266; SDL_SCANCODE_MEDIA_NEXT_TRACK :: 267; SDL_SCANCODE_MEDIA_PREVIOUS_TRACK :: 268; SDL_SCANCODE_MEDIA_STOP :: 269; SDL_SCANCODE_MEDIA_EJECT :: 270; SDL_SCANCODE_MEDIA_PLAY_PAUSE :: 271; SDL_SCANCODE_MEDIA_SELECT :: 272; SDL_SCANCODE_AC_NEW :: 273; SDL_SCANCODE_AC_OPEN :: 274; SDL_SCANCODE_AC_CLOSE :: 275; SDL_SCANCODE_AC_EXIT :: 276; SDL_SCANCODE_AC_SAVE :: 277; SDL_SCANCODE_AC_PRINT :: 278; SDL_SCANCODE_AC_PROPERTIES :: 279; SDL_SCANCODE_AC_SEARCH :: 280; SDL_SCANCODE_AC_HOME :: 281; SDL_SCANCODE_AC_BACK :: 282; SDL_SCANCODE_AC_FORWARD :: 283; SDL_SCANCODE_AC_STOP :: 284; SDL_SCANCODE_AC_REFRESH :: 285; SDL_SCANCODE_AC_BOOKMARKS :: 286; SDL_SCANCODE_SOFTLEFT :: 287; SDL_SCANCODE_SOFTRIGHT :: 288; SDL_SCANCODE_CALL :: 289; SDL_SCANCODE_ENDCALL :: 290; SDL_SCANCODE_RESERVED :: 400; SDL_SCANCODE_COUNT :: 512; } /** * The SDL virtual key representation. * * Values of this type are used to represent keyboard keys using the current * layout of the keyboard. These values include Unicode values representing * the unmodified character that would be generated by pressing the key, or an * `SDLK_*` constant for those keys that do not generate characters. * * A special exception is the number keys at the top of the keyboard which map * to SDLK_0...SDLK_9 on AZERTY layouts. * * Keys with the `SDLK_EXTENDED_MASK` bit set do not map to a scancode or * unicode code point. * * \since This datatype is available since SDL 3.2.0. */ SDL_Keycode :: Uint32; /** * Valid key modifiers (possibly OR'd together). * * \since This datatype is available since SDL 3.2.0. */ SDL_Keymod :: Uint16; /** * This is a unique ID for a keyboard for the time it is connected to the * system, and is never reused for the lifetime of the application. * * If the keyboard is disconnected and reconnected, it will get a new ID. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_KeyboardID :: Uint32; /** * Return whether a keyboard is currently connected. * * \returns true if a keyboard is connected, false otherwise. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboards */ SDL_HasKeyboard :: () -> bool #foreign libsdl3; /** * Get a list of currently connected keyboards. * * Note that this will include any device or virtual driver that includes * keyboard functionality, including some mice, KVM switches, motherboard * power buttons, etc. You should wait for input from a device before you * consider it actively in use. * * \param count a pointer filled in with the number of keyboards returned, may * be NULL. * \returns a 0 terminated array of keyboards instance IDs or NULL on failure; * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboardNameForID * \sa SDL_HasKeyboard */ SDL_GetKeyboards :: (count: *s32) -> *SDL_KeyboardID #foreign libsdl3; /** * Get the name of a keyboard. * * This function returns "" if the keyboard doesn't have a name. * * \param instance_id the keyboard instance ID. * \returns the name of the selected keyboard or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboards */ SDL_GetKeyboardNameForID :: (instance_id: SDL_KeyboardID) -> *u8 #foreign libsdl3; /** * Query the window which currently has keyboard focus. * * \returns the window with keyboard focus. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetKeyboardFocus :: () -> *SDL_Window #foreign libsdl3; /** * Get a snapshot of the current state of the keyboard. * * The pointer returned is a pointer to an internal SDL array. It will be * valid for the whole lifetime of the application and should not be freed by * the caller. * * A array element with a value of true means that the key is pressed and a * value of false means that it is not. Indexes into this array are obtained * by using SDL_Scancode values. * * Use SDL_PumpEvents() to update the state array. * * This function gives you the current state after all events have been * processed, so if a key or button has been pressed and released before you * process events, then the pressed state will never show up in the * SDL_GetKeyboardState() calls. * * Note: This function doesn't take into account whether shift has been * pressed or not. * * \param numkeys if non-NULL, receives the length of the returned array. * \returns a pointer to an array of key states. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PumpEvents * \sa SDL_ResetKeyboard */ SDL_GetKeyboardState :: (numkeys: *s32) -> *bool #foreign libsdl3; /** * Clear the state of the keyboard. * * This function will generate key up events for all pressed keys. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboardState */ SDL_ResetKeyboard :: () -> void #foreign libsdl3; /** * Get the current key modifier state for the keyboard. * * \returns an OR'd combination of the modifier keys for the keyboard. See * SDL_Keymod for details. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyboardState * \sa SDL_SetModState */ SDL_GetModState :: () -> SDL_Keymod #foreign libsdl3; /** * Set the current key modifier state for the keyboard. * * The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose * modifier key states on your application. Simply pass your desired modifier * states into `modstate`. This value may be a bitwise, OR'd combination of * SDL_Keymod values. * * This does not change the keyboard state, only the key modifier flags that * SDL reports. * * \param modstate the desired SDL_Keymod for the keyboard. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetModState */ SDL_SetModState :: (modstate: SDL_Keymod) -> void #foreign libsdl3; /** * Get the key code corresponding to the given scancode according to the * current keyboard layout. * * If you want to get the keycode as it would be delivered in key events, * including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should * pass `key_event` as true. Otherwise this function simply translates the * scancode based on the given modifier state. * * \param scancode the desired SDL_Scancode to query. * \param modstate the modifier state to use when translating the scancode to * a keycode. * \param key_event true if the keycode will be used in key events. * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromKey */ SDL_GetKeyFromScancode :: (scancode: SDL_Scancode, modstate: SDL_Keymod, key_event: bool) -> SDL_Keycode #foreign libsdl3; /** * Get the scancode corresponding to the given key code according to the * current keyboard layout. * * Note that there may be multiple scancode+modifier states that can generate * this keycode, this will just return the first one found. * * \param key the desired SDL_Keycode to query. * \param modstate a pointer to the modifier state that would be used when the * scancode generates this key, may be NULL. * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeName */ SDL_GetScancodeFromKey :: (key: SDL_Keycode, modstate: *SDL_Keymod) -> SDL_Scancode #foreign libsdl3; /** * Set a human-readable name for a scancode. * * \param scancode the desired SDL_Scancode. * \param name the name to use for the scancode, encoded as UTF-8. The string * is not copied, so the pointer given to this function must stay * valid while SDL is being used. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetScancodeName */ SDL_SetScancodeName :: (scancode: SDL_Scancode, name: *u8) -> bool #foreign libsdl3; /** * Get a human-readable name for a scancode. * * **Warning**: The returned name is by design not stable across platforms, * e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left * Windows" under Microsoft Windows, and some scancodes like * `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even * scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and * `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore * unsuitable for creating a stable cross-platform two-way mapping between * strings and scancodes. * * \param scancode the desired SDL_Scancode to query. * \returns a pointer to the name for the scancode. If the scancode doesn't * have a name this function returns an empty string (""). * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetScancodeFromKey * \sa SDL_GetScancodeFromName * \sa SDL_SetScancodeName */ SDL_GetScancodeName :: (scancode: SDL_Scancode) -> *u8 #foreign libsdl3; /** * Get a scancode from a human-readable name. * * \param name the human-readable scancode name. * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't * recognized; call SDL_GetError() for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyFromName * \sa SDL_GetScancodeFromKey * \sa SDL_GetScancodeName */ SDL_GetScancodeFromName :: (name: *u8) -> SDL_Scancode #foreign libsdl3; /** * Get a human-readable name for a key. * * If the key doesn't have a name, this function returns an empty string (""). * * Letters will be presented in their uppercase form, if applicable. * * \param key the desired SDL_Keycode to query. * \returns a UTF-8 encoded string of the key name. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyFromName * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeFromKey */ SDL_GetKeyName :: (key: SDL_Keycode) -> *u8 #foreign libsdl3; /** * Get a key code from a human-readable name. * * \param name the human-readable key name. * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call * SDL_GetError() for more information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetKeyFromScancode * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromName */ SDL_GetKeyFromName :: (name: *u8) -> SDL_Keycode #foreign libsdl3; /** * Start accepting Unicode text input events in a window. * * This function will enable text input (SDL_EVENT_TEXT_INPUT and * SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this * function paired with SDL_StopTextInput(). * * Text input events are not received by default. * * On some platforms using this function shows the screen keyboard and/or * activates an IME, which can prevent some key press events from being passed * through. * * \param window the window to enable text input. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextInputArea * \sa SDL_StartTextInputWithProperties * \sa SDL_StopTextInput * \sa SDL_TextInputActive */ SDL_StartTextInput :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Text input type. * * These are the valid values for SDL_PROP_TEXTINPUT_TYPE_NUMBER. Not every * value is valid on every platform, but where a value isn't supported, a * reasonable fallback will be used. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_StartTextInputWithProperties */ using SDL_TextInputType :: enum u32 { SDL_TEXTINPUT_TYPE_TEXT :: 0; SDL_TEXTINPUT_TYPE_TEXT_NAME :: 1; SDL_TEXTINPUT_TYPE_TEXT_EMAIL :: 2; SDL_TEXTINPUT_TYPE_TEXT_USERNAME :: 3; SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN :: 4; SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE :: 5; SDL_TEXTINPUT_TYPE_NUMBER :: 6; SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN :: 7; SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE :: 8; } /** * Auto capitalization type. * * These are the valid values for SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER. * Not every value is valid on every platform, but where a value isn't * supported, a reasonable fallback will be used. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_StartTextInputWithProperties */ using SDL_Capitalization :: enum u32 { SDL_CAPITALIZE_NONE :: 0; SDL_CAPITALIZE_SENTENCES :: 1; SDL_CAPITALIZE_WORDS :: 2; SDL_CAPITALIZE_LETTERS :: 3; } /** * Start accepting Unicode text input events in a window, with properties * describing the input. * * This function will enable text input (SDL_EVENT_TEXT_INPUT and * SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this * function paired with SDL_StopTextInput(). * * Text input events are not received by default. * * On some platforms using this function shows the screen keyboard and/or * activates an IME, which can prevent some key press events from being passed * through. * * These are the supported properties: * * - `SDL_PROP_TEXTINPUT_TYPE_NUMBER` - an SDL_TextInputType value that * describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT. * - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value * that describes how text should be capitalized, defaults to * SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for * SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail * addresses, usernames, and passwords. * - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion * and auto correction, defaults to true. * - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text * are allowed. This defaults to true if SDL_HINT_RETURN_KEY_HIDES_IME is * "0" or is not set, and defaults to false if SDL_HINT_RETURN_KEY_HIDES_IME * is "1". * * On Android you can directly specify the input type: * * - `SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER` - the text input type to * use, overriding other properties. This is documented at * https://developer.android.com/reference/android/text/InputType * * \param window the window to enable text input. * \param props the properties to use. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextInputArea * \sa SDL_StartTextInput * \sa SDL_StopTextInput * \sa SDL_TextInputActive */ SDL_StartTextInputWithProperties :: (window: *SDL_Window, props: SDL_PropertiesID) -> bool #foreign libsdl3; /** * Check whether or not Unicode text input events are enabled for a window. * * \param window the window to check. * \returns true if text input events are enabled else false. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StartTextInput */ SDL_TextInputActive :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Stop receiving any text input events in a window. * * If SDL_StartTextInput() showed the screen keyboard, this function will hide * it. * * \param window the window to disable text input. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StartTextInput */ SDL_StopTextInput :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Dismiss the composition window/IME without disabling the subsystem. * * \param window the window to affect. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StartTextInput * \sa SDL_StopTextInput */ SDL_ClearComposition :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Set the area used to type Unicode text input. * * Native input methods may place a window with word suggestions near the * cursor, without covering the text being entered. * * \param window the window for which to set the text input area. * \param rect the SDL_Rect representing the text input area, in window * coordinates, or NULL to clear it. * \param cursor the offset of the current cursor location relative to * `rect->x`, in window coordinates. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextInputArea * \sa SDL_StartTextInput */ SDL_SetTextInputArea :: (window: *SDL_Window, rect: *SDL_Rect, cursor: s32) -> bool #foreign libsdl3; /** * Get the area used to type Unicode text input. * * This returns the values previously set by SDL_SetTextInputArea(). * * \param window the window for which to query the text input area. * \param rect a pointer to an SDL_Rect filled in with the text input area, * may be NULL. * \param cursor a pointer to the offset of the current cursor location * relative to `rect->x`, may be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextInputArea */ SDL_GetTextInputArea :: (window: *SDL_Window, rect: *SDL_Rect, cursor: *s32) -> bool #foreign libsdl3; /** * Check whether the platform has screen keyboard support. * * \returns true if the platform has some screen keyboard support or false if * not. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StartTextInput * \sa SDL_ScreenKeyboardShown */ SDL_HasScreenKeyboardSupport :: () -> bool #foreign libsdl3; /** * Check whether the screen keyboard is shown for given window. * * \param window the window for which screen keyboard should be queried. * \returns true if screen keyboard is shown or false if not. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasScreenKeyboardSupport */ SDL_ScreenKeyboardShown :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * This is a unique ID for a mouse for the time it is connected to the system, * and is never reused for the lifetime of the application. * * If the mouse is disconnected and reconnected, it will get a new ID. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_MouseID :: Uint32; SDL_Cursor :: struct {} /** * Cursor types for SDL_CreateSystemCursor(). * * \since This enum is available since SDL 3.2.0. */ using SDL_SystemCursor :: enum u32 { SDL_SYSTEM_CURSOR_DEFAULT :: 0; SDL_SYSTEM_CURSOR_TEXT :: 1; SDL_SYSTEM_CURSOR_WAIT :: 2; SDL_SYSTEM_CURSOR_CROSSHAIR :: 3; SDL_SYSTEM_CURSOR_PROGRESS :: 4; SDL_SYSTEM_CURSOR_NWSE_RESIZE :: 5; SDL_SYSTEM_CURSOR_NESW_RESIZE :: 6; SDL_SYSTEM_CURSOR_EW_RESIZE :: 7; SDL_SYSTEM_CURSOR_NS_RESIZE :: 8; SDL_SYSTEM_CURSOR_MOVE :: 9; SDL_SYSTEM_CURSOR_NOT_ALLOWED :: 10; SDL_SYSTEM_CURSOR_POINTER :: 11; SDL_SYSTEM_CURSOR_NW_RESIZE :: 12; SDL_SYSTEM_CURSOR_N_RESIZE :: 13; SDL_SYSTEM_CURSOR_NE_RESIZE :: 14; SDL_SYSTEM_CURSOR_E_RESIZE :: 15; SDL_SYSTEM_CURSOR_SE_RESIZE :: 16; SDL_SYSTEM_CURSOR_S_RESIZE :: 17; SDL_SYSTEM_CURSOR_SW_RESIZE :: 18; SDL_SYSTEM_CURSOR_W_RESIZE :: 19; SDL_SYSTEM_CURSOR_COUNT :: 20; } /** * Scroll direction types for the Scroll event * * \since This enum is available since SDL 3.2.0. */ using SDL_MouseWheelDirection :: enum u32 { SDL_MOUSEWHEEL_NORMAL :: 0; SDL_MOUSEWHEEL_FLIPPED :: 1; } /** * A bitmask of pressed mouse buttons, as reported by SDL_GetMouseState, etc. * * - Button 1: Left mouse button * - Button 2: Middle mouse button * - Button 3: Right mouse button * - Button 4: Side mouse button 1 * - Button 5: Side mouse button 2 * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetMouseState * \sa SDL_GetGlobalMouseState * \sa SDL_GetRelativeMouseState */ SDL_MouseButtonFlags :: Uint32; /** * Return whether a mouse is currently connected. * * \returns true if a mouse is connected, false otherwise. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMice */ SDL_HasMouse :: () -> bool #foreign libsdl3; /** * Get a list of currently connected mice. * * Note that this will include any device or virtual driver that includes * mouse functionality, including some game controllers, KVM switches, etc. * You should wait for input from a device before you consider it actively in * use. * * \param count a pointer filled in with the number of mice returned, may be * NULL. * \returns a 0 terminated array of mouse instance IDs or NULL on failure; * call SDL_GetError() for more information. This should be freed * with SDL_free() when it is no longer needed. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMouseNameForID * \sa SDL_HasMouse */ SDL_GetMice :: (count: *s32) -> *SDL_MouseID #foreign libsdl3; /** * Get the name of a mouse. * * This function returns "" if the mouse doesn't have a name. * * \param instance_id the mouse instance ID. * \returns the name of the selected mouse, or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMice */ SDL_GetMouseNameForID :: (instance_id: SDL_MouseID) -> *u8 #foreign libsdl3; /** * Get the window which currently has mouse focus. * * \returns the window with mouse focus. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetMouseFocus :: () -> *SDL_Window #foreign libsdl3; /** * Query SDL's cache for the synchronous mouse button state and the * window-relative SDL-cursor position. * * This function returns the cached synchronous state as SDL understands it * from the last pump of the event queue. * * To query the platform for immediate asynchronous state, use * SDL_GetGlobalMouseState. * * Passing non-NULL pointers to `x` or `y` will write the destination with * respective x or y coordinates relative to the focused window. * * In Relative Mode, the SDL-cursor's position usually contradicts the * platform-cursor's position as manually calculated from * SDL_GetGlobalMouseState() and SDL_GetWindowPosition. * * \param x a pointer to receive the SDL-cursor's x-position from the focused * window's top left corner, can be NULL if unused. * \param y a pointer to receive the SDL-cursor's y-position from the focused * window's top left corner, can be NULL if unused. * \returns a 32-bit bitmask of the button state that can be bitwise-compared * against the SDL_BUTTON_MASK(X) macro. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGlobalMouseState * \sa SDL_GetRelativeMouseState */ SDL_GetMouseState :: (x: *float, y: *float) -> SDL_MouseButtonFlags #foreign libsdl3; /** * Query the platform for the asynchronous mouse button state and the * desktop-relative platform-cursor position. * * This function immediately queries the platform for the most recent * asynchronous state, more costly than retrieving SDL's cached state in * SDL_GetMouseState(). * * Passing non-NULL pointers to `x` or `y` will write the destination with * respective x or y coordinates relative to the desktop. * * In Relative Mode, the platform-cursor's position usually contradicts the * SDL-cursor's position as manually calculated from SDL_GetMouseState() and * SDL_GetWindowPosition. * * This function can be useful if you need to track the mouse outside of a * specific window and SDL_CaptureMouse() doesn't fit your needs. For example, * it could be useful if you need to track the mouse while dragging a window, * where coordinates relative to a window might not be in sync at all times. * * \param x a pointer to receive the platform-cursor's x-position from the * desktop's top left corner, can be NULL if unused. * \param y a pointer to receive the platform-cursor's y-position from the * desktop's top left corner, can be NULL if unused. * \returns a 32-bit bitmask of the button state that can be bitwise-compared * against the SDL_BUTTON_MASK(X) macro. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CaptureMouse * \sa SDL_GetMouseState * \sa SDL_GetGlobalMouseState */ SDL_GetGlobalMouseState :: (x: *float, y: *float) -> SDL_MouseButtonFlags #foreign libsdl3; /** * Query SDL's cache for the synchronous mouse button state and accumulated * mouse delta since last call. * * This function returns the cached synchronous state as SDL understands it * from the last pump of the event queue. * * To query the platform for immediate asynchronous state, use * SDL_GetGlobalMouseState. * * Passing non-NULL pointers to `x` or `y` will write the destination with * respective x or y deltas accumulated since the last call to this function * (or since event initialization). * * This function is useful for reducing overhead by processing relative mouse * inputs in one go per-frame instead of individually per-event, at the * expense of losing the order between events within the frame (e.g. quickly * pressing and releasing a button within the same frame). * * \param x a pointer to receive the x mouse delta accumulated since last * call, can be NULL if unused. * \param y a pointer to receive the y mouse delta accumulated since last * call, can be NULL if unused. * \returns a 32-bit bitmask of the button state that can be bitwise-compared * against the SDL_BUTTON_MASK(X) macro. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMouseState * \sa SDL_GetGlobalMouseState */ SDL_GetRelativeMouseState :: (x: *float, y: *float) -> SDL_MouseButtonFlags #foreign libsdl3; /** * Move the mouse cursor to the given position within the window. * * This function generates a mouse motion event if relative mode is not * enabled. If relative mode is enabled, you can force mouse events for the * warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint. * * Note that this function will appear to succeed, but not actually move the * mouse when used over Microsoft Remote Desktop. * * \param window the window to move the mouse into, or NULL for the current * mouse focus. * \param x the x coordinate within the window. * \param y the y coordinate within the window. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WarpMouseGlobal */ SDL_WarpMouseInWindow :: (window: *SDL_Window, x: float, y: float) -> void #foreign libsdl3; /** * Move the mouse to the given position in global screen space. * * This function generates a mouse motion event. * * A failure of this function usually means that it is unsupported by a * platform. * * Note that this function will appear to succeed, but not actually move the * mouse when used over Microsoft Remote Desktop. * * \param x the x coordinate. * \param y the y coordinate. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WarpMouseInWindow */ SDL_WarpMouseGlobal :: (x: float, y: float) -> bool #foreign libsdl3; /** * Set relative mouse mode for a window. * * While the window has focus and relative mouse mode is enabled, the cursor * is hidden, the mouse position is constrained to the window, and SDL will * report continuous relative mouse motion even if the mouse is at the edge of * the window. * * If you'd like to keep the mouse position fixed while in relative mode you * can use SDL_SetWindowMouseRect(). If you'd like the cursor to be at a * specific location when relative mode ends, you should use * SDL_WarpMouseInWindow() before disabling relative mode. * * This function will flush any pending mouse motion for this window. * * \param window the window to change. * \param enabled true to enable relative mode, false to disable. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetWindowRelativeMouseMode */ SDL_SetWindowRelativeMouseMode :: (window: *SDL_Window, enabled: bool) -> bool #foreign libsdl3; /** * Query whether relative mouse mode is enabled for a window. * * \param window the window to query. * \returns true if relative mode is enabled for a window or false otherwise. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetWindowRelativeMouseMode */ SDL_GetWindowRelativeMouseMode :: (window: *SDL_Window) -> bool #foreign libsdl3; /** * Capture the mouse and to track input outside an SDL window. * * Capturing enables your app to obtain mouse events globally, instead of just * within your window. Not all video targets support this function. When * capturing is enabled, the current window will get all mouse events, but * unlike relative mode, no change is made to the cursor and it is not * restrained to your window. * * This function may also deny mouse input to other windows--both those in * your application and others on the system--so you should use this function * sparingly, and in small bursts. For example, you might want to track the * mouse while the user is dragging something, until the user releases a mouse * button. It is not recommended that you capture the mouse for long periods * of time, such as the entire time your app is running. For that, you should * probably use SDL_SetWindowRelativeMouseMode() or SDL_SetWindowMouseGrab(), * depending on your goals. * * While captured, mouse events still report coordinates relative to the * current (foreground) window, but those coordinates may be outside the * bounds of the window (including negative values). Capturing is only allowed * for the foreground window. If the window loses focus while capturing, the * capture will be disabled automatically. * * While capturing is enabled, the current window will have the * `SDL_WINDOW_MOUSE_CAPTURE` flag set. * * Please note that SDL will attempt to "auto capture" the mouse while the * user is pressing a button; this is to try and make mouse behavior more * consistent between platforms, and deal with the common case of a user * dragging the mouse outside of the window. This means that if you are * calling SDL_CaptureMouse() only to deal with this situation, you do not * have to (although it is safe to do so). If this causes problems for your * app, you can disable auto capture by setting the * `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero. * * \param enabled true to enable capturing, false to disable. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGlobalMouseState */ SDL_CaptureMouse :: (enabled: bool) -> bool #foreign libsdl3; /** * Create a cursor using the specified bitmap data and mask (in MSB format). * * `mask` has to be in MSB (Most Significant Bit) format. * * The cursor width (`w`) must be a multiple of 8 bits. * * The cursor is created in black and white according to the following: * * - data=0, mask=1: white * - data=1, mask=1: black * - data=0, mask=0: transparent * - data=1, mask=0: inverted color if possible, black if not. * * Cursors created with this function must be freed with SDL_DestroyCursor(). * * If you want to have a color cursor, or create your cursor from an * SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can * hide the cursor and draw your own as part of your game's rendering, but it * will be bound to the framerate. * * Also, SDL_CreateSystemCursor() is available, which provides several * readily-available system cursors to pick from. * * \param data the color value for each pixel of the cursor. * \param mask the mask value for each pixel of the cursor. * \param w the width of the cursor. * \param h the height of the cursor. * \param hot_x the x-axis offset from the left of the cursor image to the * mouse x position, in the range of 0 to `w` - 1. * \param hot_y the y-axis offset from the top of the cursor image to the * mouse y position, in the range of 0 to `h` - 1. * \returns a new cursor with the specified parameters on success or NULL on * failure; call SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateColorCursor * \sa SDL_CreateSystemCursor * \sa SDL_DestroyCursor * \sa SDL_SetCursor */ SDL_CreateCursor :: (data: *Uint8, mask: *Uint8, w: s32, h: s32, hot_x: s32, hot_y: s32) -> *SDL_Cursor #foreign libsdl3; /** * Create a color cursor. * * If this function is passed a surface with alternate representations, the * surface will be interpreted as the content to be used for 100% display * scale, and the alternate representations will be used for high DPI * situations. For example, if the original surface is 32x32, then on a 2x * macOS display or 200% display scale on Windows, a 64x64 version of the * image will be used, if available. If a matching version of the image isn't * available, the closest larger size image will be downscaled to the * appropriate size and be used instead, if available. Otherwise, the closest * smaller image will be upscaled and be used instead. * * \param surface an SDL_Surface structure representing the cursor image. * \param hot_x the x position of the cursor hot spot. * \param hot_y the y position of the cursor hot spot. * \returns the new cursor on success or NULL on failure; call SDL_GetError() * for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateCursor * \sa SDL_CreateSystemCursor * \sa SDL_DestroyCursor * \sa SDL_SetCursor */ SDL_CreateColorCursor :: (surface: *SDL_Surface, hot_x: s32, hot_y: s32) -> *SDL_Cursor #foreign libsdl3; /** * Create a system cursor. * * \param id an SDL_SystemCursor enum value. * \returns a cursor on success or NULL on failure; call SDL_GetError() for * more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyCursor */ SDL_CreateSystemCursor :: (id: SDL_SystemCursor) -> *SDL_Cursor #foreign libsdl3; /** * Set the active cursor. * * This function sets the currently active cursor to the specified one. If the * cursor is currently visible, the change will be immediately represented on * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if * this is desired for any reason. * * \param cursor a cursor to make active. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCursor */ SDL_SetCursor :: (cursor: *SDL_Cursor) -> bool #foreign libsdl3; /** * Get the active cursor. * * This function returns a pointer to the current cursor which is owned by the * library. It is not necessary to free the cursor with SDL_DestroyCursor(). * * \returns the active cursor or NULL if there is no mouse. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetCursor */ SDL_GetCursor :: () -> *SDL_Cursor #foreign libsdl3; /** * Get the default cursor. * * You do not have to call SDL_DestroyCursor() on the return value, but it is * safe to do so. * * \returns the default cursor on success or NULL on failuree; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetDefaultCursor :: () -> *SDL_Cursor #foreign libsdl3; /** * Free a previously-created cursor. * * Use this function to free cursor resources created with SDL_CreateCursor(), * SDL_CreateColorCursor() or SDL_CreateSystemCursor(). * * \param cursor the cursor to free. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateColorCursor * \sa SDL_CreateCursor * \sa SDL_CreateSystemCursor */ SDL_DestroyCursor :: (cursor: *SDL_Cursor) -> void #foreign libsdl3; /** * Show the cursor. * * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CursorVisible * \sa SDL_HideCursor */ SDL_ShowCursor :: () -> bool #foreign libsdl3; /** * Hide the cursor. * * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CursorVisible * \sa SDL_ShowCursor */ SDL_HideCursor :: () -> bool #foreign libsdl3; /** * Return whether the cursor is currently being shown. * * \returns `true` if the cursor is being shown, or `false` if the cursor is * hidden. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HideCursor * \sa SDL_ShowCursor */ SDL_CursorVisible :: () -> bool #foreign libsdl3; /** * A unique ID for a touch device. * * This ID is valid for the time the device is connected to the system, and is * never reused for the lifetime of the application. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_TouchID :: Uint64; /** * A unique ID for a single finger on a touch device. * * This ID is valid for the time the finger (stylus, etc) is touching and will * be unique for all fingers currently in contact, so this ID tracks the * lifetime of a single continuous touch. This value may represent an index, a * pointer, or some other unique ID, depending on the platform. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_FingerID :: Uint64; /** * An enum that describes the type of a touch device. * * \since This enum is available since SDL 3.2.0. */ using SDL_TouchDeviceType :: enum s32 { SDL_TOUCH_DEVICE_INVALID :: -1; SDL_TOUCH_DEVICE_DIRECT :: 0; SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE :: 1; SDL_TOUCH_DEVICE_INDIRECT_RELATIVE :: 2; } /** * Data about a single finger in a multitouch event. * * Each touch event is a collection of fingers that are simultaneously in * contact with the touch device (so a "touch" can be a "multitouch," in * reality), and this struct reports details of the specific fingers. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetTouchFingers */ SDL_Finger :: struct { id: SDL_FingerID; /**< the finger ID */ x: float; /**< the x-axis location of the touch event, normalized (0...1) */ y: float; /**< the y-axis location of the touch event, normalized (0...1) */ pressure: float; /**< the quantity of pressure applied, normalized (0...1) */ } /** * Get a list of registered touch devices. * * On some platforms SDL first sees the touch device if it was actually used. * Therefore the returned list might be empty, although devices are available. * After using all devices at least once the number will be correct. * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of touch device IDs or NULL on failure; call * SDL_GetError() for more information. This should be freed with * SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. */ SDL_GetTouchDevices :: (count: *s32) -> *SDL_TouchID #foreign libsdl3; /** * Get the touch device name as reported from the driver. * * \param touchID the touch device instance ID. * \returns touch device name, or NULL on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetTouchDeviceName :: (touchID: SDL_TouchID) -> *u8 #foreign libsdl3; /** * Get the type of the given touch device. * * \param touchID the ID of a touch device. * \returns touch device type. * * \since This function is available since SDL 3.2.0. */ SDL_GetTouchDeviceType :: (touchID: SDL_TouchID) -> SDL_TouchDeviceType #foreign libsdl3; /** * Get a list of active fingers for a given touch device. * * \param touchID the ID of a touch device. * \param count a pointer filled in with the number of fingers returned, can * be NULL. * \returns a NULL terminated array of SDL_Finger pointers or NULL on failure; * call SDL_GetError() for more information. This is a single * allocation that should be freed with SDL_free() when it is no * longer needed. * * \since This function is available since SDL 3.2.0. */ SDL_GetTouchFingers :: (touchID: SDL_TouchID, count: *s32) -> **SDL_Finger #foreign libsdl3; /** * SDL pen instance IDs. * * Zero is used to signify an invalid/null device. * * These show up in pen events when SDL sees input from them. They remain * consistent as long as SDL can recognize a tool to be the same pen; but if a * pen physically leaves the area and returns, it might get a new ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_PenID :: Uint32; /** * Pen input flags, as reported by various pen events' `pen_state` field. * * \since This datatype is available since SDL 3.2.0. */ SDL_PenInputFlags :: Uint32; /** * Pen axis indices. * * These are the valid values for the `axis` field in SDL_PenAxisEvent. All * axes are either normalised to 0..1 or report a (positive or negative) angle * in degrees, with 0.0 representing the centre. Not all pens/backends support * all axes: unsupported axes are always zero. * * To convert angles for tilt and rotation into vector representation, use * SDL_sinf on the XTILT, YTILT, or ROTATION component, for example: * * `SDL_sinf(xtilt * SDL_PI_F / 180.0)`. * * \since This enum is available since SDL 3.2.0. */ using SDL_PenAxis :: enum u32 { SDL_PEN_AXIS_PRESSURE :: 0; SDL_PEN_AXIS_XTILT :: 1; SDL_PEN_AXIS_YTILT :: 2; SDL_PEN_AXIS_DISTANCE :: 3; SDL_PEN_AXIS_ROTATION :: 4; SDL_PEN_AXIS_SLIDER :: 5; SDL_PEN_AXIS_TANGENTIAL_PRESSURE :: 6; SDL_PEN_AXIS_COUNT :: 7; } /** * The types of events that can be delivered. * * \since This enum is available since SDL 3.2.0. */ using SDL_EventType :: enum u32 { SDL_EVENT_FIRST :: 0; SDL_EVENT_QUIT :: 256; SDL_EVENT_TERMINATING :: 257; SDL_EVENT_LOW_MEMORY :: 258; SDL_EVENT_WILL_ENTER_BACKGROUND :: 259; SDL_EVENT_DID_ENTER_BACKGROUND :: 260; SDL_EVENT_WILL_ENTER_FOREGROUND :: 261; SDL_EVENT_DID_ENTER_FOREGROUND :: 262; SDL_EVENT_LOCALE_CHANGED :: 263; SDL_EVENT_SYSTEM_THEME_CHANGED :: 264; SDL_EVENT_DISPLAY_ORIENTATION :: 337; SDL_EVENT_DISPLAY_ADDED :: 338; SDL_EVENT_DISPLAY_REMOVED :: 339; SDL_EVENT_DISPLAY_MOVED :: 340; SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED :: 341; SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED :: 342; SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED :: 343; SDL_EVENT_DISPLAY_FIRST :: 337; SDL_EVENT_DISPLAY_LAST :: 343; SDL_EVENT_WINDOW_SHOWN :: 514; SDL_EVENT_WINDOW_HIDDEN :: 515; SDL_EVENT_WINDOW_EXPOSED :: 516; SDL_EVENT_WINDOW_MOVED :: 517; SDL_EVENT_WINDOW_RESIZED :: 518; SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED :: 519; SDL_EVENT_WINDOW_METAL_VIEW_RESIZED :: 520; SDL_EVENT_WINDOW_MINIMIZED :: 521; SDL_EVENT_WINDOW_MAXIMIZED :: 522; SDL_EVENT_WINDOW_RESTORED :: 523; SDL_EVENT_WINDOW_MOUSE_ENTER :: 524; SDL_EVENT_WINDOW_MOUSE_LEAVE :: 525; SDL_EVENT_WINDOW_FOCUS_GAINED :: 526; SDL_EVENT_WINDOW_FOCUS_LOST :: 527; SDL_EVENT_WINDOW_CLOSE_REQUESTED :: 528; SDL_EVENT_WINDOW_HIT_TEST :: 529; SDL_EVENT_WINDOW_ICCPROF_CHANGED :: 530; SDL_EVENT_WINDOW_DISPLAY_CHANGED :: 531; SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED :: 532; SDL_EVENT_WINDOW_SAFE_AREA_CHANGED :: 533; SDL_EVENT_WINDOW_OCCLUDED :: 534; SDL_EVENT_WINDOW_ENTER_FULLSCREEN :: 535; SDL_EVENT_WINDOW_LEAVE_FULLSCREEN :: 536; SDL_EVENT_WINDOW_DESTROYED :: 537; SDL_EVENT_WINDOW_HDR_STATE_CHANGED :: 538; SDL_EVENT_WINDOW_FIRST :: 514; SDL_EVENT_WINDOW_LAST :: 538; SDL_EVENT_KEY_DOWN :: 768; SDL_EVENT_KEY_UP :: 769; SDL_EVENT_TEXT_EDITING :: 770; SDL_EVENT_TEXT_INPUT :: 771; SDL_EVENT_KEYMAP_CHANGED :: 772; SDL_EVENT_KEYBOARD_ADDED :: 773; SDL_EVENT_KEYBOARD_REMOVED :: 774; SDL_EVENT_TEXT_EDITING_CANDIDATES :: 775; SDL_EVENT_MOUSE_MOTION :: 1024; SDL_EVENT_MOUSE_BUTTON_DOWN :: 1025; SDL_EVENT_MOUSE_BUTTON_UP :: 1026; SDL_EVENT_MOUSE_WHEEL :: 1027; SDL_EVENT_MOUSE_ADDED :: 1028; SDL_EVENT_MOUSE_REMOVED :: 1029; SDL_EVENT_JOYSTICK_AXIS_MOTION :: 1536; SDL_EVENT_JOYSTICK_BALL_MOTION :: 1537; SDL_EVENT_JOYSTICK_HAT_MOTION :: 1538; SDL_EVENT_JOYSTICK_BUTTON_DOWN :: 1539; SDL_EVENT_JOYSTICK_BUTTON_UP :: 1540; SDL_EVENT_JOYSTICK_ADDED :: 1541; SDL_EVENT_JOYSTICK_REMOVED :: 1542; SDL_EVENT_JOYSTICK_BATTERY_UPDATED :: 1543; SDL_EVENT_JOYSTICK_UPDATE_COMPLETE :: 1544; SDL_EVENT_GAMEPAD_AXIS_MOTION :: 1616; SDL_EVENT_GAMEPAD_BUTTON_DOWN :: 1617; SDL_EVENT_GAMEPAD_BUTTON_UP :: 1618; SDL_EVENT_GAMEPAD_ADDED :: 1619; SDL_EVENT_GAMEPAD_REMOVED :: 1620; SDL_EVENT_GAMEPAD_REMAPPED :: 1621; SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN :: 1622; SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION :: 1623; SDL_EVENT_GAMEPAD_TOUCHPAD_UP :: 1624; SDL_EVENT_GAMEPAD_SENSOR_UPDATE :: 1625; SDL_EVENT_GAMEPAD_UPDATE_COMPLETE :: 1626; SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED :: 1627; SDL_EVENT_FINGER_DOWN :: 1792; SDL_EVENT_FINGER_UP :: 1793; SDL_EVENT_FINGER_MOTION :: 1794; SDL_EVENT_FINGER_CANCELED :: 1795; SDL_EVENT_CLIPBOARD_UPDATE :: 2304; SDL_EVENT_DROP_FILE :: 4096; SDL_EVENT_DROP_TEXT :: 4097; SDL_EVENT_DROP_BEGIN :: 4098; SDL_EVENT_DROP_COMPLETE :: 4099; SDL_EVENT_DROP_POSITION :: 4100; SDL_EVENT_AUDIO_DEVICE_ADDED :: 4352; SDL_EVENT_AUDIO_DEVICE_REMOVED :: 4353; SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED :: 4354; SDL_EVENT_SENSOR_UPDATE :: 4608; SDL_EVENT_PEN_PROXIMITY_IN :: 4864; SDL_EVENT_PEN_PROXIMITY_OUT :: 4865; SDL_EVENT_PEN_DOWN :: 4866; SDL_EVENT_PEN_UP :: 4867; SDL_EVENT_PEN_BUTTON_DOWN :: 4868; SDL_EVENT_PEN_BUTTON_UP :: 4869; SDL_EVENT_PEN_MOTION :: 4870; SDL_EVENT_PEN_AXIS :: 4871; SDL_EVENT_CAMERA_DEVICE_ADDED :: 5120; SDL_EVENT_CAMERA_DEVICE_REMOVED :: 5121; SDL_EVENT_CAMERA_DEVICE_APPROVED :: 5122; SDL_EVENT_CAMERA_DEVICE_DENIED :: 5123; SDL_EVENT_RENDER_TARGETS_RESET :: 8192; SDL_EVENT_RENDER_DEVICE_RESET :: 8193; SDL_EVENT_RENDER_DEVICE_LOST :: 8194; SDL_EVENT_PRIVATE0 :: 16384; SDL_EVENT_PRIVATE1 :: 16385; SDL_EVENT_PRIVATE2 :: 16386; SDL_EVENT_PRIVATE3 :: 16387; SDL_EVENT_POLL_SENTINEL :: 32512; SDL_EVENT_USER :: 32768; SDL_EVENT_LAST :: 65535; SDL_EVENT_ENUM_PADDING :: 2147483647; } /** * Fields shared by every event * * \since This struct is available since SDL 3.2.0. */ SDL_CommonEvent :: struct { type: Uint32; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ } /** * Display state change event data (event.display.*) * * \since This struct is available since SDL 3.2.0. */ SDL_DisplayEvent :: struct { type: SDL_EventType; /**< SDL_DISPLAYEVENT_* */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ displayID: SDL_DisplayID; /**< The associated display */ data1: Sint32; /**< event dependent data */ data2: Sint32; /**< event dependent data */ } /** * Window state change event data (event.window.*) * * \since This struct is available since SDL 3.2.0. */ SDL_WindowEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_WINDOW_* */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The associated window */ data1: Sint32; /**< event dependent data */ data2: Sint32; /**< event dependent data */ } /** * Keyboard device event structure (event.kdevice.*) * * \since This struct is available since SDL 3.2.0. */ SDL_KeyboardDeviceEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_KeyboardID; /**< The keyboard instance id */ } /** * Keyboard button event structure (event.key.*) * * The `key` is the base SDL_Keycode generated by pressing the `scancode` * using the current keyboard layout, applying any options specified in * SDL_HINT_KEYCODE_OPTIONS. You can get the SDL_Keycode corresponding to the * event scancode and modifiers directly from the keyboard layout, bypassing * SDL_HINT_KEYCODE_OPTIONS, by calling SDL_GetKeyFromScancode(). * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GetKeyFromScancode * \sa SDL_HINT_KEYCODE_OPTIONS */ SDL_KeyboardEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with keyboard focus, if any */ which: SDL_KeyboardID; /**< The keyboard instance id, or 0 if unknown or virtual */ scancode: SDL_Scancode; /**< SDL physical key code */ key: SDL_Keycode; /**< SDL virtual key code */ mod: SDL_Keymod; /**< current key modifiers */ raw: Uint16; /**< The platform dependent scancode for this event */ down: bool; /**< true if the key is pressed */ repeat: bool; /**< true if this is a key repeat */ } /** * Keyboard text editing event structure (event.edit.*) * * The start cursor is the position, in UTF-8 characters, where new typing * will be inserted into the editing text. The length is the number of UTF-8 * characters that will be replaced by new typing. * * \since This struct is available since SDL 3.2.0. */ SDL_TextEditingEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_TEXT_EDITING */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with keyboard focus, if any */ text: *u8; /**< The editing text */ start: Sint32; /**< The start cursor of selected editing text, or -1 if not set */ length: Sint32; /**< The length of selected editing text, or -1 if not set */ } /** * Keyboard IME candidates event structure (event.edit_candidates.*) * * \since This struct is available since SDL 3.2.0. */ SDL_TextEditingCandidatesEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_TEXT_EDITING_CANDIDATES */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with keyboard focus, if any */ candidates: **u8; /**< The list of candidates, or NULL if there are no candidates available */ num_candidates: Sint32; /**< The number of strings in `candidates` */ selected_candidate: Sint32; /**< The index of the selected candidate, or -1 if no candidate is selected */ horizontal: bool; /**< true if the list is horizontal, false if it's vertical */ padding1: Uint8; padding2: Uint8; padding3: Uint8; } /** * Keyboard text input event structure (event.text.*) * * This event will never be delivered unless text input is enabled by calling * SDL_StartTextInput(). Text input is disabled by default! * * \since This struct is available since SDL 3.2.0. * * \sa SDL_StartTextInput * \sa SDL_StopTextInput */ SDL_TextInputEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_TEXT_INPUT */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with keyboard focus, if any */ text: *u8; /**< The input text, UTF-8 encoded */ } /** * Mouse device event structure (event.mdevice.*) * * \since This struct is available since SDL 3.2.0. */ SDL_MouseDeviceEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_MOUSE_ADDED or SDL_EVENT_MOUSE_REMOVED */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_MouseID; /**< The mouse instance id */ } /** * Mouse motion event structure (event.motion.*) * * \since This struct is available since SDL 3.2.0. */ SDL_MouseMotionEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_MOUSE_MOTION */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with mouse focus, if any */ which: SDL_MouseID; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0 */ state: SDL_MouseButtonFlags; /**< The current button state */ x: float; /**< X coordinate, relative to window */ y: float; /**< Y coordinate, relative to window */ xrel: float; /**< The relative motion in the X direction */ yrel: float; /**< The relative motion in the Y direction */ } /** * Mouse button event structure (event.button.*) * * \since This struct is available since SDL 3.2.0. */ SDL_MouseButtonEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_MOUSE_BUTTON_DOWN or SDL_EVENT_MOUSE_BUTTON_UP */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with mouse focus, if any */ which: SDL_MouseID; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0 */ button: Uint8; /**< The mouse button index */ down: bool; /**< true if the button is pressed */ clicks: Uint8; /**< 1 for single-click, 2 for double-click, etc. */ padding: Uint8; x: float; /**< X coordinate, relative to window */ y: float; /**< Y coordinate, relative to window */ } /** * Mouse wheel event structure (event.wheel.*) * * \since This struct is available since SDL 3.2.0. */ SDL_MouseWheelEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_MOUSE_WHEEL */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with mouse focus, if any */ which: SDL_MouseID; /**< The mouse instance id in relative mode or 0 */ x: float; /**< The amount scrolled horizontally, positive to the right and negative to the left */ y: float; /**< The amount scrolled vertically, positive away from the user and negative toward the user */ direction: SDL_MouseWheelDirection; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ mouse_x: float; /**< X coordinate, relative to window */ mouse_y: float; /**< Y coordinate, relative to window */ } /** * Joystick axis motion event structure (event.jaxis.*) * * \since This struct is available since SDL 3.2.0. */ SDL_JoyAxisEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_JOYSTICK_AXIS_MOTION */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ axis: Uint8; /**< The joystick axis index */ padding1: Uint8; padding2: Uint8; padding3: Uint8; value: Sint16; /**< The axis value (range: -32768 to 32767) */ padding4: Uint16; } /** * Joystick trackball motion event structure (event.jball.*) * * \since This struct is available since SDL 3.2.0. */ SDL_JoyBallEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_JOYSTICK_BALL_MOTION */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ ball: Uint8; /**< The joystick trackball index */ padding1: Uint8; padding2: Uint8; padding3: Uint8; xrel: Sint16; /**< The relative motion in the X direction */ yrel: Sint16; /**< The relative motion in the Y direction */ } /** * Joystick hat position change event structure (event.jhat.*) * * \since This struct is available since SDL 3.2.0. */ SDL_JoyHatEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_JOYSTICK_HAT_MOTION */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ hat: Uint8; /**< The joystick hat index */ /**< The hat position value. * \sa SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP * \sa SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT * \sa SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN * * Note that zero means the POV is centered. */ value: Uint8; padding1: Uint8; padding2: Uint8; } /** * Joystick button event structure (event.jbutton.*) * * \since This struct is available since SDL 3.2.0. */ SDL_JoyButtonEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_JOYSTICK_BUTTON_DOWN or SDL_EVENT_JOYSTICK_BUTTON_UP */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ button: Uint8; /**< The joystick button index */ down: bool; /**< true if the button is pressed */ padding1: Uint8; padding2: Uint8; } /** * Joystick device event structure (event.jdevice.*) * * SDL will send JOYSTICK_ADDED events for devices that are already plugged in * during SDL_Init. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GamepadDeviceEvent */ SDL_JoyDeviceEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_JOYSTICK_ADDED or SDL_EVENT_JOYSTICK_REMOVED or SDL_EVENT_JOYSTICK_UPDATE_COMPLETE */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ } /** * Joystick battery level change event structure (event.jbattery.*) * * \since This struct is available since SDL 3.2.0. */ SDL_JoyBatteryEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_JOYSTICK_BATTERY_UPDATED */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ state: SDL_PowerState; /**< The joystick battery state */ percent: s32; /**< The joystick battery percent charge remaining */ } /** * Gamepad axis motion event structure (event.gaxis.*) * * \since This struct is available since SDL 3.2.0. */ SDL_GamepadAxisEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_GAMEPAD_AXIS_MOTION */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ axis: Uint8; /**< The gamepad axis (SDL_GamepadAxis) */ padding1: Uint8; padding2: Uint8; padding3: Uint8; value: Sint16; /**< The axis value (range: -32768 to 32767) */ padding4: Uint16; } /** * Gamepad button event structure (event.gbutton.*) * * \since This struct is available since SDL 3.2.0. */ SDL_GamepadButtonEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_GAMEPAD_BUTTON_DOWN or SDL_EVENT_GAMEPAD_BUTTON_UP */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ button: Uint8; /**< The gamepad button (SDL_GamepadButton) */ down: bool; /**< true if the button is pressed */ padding1: Uint8; padding2: Uint8; } /** * Gamepad device event structure (event.gdevice.*) * * Joysticks that are supported gamepads receive both an SDL_JoyDeviceEvent * and an SDL_GamepadDeviceEvent. * * SDL will send GAMEPAD_ADDED events for joysticks that are already plugged * in during SDL_Init() and are recognized as gamepads. It will also send * events for joysticks that get gamepad mappings at runtime. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_JoyDeviceEvent */ SDL_GamepadDeviceEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_GAMEPAD_ADDED, SDL_EVENT_GAMEPAD_REMOVED, or SDL_EVENT_GAMEPAD_REMAPPED, SDL_EVENT_GAMEPAD_UPDATE_COMPLETE or SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ } /** * Gamepad touchpad event structure (event.gtouchpad.*) * * \since This struct is available since SDL 3.2.0. */ SDL_GamepadTouchpadEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or SDL_EVENT_GAMEPAD_TOUCHPAD_UP */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ touchpad: Sint32; /**< The index of the touchpad */ finger: Sint32; /**< The index of the finger on the touchpad */ x: float; /**< Normalized in the range 0...1 with 0 being on the left */ y: float; /**< Normalized in the range 0...1 with 0 being at the top */ pressure: float; /**< Normalized in the range 0...1 */ } /** * Gamepad sensor event structure (event.gsensor.*) * * \since This struct is available since SDL 3.2.0. */ SDL_GamepadSensorEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_GAMEPAD_SENSOR_UPDATE */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_JoystickID; /**< The joystick instance id */ sensor: Sint32; /**< The type of the sensor, one of the values of SDL_SensorType */ data: [3] float; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */ sensor_timestamp: Uint64; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */ } /** * Audio device event structure (event.adevice.*) * * \since This struct is available since SDL 3.2.0. */ SDL_AudioDeviceEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_AUDIO_DEVICE_ADDED, or SDL_EVENT_AUDIO_DEVICE_REMOVED, or SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_AudioDeviceID; /**< SDL_AudioDeviceID for the device being added or removed or changing */ recording: bool; /**< false if a playback device, true if a recording device. */ padding1: Uint8; padding2: Uint8; padding3: Uint8; } /** * Camera device event structure (event.cdevice.*) * * \since This struct is available since SDL 3.2.0. */ SDL_CameraDeviceEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, SDL_EVENT_CAMERA_DEVICE_DENIED */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_CameraID; /**< SDL_CameraID for the device being added or removed or changing */ } /** * Renderer event structure (event.render.*) * * \since This struct is available since SDL 3.2.0. */ SDL_RenderEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_RENDER_TARGETS_RESET, SDL_EVENT_RENDER_DEVICE_RESET, SDL_EVENT_RENDER_DEVICE_LOST */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window containing the renderer in question. */ } /** * Touch finger event structure (event.tfinger.*) * * Coordinates in this event are normalized. `x` and `y` are normalized to a * range between 0.0f and 1.0f, relative to the window, so (0,0) is the top * left and (1,1) is the bottom right. Delta coordinates `dx` and `dy` are * normalized in the ranges of -1.0f (traversed all the way from the bottom or * right to all the way up or left) to 1.0f (traversed all the way from the * top or left to all the way down or right). * * Note that while the coordinates are _normalized_, they are not _clamped_, * which means in some circumstances you can get a value outside of this * range. For example, a renderer using logical presentation might give a * negative value when the touch is in the letterboxing. Some platforms might * report a touch outside of the window, which will also be outside of the * range. * * \since This struct is available since SDL 3.2.0. */ SDL_TouchFingerEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_MOTION, or SDL_EVENT_FINGER_CANCELED */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ touchID: SDL_TouchID; /**< The touch device id */ fingerID: SDL_FingerID; x: float; /**< Normalized in the range 0...1 */ y: float; /**< Normalized in the range 0...1 */ dx: float; /**< Normalized in the range -1...1 */ dy: float; /**< Normalized in the range -1...1 */ pressure: float; /**< Normalized in the range 0...1 */ windowID: SDL_WindowID; /**< The window underneath the finger, if any */ } /** * Pressure-sensitive pen proximity event structure (event.pmotion.*) * * When a pen becomes visible to the system (it is close enough to a tablet, * etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's * ID. This ID is valid until the pen leaves proximity again (has been removed * from the tablet's area, the tablet has been unplugged, etc). If the same * pen reenters proximity again, it will be given a new ID. * * Note that "proximity" means "close enough for the tablet to know the tool * is there." The pen touching and lifting off from the tablet while not * leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP. * * \since This struct is available since SDL 3.2.0. */ SDL_PenProximityEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with pen focus, if any */ which: SDL_PenID; /**< The pen instance id */ } /** * Pressure-sensitive pen motion event structure (event.pmotion.*) * * Depending on the hardware, you may get motion events when the pen is not * touching a tablet, for tracking a pen even when it isn't drawing. You * should listen for SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP events, or check * `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when * dealing with pen motion. * * \since This struct is available since SDL 3.2.0. */ SDL_PenMotionEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_PEN_MOTION */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with pen focus, if any */ which: SDL_PenID; /**< The pen instance id */ pen_state: SDL_PenInputFlags; /**< Complete pen input state at time of event */ x: float; /**< X coordinate, relative to window */ y: float; /**< Y coordinate, relative to window */ } /** * Pressure-sensitive pen touched event structure (event.ptouch.*) * * These events come when a pen touches a surface (a tablet, etc), or lifts * off from one. * * \since This struct is available since SDL 3.2.0. */ SDL_PenTouchEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with pen focus, if any */ which: SDL_PenID; /**< The pen instance id */ pen_state: SDL_PenInputFlags; /**< Complete pen input state at time of event */ x: float; /**< X coordinate, relative to window */ y: float; /**< Y coordinate, relative to window */ eraser: bool; /**< true if eraser end is used (not all pens support this). */ down: bool; /**< true if the pen is touching or false if the pen is lifted off */ } /** * Pressure-sensitive pen button event structure (event.pbutton.*) * * This is for buttons on the pen itself that the user might click. The pen * itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead. * * \since This struct is available since SDL 3.2.0. */ SDL_PenButtonEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with mouse focus, if any */ which: SDL_PenID; /**< The pen instance id */ pen_state: SDL_PenInputFlags; /**< Complete pen input state at time of event */ x: float; /**< X coordinate, relative to window */ y: float; /**< Y coordinate, relative to window */ button: Uint8; /**< The pen button index (first button is 1). */ down: bool; /**< true if the button is pressed */ } /** * Pressure-sensitive pen pressure / angle event structure (event.paxis.*) * * You might get some of these events even if the pen isn't touching the * tablet. * * \since This struct is available since SDL 3.2.0. */ SDL_PenAxisEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_PEN_AXIS */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window with pen focus, if any */ which: SDL_PenID; /**< The pen instance id */ pen_state: SDL_PenInputFlags; /**< Complete pen input state at time of event */ x: float; /**< X coordinate, relative to window */ y: float; /**< Y coordinate, relative to window */ axis: SDL_PenAxis; /**< Axis that has changed */ value: float; /**< New value of axis */ } /** * An event used to drop text or request a file open by the system * (event.drop.*) * * \since This struct is available since SDL 3.2.0. */ SDL_DropEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_DROP_BEGIN or SDL_EVENT_DROP_FILE or SDL_EVENT_DROP_TEXT or SDL_EVENT_DROP_COMPLETE or SDL_EVENT_DROP_POSITION */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The window that was dropped on, if any */ x: float; /**< X coordinate, relative to window (not on begin) */ y: float; /**< Y coordinate, relative to window (not on begin) */ source: *u8; /**< The source app that sent this drop event, or NULL if that isn't available */ data: *u8; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */ } /** * An event triggered when the clipboard contents have changed * (event.clipboard.*) * * \since This struct is available since SDL 3.2.0. */ SDL_ClipboardEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_CLIPBOARD_UPDATE */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ owner: bool; /**< are we owning the clipboard (internal update) */ num_mime_types: Sint32; /**< number of mime types */ mime_types: **u8; /**< current mime types */ } /** * Sensor event structure (event.sensor.*) * * \since This struct is available since SDL 3.2.0. */ SDL_SensorEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_SENSOR_UPDATE */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ which: SDL_SensorID; /**< The instance ID of the sensor */ data: [6] float; /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */ sensor_timestamp: Uint64; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */ } /** * The "quit requested" event * * \since This struct is available since SDL 3.2.0. */ SDL_QuitEvent :: struct { type: SDL_EventType; /**< SDL_EVENT_QUIT */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ } /** * A user-defined event type (event.user.*) * * This event is unique; it is never created by SDL, but only by the * application. The event can be pushed onto the event queue using * SDL_PushEvent(). The contents of the structure members are completely up to * the programmer; the only requirement is that '''type''' is a value obtained * from SDL_RegisterEvents(). * * \since This struct is available since SDL 3.2.0. */ SDL_UserEvent :: struct { type: Uint32; /**< SDL_EVENT_USER through SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration */ reserved: Uint32; timestamp: Uint64; /**< In nanoseconds, populated using SDL_GetTicksNS() */ windowID: SDL_WindowID; /**< The associated window if any */ code: Sint32; /**< User defined event code */ data1: *void; /**< User defined data pointer */ data2: *void; /**< User defined data pointer */ } /** * The structure for all events in SDL. * * The SDL_Event structure is the core of all event handling in SDL. SDL_Event * is a union of all event structures used in SDL. * * \since This struct is available since SDL 3.2.0. */ SDL_Event :: union { type: SDL_EventType; /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */ common: SDL_CommonEvent; /**< Common event data */ display: SDL_DisplayEvent; /**< Display event data */ window: SDL_WindowEvent; /**< Window event data */ kdevice: SDL_KeyboardDeviceEvent; /**< Keyboard device change event data */ key: SDL_KeyboardEvent; /**< Keyboard event data */ edit: SDL_TextEditingEvent; /**< Text editing event data */ edit_candidates: SDL_TextEditingCandidatesEvent; /**< Text editing candidates event data */ text: SDL_TextInputEvent; /**< Text input event data */ mdevice: SDL_MouseDeviceEvent; /**< Mouse device change event data */ motion: SDL_MouseMotionEvent; /**< Mouse motion event data */ button: SDL_MouseButtonEvent; /**< Mouse button event data */ wheel: SDL_MouseWheelEvent; /**< Mouse wheel event data */ jdevice: SDL_JoyDeviceEvent; /**< Joystick device change event data */ jaxis: SDL_JoyAxisEvent; /**< Joystick axis event data */ jball: SDL_JoyBallEvent; /**< Joystick ball event data */ jhat: SDL_JoyHatEvent; /**< Joystick hat event data */ jbutton: SDL_JoyButtonEvent; /**< Joystick button event data */ jbattery: SDL_JoyBatteryEvent; /**< Joystick battery event data */ gdevice: SDL_GamepadDeviceEvent; /**< Gamepad device event data */ gaxis: SDL_GamepadAxisEvent; /**< Gamepad axis event data */ gbutton: SDL_GamepadButtonEvent; /**< Gamepad button event data */ gtouchpad: SDL_GamepadTouchpadEvent; /**< Gamepad touchpad event data */ gsensor: SDL_GamepadSensorEvent; /**< Gamepad sensor event data */ adevice: SDL_AudioDeviceEvent; /**< Audio device event data */ cdevice: SDL_CameraDeviceEvent; /**< Camera device event data */ sensor: SDL_SensorEvent; /**< Sensor event data */ quit: SDL_QuitEvent; /**< Quit request event data */ user: SDL_UserEvent; /**< Custom event data */ tfinger: SDL_TouchFingerEvent; /**< Touch finger event data */ pproximity: SDL_PenProximityEvent; /**< Pen proximity event data */ ptouch: SDL_PenTouchEvent; /**< Pen tip touching event data */ pmotion: SDL_PenMotionEvent; /**< Pen motion event data */ pbutton: SDL_PenButtonEvent; /**< Pen button event data */ paxis: SDL_PenAxisEvent; /**< Pen axis event data */ render: SDL_RenderEvent; /**< Render event data */ drop: SDL_DropEvent; /**< Drag and drop event data */ clipboard: SDL_ClipboardEvent; /**< Clipboard event data */ /* This is necessary for ABI compatibility between Visual C++ and GCC. Visual C++ will respect the push pack pragma and use 52 bytes (size of SDL_TextEditingEvent, the largest structure for 32-bit and 64-bit architectures) for this union, and GCC will use the alignment of the largest datatype within the union, which is 8 bytes on 64-bit architectures. So... we'll add padding to force the size to be the same for both. On architectures where pointers are 16 bytes, this needs rounding up to the next multiple of 16, 64, and on architectures where pointers are even larger the size of SDL_UserEvent will dominate as being 3 pointers. */ padding: [128] Uint8; } /** * Pump the event loop, gathering events from the input devices. * * This function updates the event queue and internal input device state. * * SDL_PumpEvents() gathers all the pending input information from devices and * places it in the event queue. Without calls to SDL_PumpEvents() no events * would ever be placed on the queue. Often the need for calls to * SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and * SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not * polling or waiting for events (e.g. you are filtering them), then you must * call SDL_PumpEvents() to force an event queue update. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_WaitEvent */ SDL_PumpEvents :: () -> void #foreign libsdl3; /** * The type of action to request from SDL_PeepEvents(). * * \since This enum is available since SDL 3.2.0. */ using SDL_EventAction :: enum u32 { SDL_ADDEVENT :: 0; SDL_PEEKEVENT :: 1; SDL_GETEVENT :: 2; } /** * Check the event queue for messages and optionally return them. * * `action` may be any of the following: * * - `SDL_ADDEVENT`: up to `numevents` events will be added to the back of the * event queue. * - `SDL_PEEKEVENT`: `numevents` events at the front of the event queue, * within the specified minimum and maximum type, will be returned to the * caller and will _not_ be removed from the queue. If you pass NULL for * `events`, then `numevents` is ignored and the total number of matching * events will be returned. * - `SDL_GETEVENT`: up to `numevents` events at the front of the event queue, * within the specified minimum and maximum type, will be returned to the * caller and will be removed from the queue. * * You may have to call SDL_PumpEvents() before calling this function. * Otherwise, the events may not be ready to be filtered when you call * SDL_PeepEvents(). * * \param events destination buffer for the retrieved events, may be NULL to * leave the events in the queue and return the number of events * that would have been stored. * \param numevents if action is SDL_ADDEVENT, the number of events to add * back to the event queue; if action is SDL_PEEKEVENT or * SDL_GETEVENT, the maximum number of events to retrieve. * \param action action to take; see [[#action|Remarks]] for details. * \param minType minimum value of the event type to be considered; * SDL_EVENT_FIRST is a safe choice. * \param maxType maximum value of the event type to be considered; * SDL_EVENT_LAST is a safe choice. * \returns the number of events actually stored or -1 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_PumpEvents * \sa SDL_PushEvent */ SDL_PeepEvents :: (events: *SDL_Event, numevents: s32, action: SDL_EventAction, minType: Uint32, maxType: Uint32) -> s32 #foreign libsdl3; /** * Check for the existence of a certain event type in the event queue. * * If you need to check for a range of event types, use SDL_HasEvents() * instead. * * \param type the type of event to be queried; see SDL_EventType for details. * \returns true if events matching `type` are present, or false if events * matching `type` are not present. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasEvents */ SDL_HasEvent :: (type: Uint32) -> bool #foreign libsdl3; /** * Check for the existence of certain event types in the event queue. * * If you need to check for a single event type, use SDL_HasEvent() instead. * * \param minType the low end of event type to be queried, inclusive; see * SDL_EventType for details. * \param maxType the high end of event type to be queried, inclusive; see * SDL_EventType for details. * \returns true if events with type >= `minType` and <= `maxType` are * present, or false if not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HasEvents */ SDL_HasEvents :: (minType: Uint32, maxType: Uint32) -> bool #foreign libsdl3; /** * Clear events of a specific type from the event queue. * * This will unconditionally remove any events from the queue that match * `type`. If you need to remove a range of event types, use SDL_FlushEvents() * instead. * * It's also normal to just ignore events you don't care about in your event * loop without calling this function. * * This function only affects currently queued events. If you want to make * sure that all pending OS events are flushed, you can call SDL_PumpEvents() * on the main thread immediately before the flush call. * * If you have user events with custom data that needs to be freed, you should * use SDL_PeepEvents() to remove and clean up those events before calling * this function. * * \param type the type of event to be cleared; see SDL_EventType for details. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_FlushEvents */ SDL_FlushEvent :: (type: Uint32) -> void #foreign libsdl3; /** * Clear events of a range of types from the event queue. * * This will unconditionally remove any events from the queue that are in the * range of `minType` to `maxType`, inclusive. If you need to remove a single * event type, use SDL_FlushEvent() instead. * * It's also normal to just ignore events you don't care about in your event * loop without calling this function. * * This function only affects currently queued events. If you want to make * sure that all pending OS events are flushed, you can call SDL_PumpEvents() * on the main thread immediately before the flush call. * * \param minType the low end of event type to be cleared, inclusive; see * SDL_EventType for details. * \param maxType the high end of event type to be cleared, inclusive; see * SDL_EventType for details. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_FlushEvent */ SDL_FlushEvents :: (minType: Uint32, maxType: Uint32) -> void #foreign libsdl3; /** * Poll for currently pending events. * * If `event` is not NULL, the next event is removed from the queue and stored * in the SDL_Event structure pointed to by `event`. The 1 returned refers to * this event, immediately stored in the SDL Event structure -- not an event * to follow. * * If `event` is NULL, it simply returns 1 if there is an event in the queue, * but will not remove it from the queue. * * As this function may implicitly call SDL_PumpEvents(), you can only call * this function in the thread that set the video mode. * * SDL_PollEvent() is the favored way of receiving system events since it can * be done from the main loop and does not suspend the main loop while waiting * on an event to be posted. * * The common practice is to fully process the event queue once every frame, * usually as a first step before updating the game's state: * * ```c * while (game_is_still_running) { * SDL_Event event; * while (SDL_PollEvent(&event)) { // poll until all events are handled! * // decide what to do with this event. * } * * // update game state, draw the current frame * } * ``` * * \param event the SDL_Event structure to be filled with the next event from * the queue, or NULL. * \returns true if this got an event or false if there are none available. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PushEvent * \sa SDL_WaitEvent * \sa SDL_WaitEventTimeout */ SDL_PollEvent :: (event: *SDL_Event) -> bool #foreign libsdl3; /** * Wait indefinitely for the next available event. * * If `event` is not NULL, the next event is removed from the queue and stored * in the SDL_Event structure pointed to by `event`. * * As this function may implicitly call SDL_PumpEvents(), you can only call * this function in the thread that initialized the video subsystem. * * \param event the SDL_Event structure to be filled in with the next event * from the queue, or NULL. * \returns true on success or false if there was an error while waiting for * events; call SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_PushEvent * \sa SDL_WaitEventTimeout */ SDL_WaitEvent :: (event: *SDL_Event) -> bool #foreign libsdl3; /** * Wait until the specified timeout (in milliseconds) for the next available * event. * * If `event` is not NULL, the next event is removed from the queue and stored * in the SDL_Event structure pointed to by `event`. * * As this function may implicitly call SDL_PumpEvents(), you can only call * this function in the thread that initialized the video subsystem. * * The timeout is not guaranteed, the actual wait time could be longer due to * system scheduling. * * \param event the SDL_Event structure to be filled in with the next event * from the queue, or NULL. * \param timeoutMS the maximum number of milliseconds to wait for the next * available event. * \returns true if this got an event or false if the timeout elapsed without * any events available. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_PushEvent * \sa SDL_WaitEvent */ SDL_WaitEventTimeout :: (event: *SDL_Event, timeoutMS: Sint32) -> bool #foreign libsdl3; /** * Add an event to the event queue. * * The event queue can actually be used as a two way communication channel. * Not only can events be read from the queue, but the user can also push * their own events onto it. `event` is a pointer to the event structure you * wish to push onto the queue. The event is copied into the queue, and the * caller may dispose of the memory pointed to after SDL_PushEvent() returns. * * Note: Pushing device input events onto the queue doesn't modify the state * of the device within SDL. * * Note: Events pushed onto the queue with SDL_PushEvent() get passed through * the event filter but events added with SDL_PeepEvents() do not. * * For pushing application-specific events, please use SDL_RegisterEvents() to * get an event type that does not conflict with other code that also wants * its own custom event types. * * \param event the SDL_Event to be added to the queue. * \returns true on success, false if the event was filtered or on failure; * call SDL_GetError() for more information. A common reason for * error is the event queue being full. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PeepEvents * \sa SDL_PollEvent * \sa SDL_RegisterEvents */ SDL_PushEvent :: (event: *SDL_Event) -> bool #foreign libsdl3; /** * A function pointer used for callbacks that watch the event queue. * * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or * SDL_AddEventWatch, etc. * \param event the event that triggered the callback. * \returns true to permit event to be added to the queue, and false to * disallow it. When used with SDL_AddEventWatch, the return value is * ignored. * * \threadsafety SDL may call this callback at any time from any thread; the * application is responsible for locking resources the callback * touches that need to be protected. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetEventFilter * \sa SDL_AddEventWatch */ SDL_EventFilter :: #type (userdata: *void, event: *SDL_Event) -> bool #c_call; /** * Set up a filter to process all events before they are added to the internal * event queue. * * If you just want to see events without modifying them or preventing them * from being queued, you should use SDL_AddEventWatch() instead. * * If the filter function returns true when called, then the event will be * added to the internal queue. If it returns false, then the event will be * dropped from the queue, but the internal state will still be updated. This * allows selective filtering of dynamically arriving events. * * **WARNING**: Be very careful of what you do in the event filter function, * as it may run in a different thread! * * On platforms that support it, if the quit event is generated by an * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the * application at the next event poll. * * Note: Disabled events never make it to the event filter function; see * SDL_SetEventEnabled(). * * Note: Events pushed onto the queue with SDL_PushEvent() get passed through * the event filter, but events pushed onto the queue with SDL_PeepEvents() do * not. * * \param filter an SDL_EventFilter function to call when an event happens. * \param userdata a pointer that is passed to `filter`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddEventWatch * \sa SDL_SetEventEnabled * \sa SDL_GetEventFilter * \sa SDL_PeepEvents * \sa SDL_PushEvent */ SDL_SetEventFilter :: (filter: SDL_EventFilter, userdata: *void) -> void #foreign libsdl3; /** * Query the current event filter. * * This function can be used to "chain" filters, by saving the existing filter * before replacing it with a function that will call that saved filter. * * \param filter the current callback function will be stored here. * \param userdata the pointer that is passed to the current event filter will * be stored here. * \returns true on success or false if there is no event filter set. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetEventFilter */ SDL_GetEventFilter :: (filter: *SDL_EventFilter, userdata: **void) -> bool #foreign libsdl3; /** * Add a callback to be triggered when an event is added to the event queue. * * `filter` will be called when an event happens, and its return value is * ignored. * * **WARNING**: Be very careful of what you do in the event filter function, * as it may run in a different thread! * * If the quit event is generated by a signal (e.g. SIGINT), it will bypass * the internal queue and be delivered to the watch callback immediately, and * arrive at the next event poll. * * Note: the callback is called for events posted by the user through * SDL_PushEvent(), but not for disabled events, nor for events by a filter * callback set with SDL_SetEventFilter(), nor for events posted by the user * through SDL_PeepEvents(). * * \param filter an SDL_EventFilter function to call when an event happens. * \param userdata a pointer that is passed to `filter`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RemoveEventWatch * \sa SDL_SetEventFilter */ SDL_AddEventWatch :: (filter: SDL_EventFilter, userdata: *void) -> bool #foreign libsdl3; /** * Remove an event watch callback added with SDL_AddEventWatch(). * * This function takes the same input as SDL_AddEventWatch() to identify and * delete the corresponding callback. * * \param filter the function originally passed to SDL_AddEventWatch(). * \param userdata the pointer originally passed to SDL_AddEventWatch(). * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddEventWatch */ SDL_RemoveEventWatch :: (filter: SDL_EventFilter, userdata: *void) -> void #foreign libsdl3; /** * Run a specific filter function on the current event queue, removing any * events for which the filter returns false. * * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(), * this function does not change the filter permanently, it only uses the * supplied filter until this function returns. * * \param filter the SDL_EventFilter function to call when an event happens. * \param userdata a pointer that is passed to `filter`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetEventFilter * \sa SDL_SetEventFilter */ SDL_FilterEvents :: (filter: SDL_EventFilter, userdata: *void) -> void #foreign libsdl3; /** * Set the state of processing events by type. * * \param type the type of event; see SDL_EventType for details. * \param enabled whether to process the event or not. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_EventEnabled */ SDL_SetEventEnabled :: (type: Uint32, enabled: bool) -> void #foreign libsdl3; /** * Query the state of processing events by type. * * \param type the type of event; see SDL_EventType for details. * \returns true if the event is being processed, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetEventEnabled */ SDL_EventEnabled :: (type: Uint32) -> bool #foreign libsdl3; /** * Allocate a set of user-defined events, and return the beginning event * number for that set of events. * * \param numevents the number of events to be allocated. * \returns the beginning event number, or 0 if numevents is invalid or if * there are not enough user-defined events left. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PushEvent */ SDL_RegisterEvents :: (numevents: s32) -> Uint32 #foreign libsdl3; /** * Get window associated with an event. * * \param event an event containing a `windowID`. * \returns the associated window on success or NULL if there is none. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PollEvent * \sa SDL_WaitEvent * \sa SDL_WaitEventTimeout */ SDL_GetWindowFromEvent :: (event: *SDL_Event) -> *SDL_Window #foreign libsdl3; /** * Get the directory where the application was run from. * * SDL caches the result of this call internally, but the first call to this * function is not necessarily fast, so plan accordingly. * * **macOS and iOS Specific Functionality**: If the application is in a ".app" * bundle, this function returns the Resource directory (e.g. * MyApp.app/Contents/Resources/). This behaviour can be overridden by adding * a property to the Info.plist file. Adding a string key with the name * SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the * behaviour. * * Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an * application in /Applications/SDLApp/MyApp.app): * * - `resource`: bundle resource directory (the default). For example: * `/Applications/SDLApp/MyApp.app/Contents/Resources` * - `bundle`: the Bundle directory. For example: * `/Applications/SDLApp/MyApp.app/` * - `parent`: the containing directory of the bundle. For example: * `/Applications/SDLApp/` * * **Nintendo 3DS Specific Functionality**: This function returns "romfs" * directory of the application as it is uncommon to store resources outside * the executable. As such it is not a writable directory. * * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * * \returns an absolute path in UTF-8 encoding to the application data * directory. NULL will be returned on error or when the platform * doesn't implement this functionality, call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPrefPath */ SDL_GetBasePath :: () -> *u8 #foreign libsdl3; /** * Get the user-and-app-specific path where files can be written. * * Get the "pref dir". This is meant to be where users can write personal * files (preferences and save games, etc) that are specific to your * application. This directory is unique per user, per application. * * This function will decide the appropriate location in the native * filesystem, create the directory if necessary, and return a string of the * absolute path to the directory in UTF-8 encoding. * * On Windows, the string might look like: * * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` * * On Linux, the string might look like: * * `/home/bob/.local/share/My Program Name/` * * On macOS, the string might look like: * * `/Users/bob/Library/Application Support/My Program Name/` * * You should assume the path returned by this function is the only safe place * to write files (and that SDL_GetBasePath(), while it might be writable, or * even the parent of the returned path, isn't where you should be writing * things). * * Both the org and app strings may become part of a directory name, so please * follow these rules: * * - Try to use the same org string (_including case-sensitivity_) for all * your applications that use this function. * - Always use a unique app string for each one, and make sure it never * changes for an app once you've decided on it. * - Unicode characters are legal, as long as they are UTF-8 encoded, but... * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. * * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * * \param org the name of your organization. * \param app the name of your application. * \returns a UTF-8 string of the user directory in platform-dependent * notation. NULL if there's a problem (creating directory failed, * etc.). This should be freed with SDL_free() when it is no longer * needed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetBasePath */ SDL_GetPrefPath :: (org: *u8, app: *u8) -> *u8 #foreign libsdl3; /** * The type of the OS-provided default folder for a specific purpose. * * Note that the Trash folder isn't included here, because trashing files * usually involves extra OS-specific functionality to remember the file's * original location. * * The folders supported per platform are: * * | | Windows | macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten | * | ----------- | ------- | --------- | ---- | ---------- | ----- | ---------- | * | HOME | X | X | | X | X | X | * | DESKTOP | X | X | | X | X | | * | DOCUMENTS | X | X | | X | | | * | DOWNLOADS | Vista+ | X | | X | | | * | MUSIC | X | X | | X | | | * | PICTURES | X | X | | X | | | * | PUBLICSHARE | | X | | X | | | * | SAVEDGAMES | Vista+ | | | | | | * | SCREENSHOTS | Vista+ | | | | | | * | TEMPLATES | X | X | | X | | | * | VIDEOS | X | X* | | X | | | * * Note that on macOS/iOS, the Videos folder is called "Movies". * * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetUserFolder */ using SDL_Folder :: enum u32 { SDL_FOLDER_HOME :: 0; SDL_FOLDER_DESKTOP :: 1; SDL_FOLDER_DOCUMENTS :: 2; SDL_FOLDER_DOWNLOADS :: 3; SDL_FOLDER_MUSIC :: 4; SDL_FOLDER_PICTURES :: 5; SDL_FOLDER_PUBLICSHARE :: 6; SDL_FOLDER_SAVEDGAMES :: 7; SDL_FOLDER_SCREENSHOTS :: 8; SDL_FOLDER_TEMPLATES :: 9; SDL_FOLDER_VIDEOS :: 10; SDL_FOLDER_COUNT :: 11; } /** * Finds the most suitable user folder for a specific purpose. * * Many OSes provide certain standard folders for certain purposes, such as * storing pictures, music or videos for a certain user. This function gives * the path for many of those special locations. * * This function is specifically for _user_ folders, which are meant for the * user to access and manage. For application-specific folders, meant to hold * data for the application to manage, see SDL_GetBasePath() and * SDL_GetPrefPath(). * * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * * If NULL is returned, the error may be obtained with SDL_GetError(). * * \param folder the type of folder to find. * \returns either a null-terminated C string containing the full path to the * folder, or NULL if an error happened. * * \since This function is available since SDL 3.2.0. */ SDL_GetUserFolder :: (folder: SDL_Folder) -> *u8 #foreign libsdl3; /** * Types of filesystem entries. * * Note that there may be other sorts of items on a filesystem: devices, * symlinks, named pipes, etc. They are currently reported as * SDL_PATHTYPE_OTHER. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_PathInfo */ using SDL_PathType :: enum u32 { SDL_PATHTYPE_NONE :: 0; SDL_PATHTYPE_FILE :: 1; SDL_PATHTYPE_DIRECTORY :: 2; SDL_PATHTYPE_OTHER :: 3; } /** * Information about a path on the filesystem. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GetPathInfo * \sa SDL_GetStoragePathInfo */ SDL_PathInfo :: struct { type: SDL_PathType; /**< the path type */ size: Uint64; /**< the file size in bytes */ create_time: SDL_Time; /**< the time when the path was created */ modify_time: SDL_Time; /**< the last time the path was modified */ access_time: SDL_Time; /**< the last time the path was read */ } /** * Flags for path matching. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_GlobDirectory * \sa SDL_GlobStorageDirectory */ SDL_GlobFlags :: Uint32; /** * Create a directory, and any missing parent directories. * * This reports success if `path` already exists as a directory. * * If parent directories are missing, it will also create them. Note that if * this fails, it will not remove any parent directories it already made. * * \param path the path of the directory to create. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_CreateDirectory :: (path: *u8) -> bool #foreign libsdl3; /** * Possible results from an enumeration callback. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_EnumerateDirectoryCallback */ using SDL_EnumerationResult :: enum u32 { SDL_ENUM_CONTINUE :: 0; SDL_ENUM_SUCCESS :: 1; SDL_ENUM_FAILURE :: 2; } /** * Callback for directory enumeration. * * Enumeration of directory entries will continue until either all entries * have been provided to the callback, or the callback has requested a stop * through its return value. * * Returning SDL_ENUM_CONTINUE will let enumeration proceed, calling the * callback with further entries. SDL_ENUM_SUCCESS and SDL_ENUM_FAILURE will * terminate the enumeration early, and dictate the return value of the * enumeration function itself. * * `dirname` is guaranteed to end with a path separator ('\\' on Windows, '/' * on most other platforms). * * \param userdata an app-controlled pointer that is passed to the callback. * \param dirname the directory that is being enumerated. * \param fname the next entry in the enumeration. * \returns how the enumeration should proceed. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_EnumerateDirectory */ SDL_EnumerateDirectoryCallback :: #type (userdata: *void, dirname: *u8, fname: *u8) -> SDL_EnumerationResult #c_call; /** * Enumerate a directory through a callback function. * * This function provides every directory entry through an app-provided * callback, called once for each directory entry, until all results have been * provided or the callback returns either SDL_ENUM_SUCCESS or * SDL_ENUM_FAILURE. * * This will return false if there was a system problem in general, or if a * callback returns SDL_ENUM_FAILURE. A successful return means a callback * returned SDL_ENUM_SUCCESS to halt enumeration, or all directory entries * were enumerated. * * \param path the path of the directory to enumerate. * \param callback a function that is called for each entry in the directory. * \param userdata a pointer that is passed to `callback`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_EnumerateDirectory :: (path: *u8, callback: SDL_EnumerateDirectoryCallback, userdata: *void) -> bool #foreign libsdl3; /** * Remove a file or an empty directory. * * Directories that are not empty will fail; this function will not recursely * delete directory trees. * * \param path the path to remove from the filesystem. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_RemovePath :: (path: *u8) -> bool #foreign libsdl3; /** * Rename a file or directory. * * If the file at `newpath` already exists, it will replaced. * * Note that this will not copy files across filesystems/drives/volumes, as * that is a much more complicated (and possibly time-consuming) operation. * * Which is to say, if this function fails, SDL_CopyFile() to a temporary file * in the same directory as `newpath`, then SDL_RenamePath() from the * temporary file to `newpath` and SDL_RemovePath() on `oldpath` might work * for files. Renaming a non-empty directory across filesystems is * dramatically more complex, however. * * \param oldpath the old path. * \param newpath the new path. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_RenamePath :: (oldpath: *u8, newpath: *u8) -> bool #foreign libsdl3; /** * Copy a file. * * If the file at `newpath` already exists, it will be overwritten with the * contents of the file at `oldpath`. * * This function will block until the copy is complete, which might be a * significant time for large files on slow disks. On some platforms, the copy * can be handed off to the OS itself, but on others SDL might just open both * paths, and read from one and write to the other. * * Note that this is not an atomic operation! If something tries to read from * `newpath` while the copy is in progress, it will see an incomplete copy of * the data, and if the calling thread terminates (or the power goes out) * during the copy, `newpath`'s previous contents will be gone, replaced with * an incomplete copy of the data. To avoid this risk, it is recommended that * the app copy to a temporary file in the same directory as `newpath`, and if * the copy is successful, use SDL_RenamePath() to replace `newpath` with the * temporary file. This will ensure that reads of `newpath` will either see a * complete copy of the data, or it will see the pre-copy state of `newpath`. * * This function attempts to synchronize the newly-copied data to disk before * returning, if the platform allows it, so that the renaming trick will not * have a problem in a system crash or power failure, where the file could be * renamed but the contents never made it from the system file cache to the * physical disk. * * If the copy fails for any reason, the state of `newpath` is undefined. It * might be half a copy, it might be the untouched data of what was already * there, or it might be a zero-byte file, etc. * * \param oldpath the old path. * \param newpath the new path. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_CopyFile :: (oldpath: *u8, newpath: *u8) -> bool #foreign libsdl3; /** * Get information about a filesystem path. * * \param path the path to query. * \param info a pointer filled in with information about the path, or NULL to * check for the existence of a file. * \returns true on success or false if the file doesn't exist, or another * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetPathInfo :: (path: *u8, info: *SDL_PathInfo) -> bool #foreign libsdl3; /** * Enumerate a directory tree, filtered by pattern, and return a list. * * Files are filtered out if they don't match the string in `pattern`, which * may contain wildcard characters '\*' (match everything) and '?' (match one * character). If pattern is NULL, no filtering is done and all results are * returned. Subdirectories are permitted, and are specified with a path * separator of '/'. Wildcard characters '\*' and '?' never match a path * separator. * * `flags` may be set to SDL_GLOB_CASEINSENSITIVE to make the pattern matching * case-insensitive. * * The returned array is always NULL-terminated, for your iterating * convenience, but if `count` is non-NULL, on return it will contain the * number of items in the array, not counting the NULL terminator. * * \param path the path of the directory to enumerate. * \param pattern the pattern that files in the directory must match. Can be * NULL. * \param flags `SDL_GLOB_*` bitflags that affect this search. * \param count on return, will be set to the number of items in the returned * array. Can be NULL. * \returns an array of strings on success or NULL on failure; call * SDL_GetError() for more information. This is a single allocation * that should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GlobDirectory :: (path: *u8, pattern: *u8, flags: SDL_GlobFlags, count: *s32) -> **u8 #foreign libsdl3; /** * Get what the system believes is the "current working directory." * * For systems without a concept of a current working directory, this will * still attempt to provide something reasonable. * * SDL does not provide a means to _change_ the current working directory; for * platforms without this concept, this would cause surprises with file access * outside of SDL. * * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * * \returns a UTF-8 string of the current working directory in * platform-dependent notation. NULL if there's a problem. This * should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. */ SDL_GetCurrentDirectory :: () -> *u8 #foreign libsdl3; SDL_GPUDevice :: struct {} SDL_GPUBuffer :: struct {} SDL_GPUTransferBuffer :: struct {} SDL_GPUTexture :: struct {} SDL_GPUSampler :: struct {} SDL_GPUShader :: struct {} SDL_GPUComputePipeline :: struct {} SDL_GPUGraphicsPipeline :: struct {} SDL_GPUCommandBuffer :: struct {} SDL_GPURenderPass :: struct {} SDL_GPUComputePass :: struct {} SDL_GPUCopyPass :: struct {} SDL_GPUFence :: struct {} /** * Specifies the primitive topology of a graphics pipeline. * * If you are using POINTLIST you must include a point size output in the * vertex shader. * * - For HLSL compiling to SPIRV you must decorate a float output with * [[vk::builtin("PointSize")]]. * - For GLSL you must set the gl_PointSize builtin. * - For MSL you must include a float output with the [[point_size]] * decorator. * * Note that sized point topology is totally unsupported on D3D12. Any size * other than 1 will be ignored. In general, you should avoid using point * topology for both compatibility and performance reasons. You WILL regret * using it. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUPrimitiveType :: enum u32 { SDL_GPU_PRIMITIVETYPE_TRIANGLELIST :: 0; SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP :: 1; SDL_GPU_PRIMITIVETYPE_LINELIST :: 2; SDL_GPU_PRIMITIVETYPE_LINESTRIP :: 3; SDL_GPU_PRIMITIVETYPE_POINTLIST :: 4; } /** * Specifies how the contents of a texture attached to a render pass are * treated at the beginning of the render pass. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass */ using SDL_GPULoadOp :: enum u32 { SDL_GPU_LOADOP_LOAD :: 0; SDL_GPU_LOADOP_CLEAR :: 1; SDL_GPU_LOADOP_DONT_CARE :: 2; } /** * Specifies how the contents of a texture attached to a render pass are * treated at the end of the render pass. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass */ using SDL_GPUStoreOp :: enum u32 { SDL_GPU_STOREOP_STORE :: 0; SDL_GPU_STOREOP_DONT_CARE :: 1; SDL_GPU_STOREOP_RESOLVE :: 2; SDL_GPU_STOREOP_RESOLVE_AND_STORE :: 3; } /** * Specifies the size of elements in an index buffer. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUIndexElementSize :: enum u32 { SDL_GPU_INDEXELEMENTSIZE_16BIT :: 0; SDL_GPU_INDEXELEMENTSIZE_32BIT :: 1; } /** * Specifies the pixel format of a texture. * * Texture format support varies depending on driver, hardware, and usage * flags. In general, you should use SDL_GPUTextureSupportsFormat to query if * a format is supported before using it. However, there are a few guaranteed * formats. * * FIXME: Check universal support for 32-bit component formats FIXME: Check * universal support for SIMULTANEOUS_READ_WRITE * * For SAMPLER usage, the following formats are universally supported: * * - R8G8B8A8_UNORM * - B8G8R8A8_UNORM * - R8_UNORM * - R8_SNORM * - R8G8_UNORM * - R8G8_SNORM * - R8G8B8A8_SNORM * - R16_FLOAT * - R16G16_FLOAT * - R16G16B16A16_FLOAT * - R32_FLOAT * - R32G32_FLOAT * - R32G32B32A32_FLOAT * - R11G11B10_UFLOAT * - R8G8B8A8_UNORM_SRGB * - B8G8R8A8_UNORM_SRGB * - D16_UNORM * * For COLOR_TARGET usage, the following formats are universally supported: * * - R8G8B8A8_UNORM * - B8G8R8A8_UNORM * - R8_UNORM * - R16_FLOAT * - R16G16_FLOAT * - R16G16B16A16_FLOAT * - R32_FLOAT * - R32G32_FLOAT * - R32G32B32A32_FLOAT * - R8_UINT * - R8G8_UINT * - R8G8B8A8_UINT * - R16_UINT * - R16G16_UINT * - R16G16B16A16_UINT * - R8_INT * - R8G8_INT * - R8G8B8A8_INT * - R16_INT * - R16G16_INT * - R16G16B16A16_INT * - R8G8B8A8_UNORM_SRGB * - B8G8R8A8_UNORM_SRGB * * For STORAGE usages, the following formats are universally supported: * * - R8G8B8A8_UNORM * - R8G8B8A8_SNORM * - R16G16B16A16_FLOAT * - R32_FLOAT * - R32G32_FLOAT * - R32G32B32A32_FLOAT * - R8G8B8A8_UINT * - R16G16B16A16_UINT * - R8G8B8A8_INT * - R16G16B16A16_INT * * For DEPTH_STENCIL_TARGET usage, the following formats are universally * supported: * * - D16_UNORM * - Either (but not necessarily both!) D24_UNORM or D32_FLOAT * - Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_FLOAT_S8_UINT * * Unless D16_UNORM is sufficient for your purposes, always check which of * D24/D32 is supported before creating a depth-stencil texture! * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureSupportsFormat */ using SDL_GPUTextureFormat :: enum u32 { SDL_GPU_TEXTUREFORMAT_INVALID :: 0; SDL_GPU_TEXTUREFORMAT_A8_UNORM :: 1; SDL_GPU_TEXTUREFORMAT_R8_UNORM :: 2; SDL_GPU_TEXTUREFORMAT_R8G8_UNORM :: 3; SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM :: 4; SDL_GPU_TEXTUREFORMAT_R16_UNORM :: 5; SDL_GPU_TEXTUREFORMAT_R16G16_UNORM :: 6; SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM :: 7; SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM :: 8; SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM :: 9; SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM :: 10; SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM :: 11; SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM :: 12; SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM :: 13; SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM :: 14; SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM :: 15; SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM :: 16; SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM :: 17; SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM :: 18; SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT :: 19; SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT :: 20; SDL_GPU_TEXTUREFORMAT_R8_SNORM :: 21; SDL_GPU_TEXTUREFORMAT_R8G8_SNORM :: 22; SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM :: 23; SDL_GPU_TEXTUREFORMAT_R16_SNORM :: 24; SDL_GPU_TEXTUREFORMAT_R16G16_SNORM :: 25; SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM :: 26; SDL_GPU_TEXTUREFORMAT_R16_FLOAT :: 27; SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT :: 28; SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT :: 29; SDL_GPU_TEXTUREFORMAT_R32_FLOAT :: 30; SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT :: 31; SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT :: 32; SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT :: 33; SDL_GPU_TEXTUREFORMAT_R8_UINT :: 34; SDL_GPU_TEXTUREFORMAT_R8G8_UINT :: 35; SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT :: 36; SDL_GPU_TEXTUREFORMAT_R16_UINT :: 37; SDL_GPU_TEXTUREFORMAT_R16G16_UINT :: 38; SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT :: 39; SDL_GPU_TEXTUREFORMAT_R32_UINT :: 40; SDL_GPU_TEXTUREFORMAT_R32G32_UINT :: 41; SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT :: 42; SDL_GPU_TEXTUREFORMAT_R8_INT :: 43; SDL_GPU_TEXTUREFORMAT_R8G8_INT :: 44; SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT :: 45; SDL_GPU_TEXTUREFORMAT_R16_INT :: 46; SDL_GPU_TEXTUREFORMAT_R16G16_INT :: 47; SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT :: 48; SDL_GPU_TEXTUREFORMAT_R32_INT :: 49; SDL_GPU_TEXTUREFORMAT_R32G32_INT :: 50; SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT :: 51; SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB :: 52; SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB :: 53; SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB :: 54; SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB :: 55; SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB :: 56; SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB :: 57; SDL_GPU_TEXTUREFORMAT_D16_UNORM :: 58; SDL_GPU_TEXTUREFORMAT_D24_UNORM :: 59; SDL_GPU_TEXTUREFORMAT_D32_FLOAT :: 60; SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT :: 61; SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT :: 62; SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM :: 63; SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM :: 64; SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM :: 65; SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM :: 66; SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM :: 67; SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM :: 68; SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM :: 69; SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM :: 70; SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM :: 71; SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM :: 72; SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM :: 73; SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM :: 74; SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM :: 75; SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM :: 76; SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB :: 77; SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB :: 78; SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB :: 79; SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB :: 80; SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB :: 81; SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB :: 82; SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB :: 83; SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB :: 84; SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB :: 85; SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB :: 86; SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB :: 87; SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB :: 88; SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB :: 89; SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB :: 90; SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT :: 91; SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT :: 92; SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT :: 93; SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT :: 94; SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT :: 95; SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT :: 96; SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT :: 97; SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT :: 98; SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT :: 99; SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT :: 100; SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT :: 101; SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT :: 102; SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT :: 103; SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT :: 104; } /** * Specifies how a texture is intended to be used by the client. * * A texture must have at least one usage flag. Note that some usage flag * combinations are invalid. * * With regards to compute storage usage, READ | WRITE means that you can have * shader A that only writes into the texture and shader B that only reads * from the texture and bind the same texture to either shader respectively. * SIMULTANEOUS means that you can do reads and writes within the same shader * or compute pass. It also implies that atomic ops can be used, since those * are read-modify-write operations. If you use SIMULTANEOUS, you are * responsible for avoiding data races, as there is no data synchronization * within a compute pass. Note that SIMULTANEOUS usage is only supported by a * limited number of texture formats. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture */ SDL_GPUTextureUsageFlags :: Uint32; /** * Specifies the type of a texture. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture */ using SDL_GPUTextureType :: enum u32 { SDL_GPU_TEXTURETYPE_2D :: 0; SDL_GPU_TEXTURETYPE_2D_ARRAY :: 1; SDL_GPU_TEXTURETYPE_3D :: 2; SDL_GPU_TEXTURETYPE_CUBE :: 3; SDL_GPU_TEXTURETYPE_CUBE_ARRAY :: 4; } /** * Specifies the sample count of a texture. * * Used in multisampling. Note that this value only applies when the texture * is used as a render target. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureSupportsSampleCount */ using SDL_GPUSampleCount :: enum u32 { SDL_GPU_SAMPLECOUNT_1 :: 0; SDL_GPU_SAMPLECOUNT_2 :: 1; SDL_GPU_SAMPLECOUNT_4 :: 2; SDL_GPU_SAMPLECOUNT_8 :: 3; } /** * Specifies the face of a cube map. * * Can be passed in as the layer field in texture-related structs. * * \since This enum is available since SDL 3.2.0. */ using SDL_GPUCubeMapFace :: enum u32 { SDL_GPU_CUBEMAPFACE_POSITIVEX :: 0; SDL_GPU_CUBEMAPFACE_NEGATIVEX :: 1; SDL_GPU_CUBEMAPFACE_POSITIVEY :: 2; SDL_GPU_CUBEMAPFACE_NEGATIVEY :: 3; SDL_GPU_CUBEMAPFACE_POSITIVEZ :: 4; SDL_GPU_CUBEMAPFACE_NEGATIVEZ :: 5; } /** * Specifies how a buffer is intended to be used by the client. * * A buffer must have at least one usage flag. Note that some usage flag * combinations are invalid. * * Unlike textures, READ | WRITE can be used for simultaneous read-write * usage. The same data synchronization concerns as textures apply. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUBuffer */ SDL_GPUBufferUsageFlags :: Uint32; /** * Specifies how a transfer buffer is intended to be used by the client. * * Note that mapping and copying FROM an upload transfer buffer or TO a * download transfer buffer is undefined behavior. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUTransferBuffer */ using SDL_GPUTransferBufferUsage :: enum u32 { SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD :: 0; SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD :: 1; } /** * Specifies which stage a shader program corresponds to. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader */ using SDL_GPUShaderStage :: enum u32 { SDL_GPU_SHADERSTAGE_VERTEX :: 0; SDL_GPU_SHADERSTAGE_FRAGMENT :: 1; } /** * Specifies the format of shader code. * * Each format corresponds to a specific backend that accepts it. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader */ SDL_GPUShaderFormat :: Uint32; /** * Specifies the format of a vertex attribute. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUVertexElementFormat :: enum u32 { SDL_GPU_VERTEXELEMENTFORMAT_INVALID :: 0; SDL_GPU_VERTEXELEMENTFORMAT_INT :: 1; SDL_GPU_VERTEXELEMENTFORMAT_INT2 :: 2; SDL_GPU_VERTEXELEMENTFORMAT_INT3 :: 3; SDL_GPU_VERTEXELEMENTFORMAT_INT4 :: 4; SDL_GPU_VERTEXELEMENTFORMAT_UINT :: 5; SDL_GPU_VERTEXELEMENTFORMAT_UINT2 :: 6; SDL_GPU_VERTEXELEMENTFORMAT_UINT3 :: 7; SDL_GPU_VERTEXELEMENTFORMAT_UINT4 :: 8; SDL_GPU_VERTEXELEMENTFORMAT_FLOAT :: 9; SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2 :: 10; SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3 :: 11; SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4 :: 12; SDL_GPU_VERTEXELEMENTFORMAT_BYTE2 :: 13; SDL_GPU_VERTEXELEMENTFORMAT_BYTE4 :: 14; SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2 :: 15; SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4 :: 16; SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM :: 17; SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM :: 18; SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM :: 19; SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM :: 20; SDL_GPU_VERTEXELEMENTFORMAT_SHORT2 :: 21; SDL_GPU_VERTEXELEMENTFORMAT_SHORT4 :: 22; SDL_GPU_VERTEXELEMENTFORMAT_USHORT2 :: 23; SDL_GPU_VERTEXELEMENTFORMAT_USHORT4 :: 24; SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM :: 25; SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM :: 26; SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM :: 27; SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM :: 28; SDL_GPU_VERTEXELEMENTFORMAT_HALF2 :: 29; SDL_GPU_VERTEXELEMENTFORMAT_HALF4 :: 30; } /** * Specifies the rate at which vertex attributes are pulled from buffers. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUVertexInputRate :: enum u32 { SDL_GPU_VERTEXINPUTRATE_VERTEX :: 0; SDL_GPU_VERTEXINPUTRATE_INSTANCE :: 1; } /** * Specifies the fill mode of the graphics pipeline. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUFillMode :: enum u32 { SDL_GPU_FILLMODE_FILL :: 0; SDL_GPU_FILLMODE_LINE :: 1; } /** * Specifies the facing direction in which triangle faces will be culled. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUCullMode :: enum u32 { SDL_GPU_CULLMODE_NONE :: 0; SDL_GPU_CULLMODE_FRONT :: 1; SDL_GPU_CULLMODE_BACK :: 2; } /** * Specifies the vertex winding that will cause a triangle to be determined to * be front-facing. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUFrontFace :: enum u32 { SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE :: 0; SDL_GPU_FRONTFACE_CLOCKWISE :: 1; } /** * Specifies a comparison operator for depth, stencil and sampler operations. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUCompareOp :: enum u32 { SDL_GPU_COMPAREOP_INVALID :: 0; SDL_GPU_COMPAREOP_NEVER :: 1; SDL_GPU_COMPAREOP_LESS :: 2; SDL_GPU_COMPAREOP_EQUAL :: 3; SDL_GPU_COMPAREOP_LESS_OR_EQUAL :: 4; SDL_GPU_COMPAREOP_GREATER :: 5; SDL_GPU_COMPAREOP_NOT_EQUAL :: 6; SDL_GPU_COMPAREOP_GREATER_OR_EQUAL :: 7; SDL_GPU_COMPAREOP_ALWAYS :: 8; } /** * Specifies what happens to a stored stencil value if stencil tests fail or * pass. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUStencilOp :: enum u32 { SDL_GPU_STENCILOP_INVALID :: 0; SDL_GPU_STENCILOP_KEEP :: 1; SDL_GPU_STENCILOP_ZERO :: 2; SDL_GPU_STENCILOP_REPLACE :: 3; SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP :: 4; SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP :: 5; SDL_GPU_STENCILOP_INVERT :: 6; SDL_GPU_STENCILOP_INCREMENT_AND_WRAP :: 7; SDL_GPU_STENCILOP_DECREMENT_AND_WRAP :: 8; } /** * Specifies the operator to be used when pixels in a render target are * blended with existing pixels in the texture. * * The source color is the value written by the fragment shader. The * destination color is the value currently existing in the texture. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUBlendOp :: enum u32 { SDL_GPU_BLENDOP_INVALID :: 0; SDL_GPU_BLENDOP_ADD :: 1; SDL_GPU_BLENDOP_SUBTRACT :: 2; SDL_GPU_BLENDOP_REVERSE_SUBTRACT :: 3; SDL_GPU_BLENDOP_MIN :: 4; SDL_GPU_BLENDOP_MAX :: 5; } /** * Specifies a blending factor to be used when pixels in a render target are * blended with existing pixels in the texture. * * The source color is the value written by the fragment shader. The * destination color is the value currently existing in the texture. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ using SDL_GPUBlendFactor :: enum u32 { SDL_GPU_BLENDFACTOR_INVALID :: 0; SDL_GPU_BLENDFACTOR_ZERO :: 1; SDL_GPU_BLENDFACTOR_ONE :: 2; SDL_GPU_BLENDFACTOR_SRC_COLOR :: 3; SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR :: 4; SDL_GPU_BLENDFACTOR_DST_COLOR :: 5; SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR :: 6; SDL_GPU_BLENDFACTOR_SRC_ALPHA :: 7; SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA :: 8; SDL_GPU_BLENDFACTOR_DST_ALPHA :: 9; SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA :: 10; SDL_GPU_BLENDFACTOR_CONSTANT_COLOR :: 11; SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR :: 12; SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE :: 13; } /** * Specifies which color components are written in a graphics pipeline. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline */ SDL_GPUColorComponentFlags :: Uint8; /** * Specifies a filter operation used by a sampler. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler */ using SDL_GPUFilter :: enum u32 { SDL_GPU_FILTER_NEAREST :: 0; SDL_GPU_FILTER_LINEAR :: 1; } /** * Specifies a mipmap mode used by a sampler. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler */ using SDL_GPUSamplerMipmapMode :: enum u32 { SDL_GPU_SAMPLERMIPMAPMODE_NEAREST :: 0; SDL_GPU_SAMPLERMIPMAPMODE_LINEAR :: 1; } /** * Specifies behavior of texture sampling when the coordinates exceed the 0-1 * range. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler */ using SDL_GPUSamplerAddressMode :: enum u32 { SDL_GPU_SAMPLERADDRESSMODE_REPEAT :: 0; SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT :: 1; SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE :: 2; } /** * Specifies the timing that will be used to present swapchain textures to the * OS. * * VSYNC mode will always be supported. IMMEDIATE and MAILBOX modes may not be * supported on certain systems. * * It is recommended to query SDL_WindowSupportsGPUPresentMode after claiming * the window if you wish to change the present mode to IMMEDIATE or MAILBOX. * * - VSYNC: Waits for vblank before presenting. No tearing is possible. If * there is a pending image to present, the new image is enqueued for * presentation. Disallows tearing at the cost of visual latency. * - IMMEDIATE: Immediately presents. Lowest latency option, but tearing may * occur. * - MAILBOX: Waits for vblank before presenting. No tearing is possible. If * there is a pending image to present, the pending image is replaced by the * new image. Similar to VSYNC, but with reduced visual latency. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_SetGPUSwapchainParameters * \sa SDL_WindowSupportsGPUPresentMode * \sa SDL_WaitAndAcquireGPUSwapchainTexture */ using SDL_GPUPresentMode :: enum u32 { SDL_GPU_PRESENTMODE_VSYNC :: 0; SDL_GPU_PRESENTMODE_IMMEDIATE :: 1; SDL_GPU_PRESENTMODE_MAILBOX :: 2; } /** * Specifies the texture format and colorspace of the swapchain textures. * * SDR will always be supported. Other compositions may not be supported on * certain systems. * * It is recommended to query SDL_WindowSupportsGPUSwapchainComposition after * claiming the window if you wish to change the swapchain composition from * SDR. * * - SDR: B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in sRGB encoding. * - SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are * stored in memory in sRGB encoding but accessed in shaders in "linear * sRGB" encoding which is sRGB but with a linear transfer function. * - HDR_EXTENDED_LINEAR: R16G16B16A16_FLOAT swapchain. Pixel values are in * extended linear sRGB encoding and permits values outside of the [0, 1] * range. * - HDR10_ST2084: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in * BT.2020 ST2084 (PQ) encoding. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_SetGPUSwapchainParameters * \sa SDL_WindowSupportsGPUSwapchainComposition * \sa SDL_WaitAndAcquireGPUSwapchainTexture */ using SDL_GPUSwapchainComposition :: enum u32 { SDL_GPU_SWAPCHAINCOMPOSITION_SDR :: 0; SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR :: 1; SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR :: 2; SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084 :: 3; } /** * A structure specifying a viewport. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_SetGPUViewport */ SDL_GPUViewport :: struct { x: float; /**< The left offset of the viewport. */ y: float; /**< The top offset of the viewport. */ w: float; /**< The width of the viewport. */ h: float; /**< The height of the viewport. */ min_depth: float; /**< The minimum depth of the viewport. */ max_depth: float; /**< The maximum depth of the viewport. */ } /** * A structure specifying parameters related to transferring data to or from a * texture. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture */ SDL_GPUTextureTransferInfo :: struct { transfer_buffer: *SDL_GPUTransferBuffer; /**< The transfer buffer used in the transfer operation. */ offset: Uint32; /**< The starting byte of the image data in the transfer buffer. */ pixels_per_row: Uint32; /**< The number of pixels from one row to the next. */ rows_per_layer: Uint32; /**< The number of rows from one layer/depth-slice to the next. */ } /** * A structure specifying a location in a transfer buffer. * * Used when transferring buffer data to or from a transfer buffer. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer */ SDL_GPUTransferBufferLocation :: struct { transfer_buffer: *SDL_GPUTransferBuffer; /**< The transfer buffer used in the transfer operation. */ offset: Uint32; /**< The starting byte of the buffer data in the transfer buffer. */ } /** * A structure specifying a location in a texture. * * Used when copying data from one texture to another. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CopyGPUTextureToTexture */ SDL_GPUTextureLocation :: struct { texture: *SDL_GPUTexture; /**< The texture used in the copy operation. */ mip_level: Uint32; /**< The mip level index of the location. */ layer: Uint32; /**< The layer index of the location. */ x: Uint32; /**< The left offset of the location. */ y: Uint32; /**< The top offset of the location. */ z: Uint32; /**< The front offset of the location. */ } /** * A structure specifying a region of a texture. * * Used when transferring data to or from a texture. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture */ SDL_GPUTextureRegion :: struct { texture: *SDL_GPUTexture; /**< The texture used in the copy operation. */ mip_level: Uint32; /**< The mip level index to transfer. */ layer: Uint32; /**< The layer index to transfer. */ x: Uint32; /**< The left offset of the region. */ y: Uint32; /**< The top offset of the region. */ z: Uint32; /**< The front offset of the region. */ w: Uint32; /**< The width of the region. */ h: Uint32; /**< The height of the region. */ d: Uint32; /**< The depth of the region. */ } /** * A structure specifying a region of a texture used in the blit operation. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_BlitGPUTexture */ SDL_GPUBlitRegion :: struct { texture: *SDL_GPUTexture; /**< The texture. */ mip_level: Uint32; /**< The mip level index of the region. */ layer_or_depth_plane: Uint32; /**< The layer index or depth plane of the region. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures. */ x: Uint32; /**< The left offset of the region. */ y: Uint32; /**< The top offset of the region. */ w: Uint32; /**< The width of the region. */ h: Uint32; /**< The height of the region. */ } /** * A structure specifying a location in a buffer. * * Used when copying data between buffers. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CopyGPUBufferToBuffer */ SDL_GPUBufferLocation :: struct { buffer: *SDL_GPUBuffer; /**< The buffer. */ offset: Uint32; /**< The starting byte within the buffer. */ } /** * A structure specifying a region of a buffer. * * Used when transferring data to or from buffers. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer */ SDL_GPUBufferRegion :: struct { buffer: *SDL_GPUBuffer; /**< The buffer. */ offset: Uint32; /**< The starting byte within the buffer. */ size: Uint32; /**< The size in bytes of the region. */ } /** * A structure specifying the parameters of an indirect draw command. * * Note that the `first_vertex` and `first_instance` parameters are NOT * compatible with built-in vertex/instance ID variables in shaders (for * example, SV_VertexID); GPU APIs and shader languages do not define these * built-in variables consistently, so if your shader depends on them, the * only way to keep behavior consistent and portable is to always pass 0 for * the correlating parameter in the draw calls. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_DrawGPUPrimitivesIndirect */ SDL_GPUIndirectDrawCommand :: struct { num_vertices: Uint32; /**< The number of vertices to draw. */ num_instances: Uint32; /**< The number of instances to draw. */ first_vertex: Uint32; /**< The index of the first vertex to draw. */ first_instance: Uint32; /**< The ID of the first instance to draw. */ } /** * A structure specifying the parameters of an indexed indirect draw command. * * Note that the `first_vertex` and `first_instance` parameters are NOT * compatible with built-in vertex/instance ID variables in shaders (for * example, SV_VertexID); GPU APIs and shader languages do not define these * built-in variables consistently, so if your shader depends on them, the * only way to keep behavior consistent and portable is to always pass 0 for * the correlating parameter in the draw calls. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_DrawGPUIndexedPrimitivesIndirect */ SDL_GPUIndexedIndirectDrawCommand :: struct { num_indices: Uint32; /**< The number of indices to draw per instance. */ num_instances: Uint32; /**< The number of instances to draw. */ first_index: Uint32; /**< The base index within the index buffer. */ vertex_offset: Sint32; /**< The value added to the vertex index before indexing into the vertex buffer. */ first_instance: Uint32; /**< The ID of the first instance to draw. */ } /** * A structure specifying the parameters of an indexed dispatch command. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_DispatchGPUComputeIndirect */ SDL_GPUIndirectDispatchCommand :: struct { groupcount_x: Uint32; /**< The number of local workgroups to dispatch in the X dimension. */ groupcount_y: Uint32; /**< The number of local workgroups to dispatch in the Y dimension. */ groupcount_z: Uint32; /**< The number of local workgroups to dispatch in the Z dimension. */ } /** * A structure specifying the parameters of a sampler. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUSampler */ SDL_GPUSamplerCreateInfo :: struct { min_filter: SDL_GPUFilter; /**< The minification filter to apply to lookups. */ mag_filter: SDL_GPUFilter; /**< The magnification filter to apply to lookups. */ mipmap_mode: SDL_GPUSamplerMipmapMode; /**< The mipmap filter to apply to lookups. */ address_mode_u: SDL_GPUSamplerAddressMode; /**< The addressing mode for U coordinates outside [0, 1). */ address_mode_v: SDL_GPUSamplerAddressMode; /**< The addressing mode for V coordinates outside [0, 1). */ address_mode_w: SDL_GPUSamplerAddressMode; /**< The addressing mode for W coordinates outside [0, 1). */ mip_lod_bias: float; /**< The bias to be added to mipmap LOD calculation. */ max_anisotropy: float; /**< The anisotropy value clamp used by the sampler. If enable_anisotropy is false, this is ignored. */ compare_op: SDL_GPUCompareOp; /**< The comparison operator to apply to fetched data before filtering. */ min_lod: float; /**< Clamps the minimum of the computed LOD value. */ max_lod: float; /**< Clamps the maximum of the computed LOD value. */ enable_anisotropy: bool; /**< true to enable anisotropic filtering. */ enable_compare: bool; /**< true to enable comparison against a reference value during lookups. */ padding1: Uint8; padding2: Uint8; props: SDL_PropertiesID; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } /** * A structure specifying the parameters of vertex buffers used in a graphics * pipeline. * * When you call SDL_BindGPUVertexBuffers, you specify the binding slots of * the vertex buffers. For example if you called SDL_BindGPUVertexBuffers with * a first_slot of 2 and num_bindings of 3, the binding slots 2, 3, 4 would be * used by the vertex buffers you pass in. * * Vertex attributes are linked to buffers via the buffer_slot field of * SDL_GPUVertexAttribute. For example, if an attribute has a buffer_slot of * 0, then that attribute belongs to the vertex buffer bound at slot 0. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUVertexAttribute * \sa SDL_GPUVertexInputState */ SDL_GPUVertexBufferDescription :: struct { slot: Uint32; /**< The binding slot of the vertex buffer. */ pitch: Uint32; /**< The byte pitch between consecutive elements of the vertex buffer. */ input_rate: SDL_GPUVertexInputRate; /**< Whether attribute addressing is a function of the vertex index or instance index. */ instance_step_rate: Uint32; /**< The number of instances to draw using the same per-instance data before advancing in the instance buffer by one element. Ignored unless input_rate is SDL_GPU_VERTEXINPUTRATE_INSTANCE */ } /** * A structure specifying a vertex attribute. * * All vertex attribute locations provided to an SDL_GPUVertexInputState must * be unique. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUVertexBufferDescription * \sa SDL_GPUVertexInputState */ SDL_GPUVertexAttribute :: struct { location: Uint32; /**< The shader input location index. */ buffer_slot: Uint32; /**< The binding slot of the associated vertex buffer. */ format: SDL_GPUVertexElementFormat; /**< The size and type of the attribute data. */ offset: Uint32; /**< The byte offset of this attribute relative to the start of the vertex element. */ } /** * A structure specifying the parameters of a graphics pipeline vertex input * state. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo * \sa SDL_GPUVertexBufferDescription * \sa SDL_GPUVertexAttribute */ SDL_GPUVertexInputState :: struct { vertex_buffer_descriptions: *SDL_GPUVertexBufferDescription; /**< A pointer to an array of vertex buffer descriptions. */ num_vertex_buffers: Uint32; /**< The number of vertex buffer descriptions in the above array. */ vertex_attributes: *SDL_GPUVertexAttribute; /**< A pointer to an array of vertex attribute descriptions. */ num_vertex_attributes: Uint32; /**< The number of vertex attribute descriptions in the above array. */ } /** * A structure specifying the stencil operation state of a graphics pipeline. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUDepthStencilState */ SDL_GPUStencilOpState :: struct { fail_op: SDL_GPUStencilOp; /**< The action performed on samples that fail the stencil test. */ pass_op: SDL_GPUStencilOp; /**< The action performed on samples that pass the depth and stencil tests. */ depth_fail_op: SDL_GPUStencilOp; /**< The action performed on samples that pass the stencil test and fail the depth test. */ compare_op: SDL_GPUCompareOp; /**< The comparison operator used in the stencil test. */ } /** * A structure specifying the blend state of a color target. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUColorTargetDescription */ SDL_GPUColorTargetBlendState :: struct { src_color_blendfactor: SDL_GPUBlendFactor; /**< The value to be multiplied by the source RGB value. */ dst_color_blendfactor: SDL_GPUBlendFactor; /**< The value to be multiplied by the destination RGB value. */ color_blend_op: SDL_GPUBlendOp; /**< The blend operation for the RGB components. */ src_alpha_blendfactor: SDL_GPUBlendFactor; /**< The value to be multiplied by the source alpha. */ dst_alpha_blendfactor: SDL_GPUBlendFactor; /**< The value to be multiplied by the destination alpha. */ alpha_blend_op: SDL_GPUBlendOp; /**< The blend operation for the alpha component. */ color_write_mask: SDL_GPUColorComponentFlags; /**< A bitmask specifying which of the RGBA components are enabled for writing. Writes to all channels if enable_color_write_mask is false. */ enable_blend: bool; /**< Whether blending is enabled for the color target. */ enable_color_write_mask: bool; /**< Whether the color write mask is enabled. */ padding1: Uint8; padding2: Uint8; } /** * A structure specifying code and metadata for creating a shader object. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader */ SDL_GPUShaderCreateInfo :: struct { code_size: u64; /**< The size in bytes of the code pointed to. */ code: *Uint8; /**< A pointer to shader code. */ entrypoint: *u8; /**< A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. */ format: SDL_GPUShaderFormat; /**< The format of the shader code. */ stage: SDL_GPUShaderStage; /**< The stage the shader program corresponds to. */ num_samplers: Uint32; /**< The number of samplers defined in the shader. */ num_storage_textures: Uint32; /**< The number of storage textures defined in the shader. */ num_storage_buffers: Uint32; /**< The number of storage buffers defined in the shader. */ num_uniform_buffers: Uint32; /**< The number of uniform buffers defined in the shader. */ props: SDL_PropertiesID; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } /** * A structure specifying the parameters of a texture. * * Usage flags can be bitwise OR'd together for combinations of usages. Note * that certain usage combinations are invalid, for example SAMPLER and * GRAPHICS_STORAGE. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture * \sa SDL_GPUTextureType * \sa SDL_GPUTextureFormat * \sa SDL_GPUTextureUsageFlags * \sa SDL_GPUSampleCount */ SDL_GPUTextureCreateInfo :: struct { type: SDL_GPUTextureType; /**< The base dimensionality of the texture. */ format: SDL_GPUTextureFormat; /**< The pixel format of the texture. */ usage: SDL_GPUTextureUsageFlags; /**< How the texture is intended to be used by the client. */ width: Uint32; /**< The width of the texture. */ height: Uint32; /**< The height of the texture. */ layer_count_or_depth: Uint32; /**< The layer count or depth of the texture. This value is treated as a layer count on 2D array textures, and as a depth value on 3D textures. */ num_levels: Uint32; /**< The number of mip levels in the texture. */ sample_count: SDL_GPUSampleCount; /**< The number of samples per texel. Only applies if the texture is used as a render target. */ props: SDL_PropertiesID; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } /** * A structure specifying the parameters of a buffer. * * Usage flags can be bitwise OR'd together for combinations of usages. Note * that certain combinations are invalid, for example VERTEX and INDEX. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUBuffer * \sa SDL_GPUBufferUsageFlags */ SDL_GPUBufferCreateInfo :: struct { usage: SDL_GPUBufferUsageFlags; /**< How the buffer is intended to be used by the client. */ size: Uint32; /**< The size in bytes of the buffer. */ props: SDL_PropertiesID; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } /** * A structure specifying the parameters of a transfer buffer. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUTransferBuffer */ SDL_GPUTransferBufferCreateInfo :: struct { usage: SDL_GPUTransferBufferUsage; /**< How the transfer buffer is intended to be used by the client. */ size: Uint32; /**< The size in bytes of the transfer buffer. */ props: SDL_PropertiesID; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } /** * A structure specifying the parameters of the graphics pipeline rasterizer * state. * * NOTE: Some backend APIs (D3D11/12) will enable depth clamping even if * enable_depth_clip is true. If you rely on this clamp+clip behavior, * consider enabling depth clip and then manually clamping depth in your * fragment shaders on Metal and Vulkan. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo */ SDL_GPURasterizerState :: struct { fill_mode: SDL_GPUFillMode; /**< Whether polygons will be filled in or drawn as lines. */ cull_mode: SDL_GPUCullMode; /**< The facing direction in which triangles will be culled. */ front_face: SDL_GPUFrontFace; /**< The vertex winding that will cause a triangle to be determined as front-facing. */ depth_bias_constant_factor: float; /**< A scalar factor controlling the depth value added to each fragment. */ depth_bias_clamp: float; /**< The maximum depth bias of a fragment. */ depth_bias_slope_factor: float; /**< A scalar factor applied to a fragment's slope in depth calculations. */ enable_depth_bias: bool; /**< true to bias fragment depth values. */ enable_depth_clip: bool; /**< true to enable depth clip, false to enable depth clamp. */ padding1: Uint8; padding2: Uint8; } /** * A structure specifying the parameters of the graphics pipeline multisample * state. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo */ SDL_GPUMultisampleState :: struct { sample_count: SDL_GPUSampleCount; /**< The number of samples to be used in rasterization. */ sample_mask: Uint32; /**< Determines which samples get updated in the render targets. Treated as 0xFFFFFFFF if enable_mask is false. */ enable_mask: bool; /**< Enables sample masking. */ padding1: Uint8; padding2: Uint8; padding3: Uint8; } /** * A structure specifying the parameters of the graphics pipeline depth * stencil state. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo */ SDL_GPUDepthStencilState :: struct { compare_op: SDL_GPUCompareOp; /**< The comparison operator used for depth testing. */ back_stencil_state: SDL_GPUStencilOpState; /**< The stencil op state for back-facing triangles. */ front_stencil_state: SDL_GPUStencilOpState; /**< The stencil op state for front-facing triangles. */ compare_mask: Uint8; /**< Selects the bits of the stencil values participating in the stencil test. */ write_mask: Uint8; /**< Selects the bits of the stencil values updated by the stencil test. */ enable_depth_test: bool; /**< true enables the depth test. */ enable_depth_write: bool; /**< true enables depth writes. Depth writes are always disabled when enable_depth_test is false. */ enable_stencil_test: bool; /**< true enables the stencil test. */ padding1: Uint8; padding2: Uint8; padding3: Uint8; } /** * A structure specifying the parameters of color targets used in a graphics * pipeline. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineTargetInfo */ SDL_GPUColorTargetDescription :: struct { format: SDL_GPUTextureFormat; /**< The pixel format of the texture to be used as a color target. */ blend_state: SDL_GPUColorTargetBlendState; /**< The blend state to be used for the color target. */ } /** * A structure specifying the descriptions of render targets used in a * graphics pipeline. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_GPUGraphicsPipelineCreateInfo */ SDL_GPUGraphicsPipelineTargetInfo :: struct { color_target_descriptions: *SDL_GPUColorTargetDescription; /**< A pointer to an array of color target descriptions. */ num_color_targets: Uint32; /**< The number of color target descriptions in the above array. */ depth_stencil_format: SDL_GPUTextureFormat; /**< The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false. */ has_depth_stencil_target: bool; /**< true specifies that the pipeline uses a depth-stencil target. */ padding1: Uint8; padding2: Uint8; padding3: Uint8; } /** * A structure specifying the parameters of a graphics pipeline state. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline * \sa SDL_GPUVertexInputState * \sa SDL_GPUPrimitiveType * \sa SDL_GPURasterizerState * \sa SDL_GPUMultisampleState * \sa SDL_GPUDepthStencilState * \sa SDL_GPUGraphicsPipelineTargetInfo */ SDL_GPUGraphicsPipelineCreateInfo :: struct { vertex_shader: *SDL_GPUShader; /**< The vertex shader used by the graphics pipeline. */ fragment_shader: *SDL_GPUShader; /**< The fragment shader used by the graphics pipeline. */ vertex_input_state: SDL_GPUVertexInputState; /**< The vertex layout of the graphics pipeline. */ primitive_type: SDL_GPUPrimitiveType; /**< The primitive topology of the graphics pipeline. */ rasterizer_state: SDL_GPURasterizerState; /**< The rasterizer state of the graphics pipeline. */ multisample_state: SDL_GPUMultisampleState; /**< The multisample state of the graphics pipeline. */ depth_stencil_state: SDL_GPUDepthStencilState; /**< The depth-stencil state of the graphics pipeline. */ target_info: SDL_GPUGraphicsPipelineTargetInfo; /**< Formats and blend modes for the render targets of the graphics pipeline. */ props: SDL_PropertiesID; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } /** * A structure specifying the parameters of a compute pipeline state. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateGPUComputePipeline */ SDL_GPUComputePipelineCreateInfo :: struct { code_size: u64; /**< The size in bytes of the compute shader code pointed to. */ code: *Uint8; /**< A pointer to compute shader code. */ entrypoint: *u8; /**< A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. */ format: SDL_GPUShaderFormat; /**< The format of the compute shader code. */ num_samplers: Uint32; /**< The number of samplers defined in the shader. */ num_readonly_storage_textures: Uint32; /**< The number of readonly storage textures defined in the shader. */ num_readonly_storage_buffers: Uint32; /**< The number of readonly storage buffers defined in the shader. */ num_readwrite_storage_textures: Uint32; /**< The number of read-write storage textures defined in the shader. */ num_readwrite_storage_buffers: Uint32; /**< The number of read-write storage buffers defined in the shader. */ num_uniform_buffers: Uint32; /**< The number of uniform buffers defined in the shader. */ threadcount_x: Uint32; /**< The number of threads in the X dimension. This should match the value in the shader. */ threadcount_y: Uint32; /**< The number of threads in the Y dimension. This should match the value in the shader. */ threadcount_z: Uint32; /**< The number of threads in the Z dimension. This should match the value in the shader. */ props: SDL_PropertiesID; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } /** * A structure specifying the parameters of a color target used by a render * pass. * * The load_op field determines what is done with the texture at the beginning * of the render pass. * * - LOAD: Loads the data currently in the texture. Not recommended for * multisample textures as it requires significant memory bandwidth. * - CLEAR: Clears the texture to a single color. * - DONT_CARE: The driver will do whatever it wants with the texture memory. * This is a good option if you know that every single pixel will be touched * in the render pass. * * The store_op field determines what is done with the color results of the * render pass. * * - STORE: Stores the results of the render pass in the texture. Not * recommended for multisample textures as it requires significant memory * bandwidth. * - DONT_CARE: The driver will do whatever it wants with the texture memory. * This is often a good option for depth/stencil textures. * - RESOLVE: Resolves a multisample texture into resolve_texture, which must * have a sample count of 1. Then the driver may discard the multisample * texture memory. This is the most performant method of resolving a * multisample target. * - RESOLVE_AND_STORE: Resolves a multisample texture into the * resolve_texture, which must have a sample count of 1. Then the driver * stores the multisample texture's contents. Not recommended as it requires * significant memory bandwidth. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass */ SDL_GPUColorTargetInfo :: struct { texture: *SDL_GPUTexture; /**< The texture that will be used as a color target by a render pass. */ mip_level: Uint32; /**< The mip level to use as a color target. */ layer_or_depth_plane: Uint32; /**< The layer index or depth plane to use as a color target. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures. */ clear_color: SDL_FColor; /**< The color to clear the color target to at the start of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */ load_op: SDL_GPULoadOp; /**< What is done with the contents of the color target at the beginning of the render pass. */ store_op: SDL_GPUStoreOp; /**< What is done with the results of the render pass. */ resolve_texture: *SDL_GPUTexture; /**< The texture that will receive the results of a multisample resolve operation. Ignored if a RESOLVE* store_op is not used. */ resolve_mip_level: Uint32; /**< The mip level of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used. */ resolve_layer: Uint32; /**< The layer index of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used. */ cycle: bool; /**< true cycles the texture if the texture is bound and load_op is not LOAD */ cycle_resolve_texture: bool; /**< true cycles the resolve texture if the resolve texture is bound. Ignored if a RESOLVE* store_op is not used. */ padding1: Uint8; padding2: Uint8; } /** * A structure specifying the parameters of a depth-stencil target used by a * render pass. * * The load_op field determines what is done with the depth contents of the * texture at the beginning of the render pass. * * - LOAD: Loads the depth values currently in the texture. * - CLEAR: Clears the texture to a single depth. * - DONT_CARE: The driver will do whatever it wants with the memory. This is * a good option if you know that every single pixel will be touched in the * render pass. * * The store_op field determines what is done with the depth results of the * render pass. * * - STORE: Stores the depth results in the texture. * - DONT_CARE: The driver will do whatever it wants with the depth results. * This is often a good option for depth/stencil textures that don't need to * be reused again. * * The stencil_load_op field determines what is done with the stencil contents * of the texture at the beginning of the render pass. * * - LOAD: Loads the stencil values currently in the texture. * - CLEAR: Clears the stencil values to a single value. * - DONT_CARE: The driver will do whatever it wants with the memory. This is * a good option if you know that every single pixel will be touched in the * render pass. * * The stencil_store_op field determines what is done with the stencil results * of the render pass. * * - STORE: Stores the stencil results in the texture. * - DONT_CARE: The driver will do whatever it wants with the stencil results. * This is often a good option for depth/stencil textures that don't need to * be reused again. * * Note that depth/stencil targets do not support multisample resolves. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPURenderPass */ SDL_GPUDepthStencilTargetInfo :: struct { texture: *SDL_GPUTexture; /**< The texture that will be used as the depth stencil target by the render pass. */ clear_depth: float; /**< The value to clear the depth component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */ load_op: SDL_GPULoadOp; /**< What is done with the depth contents at the beginning of the render pass. */ store_op: SDL_GPUStoreOp; /**< What is done with the depth results of the render pass. */ stencil_load_op: SDL_GPULoadOp; /**< What is done with the stencil contents at the beginning of the render pass. */ stencil_store_op: SDL_GPUStoreOp; /**< What is done with the stencil results of the render pass. */ cycle: bool; /**< true cycles the texture if the texture is bound and any load ops are not LOAD */ clear_stencil: Uint8; /**< The value to clear the stencil component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */ padding1: Uint8; padding2: Uint8; } /** * A structure containing parameters for a blit command. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_BlitGPUTexture */ SDL_GPUBlitInfo :: struct { source: SDL_GPUBlitRegion; /**< The source region for the blit. */ destination: SDL_GPUBlitRegion; /**< The destination region for the blit. */ load_op: SDL_GPULoadOp; /**< What is done with the contents of the destination before the blit. */ clear_color: SDL_FColor; /**< The color to clear the destination region to before the blit. Ignored if load_op is not SDL_GPU_LOADOP_CLEAR. */ flip_mode: SDL_FlipMode; /**< The flip mode for the source region. */ filter: SDL_GPUFilter; /**< The filter mode used when blitting. */ cycle: bool; /**< true cycles the destination texture if it is already bound. */ padding1: Uint8; padding2: Uint8; padding3: Uint8; } /** * A structure specifying parameters in a buffer binding call. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_BindGPUVertexBuffers * \sa SDL_BindGPUIndexBuffer */ SDL_GPUBufferBinding :: struct { buffer: *SDL_GPUBuffer; /**< The buffer to bind. Must have been created with SDL_GPU_BUFFERUSAGE_VERTEX for SDL_BindGPUVertexBuffers, or SDL_GPU_BUFFERUSAGE_INDEX for SDL_BindGPUIndexBuffer. */ offset: Uint32; /**< The starting byte of the data to bind in the buffer. */ } /** * A structure specifying parameters in a sampler binding call. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_BindGPUVertexSamplers * \sa SDL_BindGPUFragmentSamplers */ SDL_GPUTextureSamplerBinding :: struct { texture: *SDL_GPUTexture; /**< The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. */ sampler: *SDL_GPUSampler; /**< The sampler to bind. */ } /** * A structure specifying parameters related to binding buffers in a compute * pass. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPUComputePass */ SDL_GPUStorageBufferReadWriteBinding :: struct { buffer: *SDL_GPUBuffer; /**< The buffer to bind. Must have been created with SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE. */ cycle: bool; /**< true cycles the buffer if it is already bound. */ padding1: Uint8; padding2: Uint8; padding3: Uint8; } /** * A structure specifying parameters related to binding textures in a compute * pass. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_BeginGPUComputePass */ SDL_GPUStorageTextureReadWriteBinding :: struct { texture: *SDL_GPUTexture; /**< The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE or SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE. */ mip_level: Uint32; /**< The mip level index to bind. */ layer: Uint32; /**< The layer index to bind. */ cycle: bool; /**< true cycles the texture if it is already bound. */ padding1: Uint8; padding2: Uint8; padding3: Uint8; } /** * Checks for GPU runtime support. * * \param format_flags a bitflag indicating which shader formats the app is * able to provide. * \param name the preferred GPU driver, or NULL to let SDL pick the optimal * driver. * \returns true if supported, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUDevice */ SDL_GPUSupportsShaderFormats :: (format_flags: SDL_GPUShaderFormat, name: *u8) -> bool #foreign libsdl3; /** * Checks for GPU runtime support. * * \param props the properties to use. * \returns true if supported, false otherwise. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUDeviceWithProperties */ SDL_GPUSupportsProperties :: (props: SDL_PropertiesID) -> bool #foreign libsdl3; /** * Creates a GPU context. * * \param format_flags a bitflag indicating which shader formats the app is * able to provide. * \param debug_mode enable debug mode properties and validations. * \param name the preferred GPU driver, or NULL to let SDL pick the optimal * driver. * \returns a GPU context on success or NULL on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGPUShaderFormats * \sa SDL_GetGPUDeviceDriver * \sa SDL_DestroyGPUDevice * \sa SDL_GPUSupportsShaderFormats */ SDL_CreateGPUDevice :: (format_flags: SDL_GPUShaderFormat, debug_mode: bool, name: *u8) -> *SDL_GPUDevice #foreign libsdl3; /** * Creates a GPU context. * * These are the supported properties: * * - `SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN`: enable debug mode * properties and validations, defaults to true. * - `SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN`: enable to prefer * energy efficiency over maximum GPU performance, defaults to false. * - `SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`: the name of the GPU driver to * use, if a specific one is desired. * * These are the current shader format properties: * * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN`: The app is able to * provide shaders for an NDA platform. * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN`: The app is able to * provide SPIR-V shaders if applicable. * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN`: The app is able to * provide DXBC shaders if applicable * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN`: The app is able to * provide DXIL shaders if applicable. * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN`: The app is able to * provide MSL shaders if applicable. * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN`: The app is able to * provide Metal shader libraries if applicable. * * With the D3D12 renderer: * * - `SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING`: the prefix to * use for all vertex semantics, default is "TEXCOORD". * * \param props the properties to use. * \returns a GPU context on success or NULL on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGPUShaderFormats * \sa SDL_GetGPUDeviceDriver * \sa SDL_DestroyGPUDevice * \sa SDL_GPUSupportsProperties */ SDL_CreateGPUDeviceWithProperties :: (props: SDL_PropertiesID) -> *SDL_GPUDevice #foreign libsdl3; /** * Destroys a GPU context previously returned by SDL_CreateGPUDevice. * * \param device a GPU Context to destroy. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUDevice */ SDL_DestroyGPUDevice :: (device: *SDL_GPUDevice) -> void #foreign libsdl3; /** * Get the number of GPU drivers compiled into SDL. * * \returns the number of built in GPU drivers. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetGPUDriver */ SDL_GetNumGPUDrivers :: () -> s32 #foreign libsdl3; /** * Get the name of a built in GPU driver. * * The GPU drivers are presented in the order in which they are normally * checked during initialization. * * The names of drivers are all simple, low-ASCII identifiers, like "vulkan", * "metal" or "direct3d12". These never have Unicode characters, and are not * meant to be proper names. * * \param index the index of a GPU driver. * \returns the name of the GPU driver with the given **index**. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumGPUDrivers */ SDL_GetGPUDriver :: (index: s32) -> *u8 #foreign libsdl3; /** * Returns the name of the backend used to create this GPU context. * * \param device a GPU context to query. * \returns the name of the device's driver, or NULL on error. * * \since This function is available since SDL 3.2.0. */ SDL_GetGPUDeviceDriver :: (device: *SDL_GPUDevice) -> *u8 #foreign libsdl3; /** * Returns the supported shader formats for this GPU context. * * \param device a GPU context to query. * \returns a bitflag indicating which shader formats the driver is able to * consume. * * \since This function is available since SDL 3.2.0. */ SDL_GetGPUShaderFormats :: (device: *SDL_GPUDevice) -> SDL_GPUShaderFormat #foreign libsdl3; /** * Creates a pipeline object to be used in a compute workflow. * * Shader resource bindings must be authored to follow a particular order * depending on the shader format. * * For SPIR-V shaders, use the following resource sets: * * - 0: Sampled textures, followed by read-only storage textures, followed by * read-only storage buffers * - 1: Read-write storage textures, followed by read-write storage buffers * - 2: Uniform buffers * * For DXBC and DXIL shaders, use the following register order: * * - (t[n], space0): Sampled textures, followed by read-only storage textures, * followed by read-only storage buffers * - (u[n], space1): Read-write storage textures, followed by read-write * storage buffers * - (b[n], space2): Uniform buffers * * For MSL/metallib, use the following order: * * - [[buffer]]: Uniform buffers, followed by read-only storage buffers, * followed by read-write storage buffers * - [[texture]]: Sampled textures, followed by read-only storage textures, * followed by read-write storage textures * * There are optional properties that can be provided through `props`. These * are the supported properties: * * - `SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`: a name that can be * displayed in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the compute pipeline to * create. * \returns a compute pipeline object on success, or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BindGPUComputePipeline * \sa SDL_ReleaseGPUComputePipeline */ SDL_CreateGPUComputePipeline :: (device: *SDL_GPUDevice, createinfo: *SDL_GPUComputePipelineCreateInfo) -> *SDL_GPUComputePipeline #foreign libsdl3; /** * Creates a pipeline object to be used in a graphics workflow. * * There are optional properties that can be provided through `props`. These * are the supported properties: * * - `SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`: a name that can be * displayed in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the graphics pipeline to * create. * \returns a graphics pipeline object on success, or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUShader * \sa SDL_BindGPUGraphicsPipeline * \sa SDL_ReleaseGPUGraphicsPipeline */ SDL_CreateGPUGraphicsPipeline :: (device: *SDL_GPUDevice, createinfo: *SDL_GPUGraphicsPipelineCreateInfo) -> *SDL_GPUGraphicsPipeline #foreign libsdl3; /** * Creates a sampler object to be used when binding textures in a graphics * workflow. * * There are optional properties that can be provided through `props`. These * are the supported properties: * * - `SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`: a name that can be displayed * in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the sampler to create. * \returns a sampler object on success, or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_BindGPUVertexSamplers * \sa SDL_BindGPUFragmentSamplers * \sa SDL_ReleaseGPUSampler */ SDL_CreateGPUSampler :: (device: *SDL_GPUDevice, createinfo: *SDL_GPUSamplerCreateInfo) -> *SDL_GPUSampler #foreign libsdl3; /** * Creates a shader to be used when creating a graphics pipeline. * * Shader resource bindings must be authored to follow a particular order * depending on the shader format. * * For SPIR-V shaders, use the following resource sets: * * For vertex shaders: * * - 0: Sampled textures, followed by storage textures, followed by storage * buffers * - 1: Uniform buffers * * For fragment shaders: * * - 2: Sampled textures, followed by storage textures, followed by storage * buffers * - 3: Uniform buffers * * For DXBC and DXIL shaders, use the following register order: * * For vertex shaders: * * - (t[n], space0): Sampled textures, followed by storage textures, followed * by storage buffers * - (s[n], space0): Samplers with indices corresponding to the sampled * textures * - (b[n], space1): Uniform buffers * * For pixel shaders: * * - (t[n], space2): Sampled textures, followed by storage textures, followed * by storage buffers * - (s[n], space2): Samplers with indices corresponding to the sampled * textures * - (b[n], space3): Uniform buffers * * For MSL/metallib, use the following order: * * - [[texture]]: Sampled textures, followed by storage textures * - [[sampler]]: Samplers with indices corresponding to the sampled textures * - [[buffer]]: Uniform buffers, followed by storage buffers. Vertex buffer 0 * is bound at [[buffer(14)]], vertex buffer 1 at [[buffer(15)]], and so on. * Rather than manually authoring vertex buffer indices, use the * [[stage_in]] attribute which will automatically use the vertex input * information from the SDL_GPUGraphicsPipeline. * * Shader semantics other than system-value semantics do not matter in D3D12 * and for ease of use the SDL implementation assumes that non system-value * semantics will all be TEXCOORD. If you are using HLSL as the shader source * language, your vertex semantics should start at TEXCOORD0 and increment * like so: TEXCOORD1, TEXCOORD2, etc. If you wish to change the semantic * prefix to something other than TEXCOORD you can use * SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING with * SDL_CreateGPUDeviceWithProperties(). * * There are optional properties that can be provided through `props`. These * are the supported properties: * * - `SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`: a name that can be displayed in * debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the shader to create. * \returns a shader object on success, or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUGraphicsPipeline * \sa SDL_ReleaseGPUShader */ SDL_CreateGPUShader :: (device: *SDL_GPUDevice, createinfo: *SDL_GPUShaderCreateInfo) -> *SDL_GPUShader #foreign libsdl3; /** * Creates a texture object to be used in graphics or compute workflows. * * The contents of this texture are undefined until data is written to the * texture. * * Note that certain combinations of usage flags are invalid. For example, a * texture cannot have both the SAMPLER and GRAPHICS_STORAGE_READ flags. * * If you request a sample count higher than the hardware supports, the * implementation will automatically fall back to the highest available sample * count. * * There are optional properties that can be provided through * SDL_GPUTextureCreateInfo's `props`. These are the supported properties: * * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this red intensity. Defaults to zero. * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this green intensity. Defaults to zero. * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this blue intensity. Defaults to zero. * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT`: (Direct3D 12 only) if * the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture * to a color with this alpha intensity. Defaults to zero. * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT`: (Direct3D 12 only) * if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear * the texture to a depth of this value. Defaults to zero. * - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12 * only) if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, * clear the texture to a stencil of this value. Defaults to zero. * - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed * in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the texture to create. * \returns a texture object on success, or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture * \sa SDL_BindGPUVertexSamplers * \sa SDL_BindGPUVertexStorageTextures * \sa SDL_BindGPUFragmentSamplers * \sa SDL_BindGPUFragmentStorageTextures * \sa SDL_BindGPUComputeStorageTextures * \sa SDL_BlitGPUTexture * \sa SDL_ReleaseGPUTexture * \sa SDL_GPUTextureSupportsFormat */ SDL_CreateGPUTexture :: (device: *SDL_GPUDevice, createinfo: *SDL_GPUTextureCreateInfo) -> *SDL_GPUTexture #foreign libsdl3; /** * Creates a buffer object to be used in graphics or compute workflows. * * The contents of this buffer are undefined until data is written to the * buffer. * * Note that certain combinations of usage flags are invalid. For example, a * buffer cannot have both the VERTEX and INDEX flags. * * For better understanding of underlying concepts and memory management with * SDL GPU API, you may refer * [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/) * . * * There are optional properties that can be provided through `props`. These * are the supported properties: * * - `SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`: a name that can be displayed in * debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the buffer to create. * \returns a buffer object on success, or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer * \sa SDL_CopyGPUBufferToBuffer * \sa SDL_BindGPUVertexBuffers * \sa SDL_BindGPUIndexBuffer * \sa SDL_BindGPUVertexStorageBuffers * \sa SDL_BindGPUFragmentStorageBuffers * \sa SDL_DrawGPUPrimitivesIndirect * \sa SDL_DrawGPUIndexedPrimitivesIndirect * \sa SDL_BindGPUComputeStorageBuffers * \sa SDL_DispatchGPUComputeIndirect * \sa SDL_ReleaseGPUBuffer */ SDL_CreateGPUBuffer :: (device: *SDL_GPUDevice, createinfo: *SDL_GPUBufferCreateInfo) -> *SDL_GPUBuffer #foreign libsdl3; /** * Creates a transfer buffer to be used when uploading to or downloading from * graphics resources. * * Download buffers can be particularly expensive to create, so it is good * practice to reuse them if data will be downloaded regularly. * * There are optional properties that can be provided through `props`. These * are the supported properties: * * - `SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`: a name that can be * displayed in debugging tools. * * \param device a GPU Context. * \param createinfo a struct describing the state of the transfer buffer to * create. * \returns a transfer buffer on success, or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UploadToGPUBuffer * \sa SDL_DownloadFromGPUBuffer * \sa SDL_UploadToGPUTexture * \sa SDL_DownloadFromGPUTexture * \sa SDL_ReleaseGPUTransferBuffer */ SDL_CreateGPUTransferBuffer :: (device: *SDL_GPUDevice, createinfo: *SDL_GPUTransferBufferCreateInfo) -> *SDL_GPUTransferBuffer #foreign libsdl3; /** * Sets an arbitrary string constant to label a buffer. * * You should use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with * SDL_CreateGPUBuffer instead of this function to avoid thread safety issues. * * \param device a GPU Context. * \param buffer a buffer to attach the name to. * \param text a UTF-8 string constant to mark as the name of the buffer. * * \threadsafety This function is not thread safe, you must make sure the * buffer is not simultaneously used by any other thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUBuffer */ SDL_SetGPUBufferName :: (device: *SDL_GPUDevice, buffer: *SDL_GPUBuffer, text: *u8) -> void #foreign libsdl3; /** * Sets an arbitrary string constant to label a texture. * * You should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with * SDL_CreateGPUTexture instead of this function to avoid thread safety * issues. * * \param device a GPU Context. * \param texture a texture to attach the name to. * \param text a UTF-8 string constant to mark as the name of the texture. * * \threadsafety This function is not thread safe, you must make sure the * texture is not simultaneously used by any other thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateGPUTexture */ SDL_SetGPUTextureName :: (device: *SDL_GPUDevice, texture: *SDL_GPUTexture, text: *u8) -> void #foreign libsdl3; /** * Inserts an arbitrary string label into the command buffer callstream. * * Useful for debugging. * * \param command_buffer a command buffer. * \param text a UTF-8 string constant to insert as the label. * * \since This function is available since SDL 3.2.0. */ SDL_InsertGPUDebugLabel :: (command_buffer: *SDL_GPUCommandBuffer, text: *u8) -> void #foreign libsdl3; /** * Begins a debug group with an arbitary name. * * Used for denoting groups of calls when viewing the command buffer * callstream in a graphics debugging tool. * * Each call to SDL_PushGPUDebugGroup must have a corresponding call to * SDL_PopGPUDebugGroup. * * On some backends (e.g. Metal), pushing a debug group during a * render/blit/compute pass will create a group that is scoped to the native * pass rather than the command buffer. For best results, if you push a debug * group during a pass, always pop it in the same pass. * * \param command_buffer a command buffer. * \param name a UTF-8 string constant that names the group. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PopGPUDebugGroup */ SDL_PushGPUDebugGroup :: (command_buffer: *SDL_GPUCommandBuffer, name: *u8) -> void #foreign libsdl3; /** * Ends the most-recently pushed debug group. * * \param command_buffer a command buffer. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PushGPUDebugGroup */ SDL_PopGPUDebugGroup :: (command_buffer: *SDL_GPUCommandBuffer) -> void #foreign libsdl3; /** * Frees the given texture as soon as it is safe to do so. * * You must not reference the texture after calling this function. * * \param device a GPU context. * \param texture a texture to be destroyed. * * \since This function is available since SDL 3.2.0. */ SDL_ReleaseGPUTexture :: (device: *SDL_GPUDevice, texture: *SDL_GPUTexture) -> void #foreign libsdl3; /** * Frees the given sampler as soon as it is safe to do so. * * You must not reference the sampler after calling this function. * * \param device a GPU context. * \param sampler a sampler to be destroyed. * * \since This function is available since SDL 3.2.0. */ SDL_ReleaseGPUSampler :: (device: *SDL_GPUDevice, sampler: *SDL_GPUSampler) -> void #foreign libsdl3; /** * Frees the given buffer as soon as it is safe to do so. * * You must not reference the buffer after calling this function. * * \param device a GPU context. * \param buffer a buffer to be destroyed. * * \since This function is available since SDL 3.2.0. */ SDL_ReleaseGPUBuffer :: (device: *SDL_GPUDevice, buffer: *SDL_GPUBuffer) -> void #foreign libsdl3; /** * Frees the given transfer buffer as soon as it is safe to do so. * * You must not reference the transfer buffer after calling this function. * * \param device a GPU context. * \param transfer_buffer a transfer buffer to be destroyed. * * \since This function is available since SDL 3.2.0. */ SDL_ReleaseGPUTransferBuffer :: (device: *SDL_GPUDevice, transfer_buffer: *SDL_GPUTransferBuffer) -> void #foreign libsdl3; /** * Frees the given compute pipeline as soon as it is safe to do so. * * You must not reference the compute pipeline after calling this function. * * \param device a GPU context. * \param compute_pipeline a compute pipeline to be destroyed. * * \since This function is available since SDL 3.2.0. */ SDL_ReleaseGPUComputePipeline :: (device: *SDL_GPUDevice, compute_pipeline: *SDL_GPUComputePipeline) -> void #foreign libsdl3; /** * Frees the given shader as soon as it is safe to do so. * * You must not reference the shader after calling this function. * * \param device a GPU context. * \param shader a shader to be destroyed. * * \since This function is available since SDL 3.2.0. */ SDL_ReleaseGPUShader :: (device: *SDL_GPUDevice, shader: *SDL_GPUShader) -> void #foreign libsdl3; /** * Frees the given graphics pipeline as soon as it is safe to do so. * * You must not reference the graphics pipeline after calling this function. * * \param device a GPU context. * \param graphics_pipeline a graphics pipeline to be destroyed. * * \since This function is available since SDL 3.2.0. */ SDL_ReleaseGPUGraphicsPipeline :: (device: *SDL_GPUDevice, graphics_pipeline: *SDL_GPUGraphicsPipeline) -> void #foreign libsdl3; /** * Acquire a command buffer. * * This command buffer is managed by the implementation and should not be * freed by the user. The command buffer may only be used on the thread it was * acquired on. The command buffer should be submitted on the thread it was * acquired on. * * It is valid to acquire multiple command buffers on the same thread at once. * In fact a common design pattern is to acquire two command buffers per frame * where one is dedicated to render and compute passes and the other is * dedicated to copy passes and other preparatory work such as generating * mipmaps. Interleaving commands between the two command buffers reduces the * total amount of passes overall which improves rendering performance. * * \param device a GPU context. * \returns a command buffer, or NULL on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBuffer * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ SDL_AcquireGPUCommandBuffer :: (device: *SDL_GPUDevice) -> *SDL_GPUCommandBuffer #foreign libsdl3; /** * Pushes data to a vertex uniform slot on the command buffer. * * Subsequent draw calls will use this uniform data. * * \param command_buffer a command buffer. * \param slot_index the vertex uniform slot to push data to. * \param data client data to write. * \param length the length of the data to write. * * \since This function is available since SDL 3.2.0. */ SDL_PushGPUVertexUniformData :: (command_buffer: *SDL_GPUCommandBuffer, slot_index: Uint32, data: *void, length: Uint32) -> void #foreign libsdl3; /** * Pushes data to a fragment uniform slot on the command buffer. * * Subsequent draw calls will use this uniform data. * * \param command_buffer a command buffer. * \param slot_index the fragment uniform slot to push data to. * \param data client data to write. * \param length the length of the data to write. * * \since This function is available since SDL 3.2.0. */ SDL_PushGPUFragmentUniformData :: (command_buffer: *SDL_GPUCommandBuffer, slot_index: Uint32, data: *void, length: Uint32) -> void #foreign libsdl3; /** * Pushes data to a uniform slot on the command buffer. * * Subsequent draw calls will use this uniform data. * * \param command_buffer a command buffer. * \param slot_index the uniform slot to push data to. * \param data client data to write. * \param length the length of the data to write. * * \since This function is available since SDL 3.2.0. */ SDL_PushGPUComputeUniformData :: (command_buffer: *SDL_GPUCommandBuffer, slot_index: Uint32, data: *void, length: Uint32) -> void #foreign libsdl3; /** * Begins a render pass on a command buffer. * * A render pass consists of a set of texture subresources (or depth slices in * the 3D texture case) which will be rendered to during the render pass, * along with corresponding clear values and load/store operations. All * operations related to graphics pipelines must take place inside of a render * pass. A default viewport and scissor state are automatically set when this * is called. You cannot begin another render pass, or begin a compute pass or * copy pass until you have ended the render pass. * * \param command_buffer a command buffer. * \param color_target_infos an array of texture subresources with * corresponding clear values and load/store ops. * \param num_color_targets the number of color targets in the * color_target_infos array. * \param depth_stencil_target_info a texture subresource with corresponding * clear value and load/store ops, may be * NULL. * \returns a render pass handle. * * \since This function is available since SDL 3.2.0. * * \sa SDL_EndGPURenderPass */ SDL_BeginGPURenderPass :: (command_buffer: *SDL_GPUCommandBuffer, color_target_infos: *SDL_GPUColorTargetInfo, num_color_targets: Uint32, depth_stencil_target_info: *SDL_GPUDepthStencilTargetInfo) -> *SDL_GPURenderPass #foreign libsdl3; /** * Binds a graphics pipeline on a render pass to be used in rendering. * * A graphics pipeline must be bound before making any draw calls. * * \param render_pass a render pass handle. * \param graphics_pipeline the graphics pipeline to bind. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUGraphicsPipeline :: (render_pass: *SDL_GPURenderPass, graphics_pipeline: *SDL_GPUGraphicsPipeline) -> void #foreign libsdl3; /** * Sets the current viewport state on a command buffer. * * \param render_pass a render pass handle. * \param viewport the viewport to set. * * \since This function is available since SDL 3.2.0. */ SDL_SetGPUViewport :: (render_pass: *SDL_GPURenderPass, viewport: *SDL_GPUViewport) -> void #foreign libsdl3; /** * Sets the current scissor state on a command buffer. * * \param render_pass a render pass handle. * \param scissor the scissor area to set. * * \since This function is available since SDL 3.2.0. */ SDL_SetGPUScissor :: (render_pass: *SDL_GPURenderPass, scissor: *SDL_Rect) -> void #foreign libsdl3; /** * Sets the current blend constants on a command buffer. * * \param render_pass a render pass handle. * \param blend_constants the blend constant color. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GPU_BLENDFACTOR_CONSTANT_COLOR * \sa SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR */ SDL_SetGPUBlendConstants :: (render_pass: *SDL_GPURenderPass, blend_constants: SDL_FColor) -> void #foreign libsdl3; /** * Sets the current stencil reference value on a command buffer. * * \param render_pass a render pass handle. * \param reference the stencil reference value to set. * * \since This function is available since SDL 3.2.0. */ SDL_SetGPUStencilReference :: (render_pass: *SDL_GPURenderPass, reference: Uint8) -> void #foreign libsdl3; /** * Binds vertex buffers on a command buffer for use with subsequent draw * calls. * * \param render_pass a render pass handle. * \param first_slot the vertex buffer slot to begin binding from. * \param bindings an array of SDL_GPUBufferBinding structs containing vertex * buffers and offset values. * \param num_bindings the number of bindings in the bindings array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUVertexBuffers :: (render_pass: *SDL_GPURenderPass, first_slot: Uint32, bindings: *SDL_GPUBufferBinding, num_bindings: Uint32) -> void #foreign libsdl3; /** * Binds an index buffer on a command buffer for use with subsequent draw * calls. * * \param render_pass a render pass handle. * \param binding a pointer to a struct containing an index buffer and offset. * \param index_element_size whether the index values in the buffer are 16- or * 32-bit. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUIndexBuffer :: (render_pass: *SDL_GPURenderPass, binding: *SDL_GPUBufferBinding, index_element_size: SDL_GPUIndexElementSize) -> void #foreign libsdl3; /** * Binds texture-sampler pairs for use on the vertex shader. * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * * \param render_pass a render pass handle. * \param first_slot the vertex sampler slot to begin binding from. * \param texture_sampler_bindings an array of texture-sampler binding * structs. * \param num_bindings the number of texture-sampler pairs to bind from the * array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUVertexSamplers :: (render_pass: *SDL_GPURenderPass, first_slot: Uint32, texture_sampler_bindings: *SDL_GPUTextureSamplerBinding, num_bindings: Uint32) -> void #foreign libsdl3; /** * Binds storage textures for use on the vertex shader. * * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ. * * \param render_pass a render pass handle. * \param first_slot the vertex storage texture slot to begin binding from. * \param storage_textures an array of storage textures. * \param num_bindings the number of storage texture to bind from the array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUVertexStorageTextures :: (render_pass: *SDL_GPURenderPass, first_slot: Uint32, storage_textures: **SDL_GPUTexture, num_bindings: Uint32) -> void #foreign libsdl3; /** * Binds storage buffers for use on the vertex shader. * * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ. * * \param render_pass a render pass handle. * \param first_slot the vertex storage buffer slot to begin binding from. * \param storage_buffers an array of buffers. * \param num_bindings the number of buffers to bind from the array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUVertexStorageBuffers :: (render_pass: *SDL_GPURenderPass, first_slot: Uint32, storage_buffers: **SDL_GPUBuffer, num_bindings: Uint32) -> void #foreign libsdl3; /** * Binds texture-sampler pairs for use on the fragment shader. * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * * \param render_pass a render pass handle. * \param first_slot the fragment sampler slot to begin binding from. * \param texture_sampler_bindings an array of texture-sampler binding * structs. * \param num_bindings the number of texture-sampler pairs to bind from the * array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUFragmentSamplers :: (render_pass: *SDL_GPURenderPass, first_slot: Uint32, texture_sampler_bindings: *SDL_GPUTextureSamplerBinding, num_bindings: Uint32) -> void #foreign libsdl3; /** * Binds storage textures for use on the fragment shader. * * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ. * * \param render_pass a render pass handle. * \param first_slot the fragment storage texture slot to begin binding from. * \param storage_textures an array of storage textures. * \param num_bindings the number of storage textures to bind from the array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUFragmentStorageTextures :: (render_pass: *SDL_GPURenderPass, first_slot: Uint32, storage_textures: **SDL_GPUTexture, num_bindings: Uint32) -> void #foreign libsdl3; /** * Binds storage buffers for use on the fragment shader. * * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ. * * \param render_pass a render pass handle. * \param first_slot the fragment storage buffer slot to begin binding from. * \param storage_buffers an array of storage buffers. * \param num_bindings the number of storage buffers to bind from the array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUFragmentStorageBuffers :: (render_pass: *SDL_GPURenderPass, first_slot: Uint32, storage_buffers: **SDL_GPUBuffer, num_bindings: Uint32) -> void #foreign libsdl3; /** * Draws data using bound graphics state with an index buffer and instancing * enabled. * * You must not call this function before binding a graphics pipeline. * * Note that the `first_vertex` and `first_instance` parameters are NOT * compatible with built-in vertex/instance ID variables in shaders (for * example, SV_VertexID); GPU APIs and shader languages do not define these * built-in variables consistently, so if your shader depends on them, the * only way to keep behavior consistent and portable is to always pass 0 for * the correlating parameter in the draw calls. * * \param render_pass a render pass handle. * \param num_indices the number of indices to draw per instance. * \param num_instances the number of instances to draw. * \param first_index the starting index within the index buffer. * \param vertex_offset value added to vertex index before indexing into the * vertex buffer. * \param first_instance the ID of the first instance to draw. * * \since This function is available since SDL 3.2.0. */ SDL_DrawGPUIndexedPrimitives :: (render_pass: *SDL_GPURenderPass, num_indices: Uint32, num_instances: Uint32, first_index: Uint32, vertex_offset: Sint32, first_instance: Uint32) -> void #foreign libsdl3; /** * Draws data using bound graphics state. * * You must not call this function before binding a graphics pipeline. * * Note that the `first_vertex` and `first_instance` parameters are NOT * compatible with built-in vertex/instance ID variables in shaders (for * example, SV_VertexID); GPU APIs and shader languages do not define these * built-in variables consistently, so if your shader depends on them, the * only way to keep behavior consistent and portable is to always pass 0 for * the correlating parameter in the draw calls. * * \param render_pass a render pass handle. * \param num_vertices the number of vertices to draw. * \param num_instances the number of instances that will be drawn. * \param first_vertex the index of the first vertex to draw. * \param first_instance the ID of the first instance to draw. * * \since This function is available since SDL 3.2.0. */ SDL_DrawGPUPrimitives :: (render_pass: *SDL_GPURenderPass, num_vertices: Uint32, num_instances: Uint32, first_vertex: Uint32, first_instance: Uint32) -> void #foreign libsdl3; /** * Draws data using bound graphics state and with draw parameters set from a * buffer. * * The buffer must consist of tightly-packed draw parameter sets that each * match the layout of SDL_GPUIndirectDrawCommand. You must not call this * function before binding a graphics pipeline. * * \param render_pass a render pass handle. * \param buffer a buffer containing draw parameters. * \param offset the offset to start reading from the draw buffer. * \param draw_count the number of draw parameter sets that should be read * from the draw buffer. * * \since This function is available since SDL 3.2.0. */ SDL_DrawGPUPrimitivesIndirect :: (render_pass: *SDL_GPURenderPass, buffer: *SDL_GPUBuffer, offset: Uint32, draw_count: Uint32) -> void #foreign libsdl3; /** * Draws data using bound graphics state with an index buffer enabled and with * draw parameters set from a buffer. * * The buffer must consist of tightly-packed draw parameter sets that each * match the layout of SDL_GPUIndexedIndirectDrawCommand. You must not call * this function before binding a graphics pipeline. * * \param render_pass a render pass handle. * \param buffer a buffer containing draw parameters. * \param offset the offset to start reading from the draw buffer. * \param draw_count the number of draw parameter sets that should be read * from the draw buffer. * * \since This function is available since SDL 3.2.0. */ SDL_DrawGPUIndexedPrimitivesIndirect :: (render_pass: *SDL_GPURenderPass, buffer: *SDL_GPUBuffer, offset: Uint32, draw_count: Uint32) -> void #foreign libsdl3; /** * Ends the given render pass. * * All bound graphics state on the render pass command buffer is unset. The * render pass handle is now invalid. * * \param render_pass a render pass handle. * * \since This function is available since SDL 3.2.0. */ SDL_EndGPURenderPass :: (render_pass: *SDL_GPURenderPass) -> void #foreign libsdl3; /** * Begins a compute pass on a command buffer. * * A compute pass is defined by a set of texture subresources and buffers that * may be written to by compute pipelines. These textures and buffers must * have been created with the COMPUTE_STORAGE_WRITE bit or the * COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE bit. If you do not create a texture * with COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE, you must not read from the * texture in the compute pass. All operations related to compute pipelines * must take place inside of a compute pass. You must not begin another * compute pass, or a render pass or copy pass before ending the compute pass. * * A VERY IMPORTANT NOTE - Reads and writes in compute passes are NOT * implicitly synchronized. This means you may cause data races by both * reading and writing a resource region in a compute pass, or by writing * multiple times to a resource region. If your compute work depends on * reading the completed output from a previous dispatch, you MUST end the * current compute pass and begin a new one before you can safely access the * data. Otherwise you will receive unexpected results. Reading and writing a * texture in the same compute pass is only supported by specific texture * formats. Make sure you check the format support! * * \param command_buffer a command buffer. * \param storage_texture_bindings an array of writeable storage texture * binding structs. * \param num_storage_texture_bindings the number of storage textures to bind * from the array. * \param storage_buffer_bindings an array of writeable storage buffer binding * structs. * \param num_storage_buffer_bindings the number of storage buffers to bind * from the array. * \returns a compute pass handle. * * \since This function is available since SDL 3.2.0. * * \sa SDL_EndGPUComputePass */ SDL_BeginGPUComputePass :: (command_buffer: *SDL_GPUCommandBuffer, storage_texture_bindings: *SDL_GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: Uint32, storage_buffer_bindings: *SDL_GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: Uint32) -> *SDL_GPUComputePass #foreign libsdl3; /** * Binds a compute pipeline on a command buffer for use in compute dispatch. * * \param compute_pass a compute pass handle. * \param compute_pipeline a compute pipeline to bind. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUComputePipeline :: (compute_pass: *SDL_GPUComputePass, compute_pipeline: *SDL_GPUComputePipeline) -> void #foreign libsdl3; /** * Binds texture-sampler pairs for use on the compute shader. * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * * \param compute_pass a compute pass handle. * \param first_slot the compute sampler slot to begin binding from. * \param texture_sampler_bindings an array of texture-sampler binding * structs. * \param num_bindings the number of texture-sampler bindings to bind from the * array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUComputeSamplers :: (compute_pass: *SDL_GPUComputePass, first_slot: Uint32, texture_sampler_bindings: *SDL_GPUTextureSamplerBinding, num_bindings: Uint32) -> void #foreign libsdl3; /** * Binds storage textures as readonly for use on the compute pipeline. * * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ. * * \param compute_pass a compute pass handle. * \param first_slot the compute storage texture slot to begin binding from. * \param storage_textures an array of storage textures. * \param num_bindings the number of storage textures to bind from the array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUComputeStorageTextures :: (compute_pass: *SDL_GPUComputePass, first_slot: Uint32, storage_textures: **SDL_GPUTexture, num_bindings: Uint32) -> void #foreign libsdl3; /** * Binds storage buffers as readonly for use on the compute pipeline. * * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ. * * \param compute_pass a compute pass handle. * \param first_slot the compute storage buffer slot to begin binding from. * \param storage_buffers an array of storage buffer binding structs. * \param num_bindings the number of storage buffers to bind from the array. * * \since This function is available since SDL 3.2.0. */ SDL_BindGPUComputeStorageBuffers :: (compute_pass: *SDL_GPUComputePass, first_slot: Uint32, storage_buffers: **SDL_GPUBuffer, num_bindings: Uint32) -> void #foreign libsdl3; /** * Dispatches compute work. * * You must not call this function before binding a compute pipeline. * * A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and * the dispatches write to the same resource region as each other, there is no * guarantee of which order the writes will occur. If the write order matters, * you MUST end the compute pass and begin another one. * * \param compute_pass a compute pass handle. * \param groupcount_x number of local workgroups to dispatch in the X * dimension. * \param groupcount_y number of local workgroups to dispatch in the Y * dimension. * \param groupcount_z number of local workgroups to dispatch in the Z * dimension. * * \since This function is available since SDL 3.2.0. */ SDL_DispatchGPUCompute :: (compute_pass: *SDL_GPUComputePass, groupcount_x: Uint32, groupcount_y: Uint32, groupcount_z: Uint32) -> void #foreign libsdl3; /** * Dispatches compute work with parameters set from a buffer. * * The buffer layout should match the layout of * SDL_GPUIndirectDispatchCommand. You must not call this function before * binding a compute pipeline. * * A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and * the dispatches write to the same resource region as each other, there is no * guarantee of which order the writes will occur. If the write order matters, * you MUST end the compute pass and begin another one. * * \param compute_pass a compute pass handle. * \param buffer a buffer containing dispatch parameters. * \param offset the offset to start reading from the dispatch buffer. * * \since This function is available since SDL 3.2.0. */ SDL_DispatchGPUComputeIndirect :: (compute_pass: *SDL_GPUComputePass, buffer: *SDL_GPUBuffer, offset: Uint32) -> void #foreign libsdl3; /** * Ends the current compute pass. * * All bound compute state on the command buffer is unset. The compute pass * handle is now invalid. * * \param compute_pass a compute pass handle. * * \since This function is available since SDL 3.2.0. */ SDL_EndGPUComputePass :: (compute_pass: *SDL_GPUComputePass) -> void #foreign libsdl3; /** * Maps a transfer buffer into application address space. * * You must unmap the transfer buffer before encoding upload commands. * * \param device a GPU context. * \param transfer_buffer a transfer buffer. * \param cycle if true, cycles the transfer buffer if it is already bound. * \returns the address of the mapped transfer buffer memory, or NULL on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_MapGPUTransferBuffer :: (device: *SDL_GPUDevice, transfer_buffer: *SDL_GPUTransferBuffer, cycle: bool) -> *void #foreign libsdl3; /** * Unmaps a previously mapped transfer buffer. * * \param device a GPU context. * \param transfer_buffer a previously mapped transfer buffer. * * \since This function is available since SDL 3.2.0. */ SDL_UnmapGPUTransferBuffer :: (device: *SDL_GPUDevice, transfer_buffer: *SDL_GPUTransferBuffer) -> void #foreign libsdl3; /** * Begins a copy pass on a command buffer. * * All operations related to copying to or from buffers or textures take place * inside a copy pass. You must not begin another copy pass, or a render pass * or compute pass before ending the copy pass. * * \param command_buffer a command buffer. * \returns a copy pass handle. * * \since This function is available since SDL 3.2.0. */ SDL_BeginGPUCopyPass :: (command_buffer: *SDL_GPUCommandBuffer) -> *SDL_GPUCopyPass #foreign libsdl3; /** * Uploads data from a transfer buffer to a texture. * * The upload occurs on the GPU timeline. You may assume that the upload has * finished in subsequent commands. * * You must align the data in the transfer buffer to a multiple of the texel * size of the texture format. * * \param copy_pass a copy pass handle. * \param source the source transfer buffer with image layout information. * \param destination the destination texture region. * \param cycle if true, cycles the texture if the texture is bound, otherwise * overwrites the data. * * \since This function is available since SDL 3.2.0. */ SDL_UploadToGPUTexture :: (copy_pass: *SDL_GPUCopyPass, source: *SDL_GPUTextureTransferInfo, destination: *SDL_GPUTextureRegion, cycle: bool) -> void #foreign libsdl3; /** * Uploads data from a transfer buffer to a buffer. * * The upload occurs on the GPU timeline. You may assume that the upload has * finished in subsequent commands. * * \param copy_pass a copy pass handle. * \param source the source transfer buffer with offset. * \param destination the destination buffer with offset and size. * \param cycle if true, cycles the buffer if it is already bound, otherwise * overwrites the data. * * \since This function is available since SDL 3.2.0. */ SDL_UploadToGPUBuffer :: (copy_pass: *SDL_GPUCopyPass, source: *SDL_GPUTransferBufferLocation, destination: *SDL_GPUBufferRegion, cycle: bool) -> void #foreign libsdl3; /** * Performs a texture-to-texture copy. * * This copy occurs on the GPU timeline. You may assume the copy has finished * in subsequent commands. * * \param copy_pass a copy pass handle. * \param source a source texture region. * \param destination a destination texture region. * \param w the width of the region to copy. * \param h the height of the region to copy. * \param d the depth of the region to copy. * \param cycle if true, cycles the destination texture if the destination * texture is bound, otherwise overwrites the data. * * \since This function is available since SDL 3.2.0. */ SDL_CopyGPUTextureToTexture :: (copy_pass: *SDL_GPUCopyPass, source: *SDL_GPUTextureLocation, destination: *SDL_GPUTextureLocation, w: Uint32, h: Uint32, d: Uint32, cycle: bool) -> void #foreign libsdl3; /** * Performs a buffer-to-buffer copy. * * This copy occurs on the GPU timeline. You may assume the copy has finished * in subsequent commands. * * \param copy_pass a copy pass handle. * \param source the buffer and offset to copy from. * \param destination the buffer and offset to copy to. * \param size the length of the buffer to copy. * \param cycle if true, cycles the destination buffer if it is already bound, * otherwise overwrites the data. * * \since This function is available since SDL 3.2.0. */ SDL_CopyGPUBufferToBuffer :: (copy_pass: *SDL_GPUCopyPass, source: *SDL_GPUBufferLocation, destination: *SDL_GPUBufferLocation, size: Uint32, cycle: bool) -> void #foreign libsdl3; /** * Copies data from a texture to a transfer buffer on the GPU timeline. * * This data is not guaranteed to be copied until the command buffer fence is * signaled. * * \param copy_pass a copy pass handle. * \param source the source texture region. * \param destination the destination transfer buffer with image layout * information. * * \since This function is available since SDL 3.2.0. */ SDL_DownloadFromGPUTexture :: (copy_pass: *SDL_GPUCopyPass, source: *SDL_GPUTextureRegion, destination: *SDL_GPUTextureTransferInfo) -> void #foreign libsdl3; /** * Copies data from a buffer to a transfer buffer on the GPU timeline. * * This data is not guaranteed to be copied until the command buffer fence is * signaled. * * \param copy_pass a copy pass handle. * \param source the source buffer with offset and size. * \param destination the destination transfer buffer with offset. * * \since This function is available since SDL 3.2.0. */ SDL_DownloadFromGPUBuffer :: (copy_pass: *SDL_GPUCopyPass, source: *SDL_GPUBufferRegion, destination: *SDL_GPUTransferBufferLocation) -> void #foreign libsdl3; /** * Ends the current copy pass. * * \param copy_pass a copy pass handle. * * \since This function is available since SDL 3.2.0. */ SDL_EndGPUCopyPass :: (copy_pass: *SDL_GPUCopyPass) -> void #foreign libsdl3; /** * Generates mipmaps for the given texture. * * This function must not be called inside of any pass. * * \param command_buffer a command_buffer. * \param texture a texture with more than 1 mip level. * * \since This function is available since SDL 3.2.0. */ SDL_GenerateMipmapsForGPUTexture :: (command_buffer: *SDL_GPUCommandBuffer, texture: *SDL_GPUTexture) -> void #foreign libsdl3; /** * Blits from a source texture region to a destination texture region. * * This function must not be called inside of any pass. * * \param command_buffer a command buffer. * \param info the blit info struct containing the blit parameters. * * \since This function is available since SDL 3.2.0. */ SDL_BlitGPUTexture :: (command_buffer: *SDL_GPUCommandBuffer, info: *SDL_GPUBlitInfo) -> void #foreign libsdl3; /** * Determines whether a swapchain composition is supported by the window. * * The window must be claimed before calling this function. * * \param device a GPU context. * \param window an SDL_Window. * \param swapchain_composition the swapchain composition to check. * \returns true if supported, false if unsupported. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClaimWindowForGPUDevice */ SDL_WindowSupportsGPUSwapchainComposition :: (device: *SDL_GPUDevice, window: *SDL_Window, swapchain_composition: SDL_GPUSwapchainComposition) -> bool #foreign libsdl3; /** * Determines whether a presentation mode is supported by the window. * * The window must be claimed before calling this function. * * \param device a GPU context. * \param window an SDL_Window. * \param present_mode the presentation mode to check. * \returns true if supported, false if unsupported. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClaimWindowForGPUDevice */ SDL_WindowSupportsGPUPresentMode :: (device: *SDL_GPUDevice, window: *SDL_Window, present_mode: SDL_GPUPresentMode) -> bool #foreign libsdl3; /** * Claims a window, creating a swapchain structure for it. * * This must be called before SDL_AcquireGPUSwapchainTexture is called using * the window. You should only call this function from the thread that created * the window. * * The swapchain will be created with SDL_GPU_SWAPCHAINCOMPOSITION_SDR and * SDL_GPU_PRESENTMODE_VSYNC. If you want to have different swapchain * parameters, you must call SDL_SetGPUSwapchainParameters after claiming the * window. * * \param device a GPU context. * \param window an SDL_Window. * \returns true on success, or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called from the thread that * created the window. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitAndAcquireGPUSwapchainTexture * \sa SDL_ReleaseWindowFromGPUDevice * \sa SDL_WindowSupportsGPUPresentMode * \sa SDL_WindowSupportsGPUSwapchainComposition */ SDL_ClaimWindowForGPUDevice :: (device: *SDL_GPUDevice, window: *SDL_Window) -> bool #foreign libsdl3; /** * Unclaims a window, destroying its swapchain structure. * * \param device a GPU context. * \param window an SDL_Window that has been claimed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClaimWindowForGPUDevice */ SDL_ReleaseWindowFromGPUDevice :: (device: *SDL_GPUDevice, window: *SDL_Window) -> void #foreign libsdl3; /** * Changes the swapchain parameters for the given claimed window. * * This function will fail if the requested present mode or swapchain * composition are unsupported by the device. Check if the parameters are * supported via SDL_WindowSupportsGPUPresentMode / * SDL_WindowSupportsGPUSwapchainComposition prior to calling this function. * * SDL_GPU_PRESENTMODE_VSYNC and SDL_GPU_SWAPCHAINCOMPOSITION_SDR are always * supported. * * \param device a GPU context. * \param window an SDL_Window that has been claimed. * \param swapchain_composition the desired composition of the swapchain. * \param present_mode the desired present mode for the swapchain. * \returns true if successful, false on error; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WindowSupportsGPUPresentMode * \sa SDL_WindowSupportsGPUSwapchainComposition */ SDL_SetGPUSwapchainParameters :: (device: *SDL_GPUDevice, window: *SDL_Window, swapchain_composition: SDL_GPUSwapchainComposition, present_mode: SDL_GPUPresentMode) -> bool #foreign libsdl3; /** * Configures the maximum allowed number of frames in flight. * * The default value when the device is created is 2. This means that after * you have submitted 2 frames for presentation, if the GPU has not finished * working on the first frame, SDL_AcquireGPUSwapchainTexture() will fill the * swapchain texture pointer with NULL, and * SDL_WaitAndAcquireGPUSwapchainTexture() will block. * * Higher values increase throughput at the expense of visual latency. Lower * values decrease visual latency at the expense of throughput. * * Note that calling this function will stall and flush the command queue to * prevent synchronization issues. * * The minimum value of allowed frames in flight is 1, and the maximum is 3. * * \param device a GPU context. * \param allowed_frames_in_flight the maximum number of frames that can be * pending on the GPU. * \returns true if successful, false on error; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_SetGPUAllowedFramesInFlight :: (device: *SDL_GPUDevice, allowed_frames_in_flight: Uint32) -> bool #foreign libsdl3; /** * Obtains the texture format of the swapchain for the given window. * * Note that this format can change if the swapchain parameters change. * * \param device a GPU context. * \param window an SDL_Window that has been claimed. * \returns the texture format of the swapchain. * * \since This function is available since SDL 3.2.0. */ SDL_GetGPUSwapchainTextureFormat :: (device: *SDL_GPUDevice, window: *SDL_Window) -> SDL_GPUTextureFormat #foreign libsdl3; /** * Acquire a texture to use in presentation. * * When a swapchain texture is acquired on a command buffer, it will * automatically be submitted for presentation when the command buffer is * submitted. The swapchain texture should only be referenced by the command * buffer used to acquire it. * * This function will fill the swapchain texture handle with NULL if too many * frames are in flight. This is not an error. * * If you use this function, it is possible to create a situation where many * command buffers are allocated while the rendering context waits for the GPU * to catch up, which will cause memory usage to grow. You should use * SDL_WaitAndAcquireGPUSwapchainTexture() unless you know what you are doing * with timing. * * The swapchain texture is managed by the implementation and must not be * freed by the user. You MUST NOT call this function from any thread other * than the one that created the window. * * \param command_buffer a command buffer. * \param window a window that has been claimed. * \param swapchain_texture a pointer filled in with a swapchain texture * handle. * \param swapchain_texture_width a pointer filled in with the swapchain * texture width, may be NULL. * \param swapchain_texture_height a pointer filled in with the swapchain * texture height, may be NULL. * \returns true on success, false on error; call SDL_GetError() for more * information. * * \threadsafety This function should only be called from the thread that * created the window. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ClaimWindowForGPUDevice * \sa SDL_SubmitGPUCommandBuffer * \sa SDL_SubmitGPUCommandBufferAndAcquireFence * \sa SDL_CancelGPUCommandBuffer * \sa SDL_GetWindowSizeInPixels * \sa SDL_WaitForGPUSwapchain * \sa SDL_WaitAndAcquireGPUSwapchainTexture * \sa SDL_SetGPUAllowedFramesInFlight */ SDL_AcquireGPUSwapchainTexture :: (command_buffer: *SDL_GPUCommandBuffer, window: *SDL_Window, swapchain_texture: **SDL_GPUTexture, swapchain_texture_width: *Uint32, swapchain_texture_height: *Uint32) -> bool #foreign libsdl3; /** * Blocks the thread until a swapchain texture is available to be acquired. * * \param device a GPU context. * \param window a window that has been claimed. * \returns true on success, false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called from the thread that * created the window. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AcquireGPUSwapchainTexture * \sa SDL_WaitAndAcquireGPUSwapchainTexture * \sa SDL_SetGPUAllowedFramesInFlight */ SDL_WaitForGPUSwapchain :: (device: *SDL_GPUDevice, window: *SDL_Window) -> bool #foreign libsdl3; /** * Blocks the thread until a swapchain texture is available to be acquired, * and then acquires it. * * When a swapchain texture is acquired on a command buffer, it will * automatically be submitted for presentation when the command buffer is * submitted. The swapchain texture should only be referenced by the command * buffer used to acquire it. It is an error to call * SDL_CancelGPUCommandBuffer() after a swapchain texture is acquired. * * This function can fill the swapchain texture handle with NULL in certain * cases, for example if the window is minimized. This is not an error. You * should always make sure to check whether the pointer is NULL before * actually using it. * * The swapchain texture is managed by the implementation and must not be * freed by the user. You MUST NOT call this function from any thread other * than the one that created the window. * * \param command_buffer a command buffer. * \param window a window that has been claimed. * \param swapchain_texture a pointer filled in with a swapchain texture * handle. * \param swapchain_texture_width a pointer filled in with the swapchain * texture width, may be NULL. * \param swapchain_texture_height a pointer filled in with the swapchain * texture height, may be NULL. * \returns true on success, false on error; call SDL_GetError() for more * information. * * \threadsafety This function should only be called from the thread that * created the window. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBuffer * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ SDL_WaitAndAcquireGPUSwapchainTexture :: (command_buffer: *SDL_GPUCommandBuffer, window: *SDL_Window, swapchain_texture: **SDL_GPUTexture, swapchain_texture_width: *Uint32, swapchain_texture_height: *Uint32) -> bool #foreign libsdl3; /** * Submits a command buffer so its commands can be processed on the GPU. * * It is invalid to use the command buffer after this is called. * * This must be called from the thread the command buffer was acquired on. * * All commands in the submission are guaranteed to begin executing before any * command in a subsequent submission begins executing. * * \param command_buffer a command buffer. * \returns true on success, false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AcquireGPUCommandBuffer * \sa SDL_WaitAndAcquireGPUSwapchainTexture * \sa SDL_AcquireGPUSwapchainTexture * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ SDL_SubmitGPUCommandBuffer :: (command_buffer: *SDL_GPUCommandBuffer) -> bool #foreign libsdl3; /** * Submits a command buffer so its commands can be processed on the GPU, and * acquires a fence associated with the command buffer. * * You must release this fence when it is no longer needed or it will cause a * leak. It is invalid to use the command buffer after this is called. * * This must be called from the thread the command buffer was acquired on. * * All commands in the submission are guaranteed to begin executing before any * command in a subsequent submission begins executing. * * \param command_buffer a command buffer. * \returns a fence associated with the command buffer, or NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AcquireGPUCommandBuffer * \sa SDL_WaitAndAcquireGPUSwapchainTexture * \sa SDL_AcquireGPUSwapchainTexture * \sa SDL_SubmitGPUCommandBuffer * \sa SDL_ReleaseGPUFence */ SDL_SubmitGPUCommandBufferAndAcquireFence :: (command_buffer: *SDL_GPUCommandBuffer) -> *SDL_GPUFence #foreign libsdl3; /** * Cancels a command buffer. * * None of the enqueued commands are executed. * * It is an error to call this function after a swapchain texture has been * acquired. * * This must be called from the thread the command buffer was acquired on. * * You must not reference the command buffer after calling this function. * * \param command_buffer a command buffer. * \returns true on success, false on error; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitAndAcquireGPUSwapchainTexture * \sa SDL_AcquireGPUCommandBuffer * \sa SDL_AcquireGPUSwapchainTexture */ SDL_CancelGPUCommandBuffer :: (command_buffer: *SDL_GPUCommandBuffer) -> bool #foreign libsdl3; /** * Blocks the thread until the GPU is completely idle. * * \param device a GPU context. * \returns true on success, false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_WaitForGPUFences */ SDL_WaitForGPUIdle :: (device: *SDL_GPUDevice) -> bool #foreign libsdl3; /** * Blocks the thread until the given fences are signaled. * * \param device a GPU context. * \param wait_all if 0, wait for any fence to be signaled, if 1, wait for all * fences to be signaled. * \param fences an array of fences to wait on. * \param num_fences the number of fences in the fences array. * \returns true on success, false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence * \sa SDL_WaitForGPUIdle */ SDL_WaitForGPUFences :: (device: *SDL_GPUDevice, wait_all: bool, fences: **SDL_GPUFence, num_fences: Uint32) -> bool #foreign libsdl3; /** * Checks the status of a fence. * * \param device a GPU context. * \param fence a fence. * \returns true if the fence is signaled, false if it is not. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ SDL_QueryGPUFence :: (device: *SDL_GPUDevice, fence: *SDL_GPUFence) -> bool #foreign libsdl3; /** * Releases a fence obtained from SDL_SubmitGPUCommandBufferAndAcquireFence. * * \param device a GPU context. * \param fence a fence. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ SDL_ReleaseGPUFence :: (device: *SDL_GPUDevice, fence: *SDL_GPUFence) -> void #foreign libsdl3; /** * Obtains the texel block size for a texture format. * * \param format the texture format you want to know the texel size of. * \returns the texel block size of the texture format. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UploadToGPUTexture */ SDL_GPUTextureFormatTexelBlockSize :: (format: SDL_GPUTextureFormat) -> Uint32 #foreign libsdl3; /** * Determines whether a texture format is supported for a given type and * usage. * * \param device a GPU context. * \param format the texture format to check. * \param type the type of texture (2D, 3D, Cube). * \param usage a bitmask of all usage scenarios to check. * \returns whether the texture format is supported for this type and usage. * * \since This function is available since SDL 3.2.0. */ SDL_GPUTextureSupportsFormat :: (device: *SDL_GPUDevice, format: SDL_GPUTextureFormat, type: SDL_GPUTextureType, usage: SDL_GPUTextureUsageFlags) -> bool #foreign libsdl3; /** * Determines if a sample count for a texture format is supported. * * \param device a GPU context. * \param format the texture format to check. * \param sample_count the sample count to check. * \returns a hardware-specific version of min(preferred, possible). * * \since This function is available since SDL 3.2.0. */ SDL_GPUTextureSupportsSampleCount :: (device: *SDL_GPUDevice, format: SDL_GPUTextureFormat, sample_count: SDL_GPUSampleCount) -> bool #foreign libsdl3; /** * Calculate the size in bytes of a texture format with dimensions. * * \param format a texture format. * \param width width in pixels. * \param height height in pixels. * \param depth_or_layer_count depth for 3D textures or layer count otherwise. * \returns the size of a texture with this format and dimensions. * * \since This function is available since SDL 3.2.0. */ SDL_CalculateGPUTextureFormatSize :: (format: SDL_GPUTextureFormat, width: Uint32, height: Uint32, depth_or_layer_count: Uint32) -> Uint32 #foreign libsdl3; SDL_Haptic :: struct {} /** * Structure that represents a haptic direction. * * This is the direction where the force comes from, instead of the direction * in which the force is exerted. * * Directions can be specified by: * * - SDL_HAPTIC_POLAR : Specified by polar coordinates. * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. * * Cardinal directions of the haptic device are relative to the positioning of * the device. North is considered to be away from the user. * * The following diagram represents the cardinal directions: * * ``` * .--. * |__| .-------. * |=.| |.-----.| * |--| || || * | | |'-----'| * |__|~')_____(' * [ COMPUTER ] * * * North (0,-1) * ^ * | * | * (-1,0) West <----[ HAPTIC ]----> East (1,0) * | * | * v * South (0,1) * * * [ USER ] * \|||/ * (o o) * ---ooO-(_)-Ooo--- * ``` * * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a degree * starting north and turning clockwise. SDL_HAPTIC_POLAR only uses the first * `dir` parameter. The cardinal directions would be: * * - North: 0 (0 degrees) * - East: 9000 (90 degrees) * - South: 18000 (180 degrees) * - West: 27000 (270 degrees) * * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions (X * axis, Y axis and Z axis (with 3 axes)). SDL_HAPTIC_CARTESIAN uses the first * three `dir` parameters. The cardinal directions would be: * * - North: 0,-1, 0 * - East: 1, 0, 0 * - South: 0, 1, 0 * - West: -1, 0, 0 * * The Z axis represents the height of the effect if supported, otherwise it's * unused. In cartesian encoding (1, 2) would be the same as (2, 4), you can * use any multiple you want, only the direction matters. * * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. The * first two `dir` parameters are used. The `dir` parameters are as follows * (all values are in hundredths of degrees): * * - Degrees from (1, 0) rotated towards (0, 1). * - Degrees towards (0, 0, 1) (device needs at least 3 axes). * * Example of force coming from the south with all encodings (force coming * from the south means the user will have to pull the stick to counteract): * * ```c * SDL_HapticDirection direction; * * // Cartesian directions * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. * direction.dir[0] = 0; // X position * direction.dir[1] = 1; // Y position * // Assuming the device has 2 axes, we don't need to specify third parameter. * * // Polar directions * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. * direction.dir[0] = 18000; // Polar only uses first parameter * * // Spherical coordinates * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. * ``` * * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_POLAR * \sa SDL_HAPTIC_CARTESIAN * \sa SDL_HAPTIC_SPHERICAL * \sa SDL_HAPTIC_STEERING_AXIS * \sa SDL_HapticEffect * \sa SDL_GetNumHapticAxes */ SDL_HapticDirection :: struct { type: Uint8; /**< The type of encoding. */ dir: [3] Sint32; /**< The encoded direction. */ } /** * A structure containing a template for a Constant effect. * * This struct is exclusively for the SDL_HAPTIC_CONSTANT effect. * * A constant effect applies a constant force in the specified direction to * the joystick. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_CONSTANT * \sa SDL_HapticEffect */ SDL_HapticConstant :: struct { type: Uint16; /**< SDL_HAPTIC_CONSTANT */ direction: SDL_HapticDirection; /**< Direction of the effect. */ length: Uint32; /**< Duration of the effect. */ delay: Uint16; /**< Delay before starting the effect. */ button: Uint16; /**< Button that triggers the effect. */ interval: Uint16; /**< How soon it can be triggered again after button. */ level: Sint16; /**< Strength of the constant effect. */ attack_length: Uint16; /**< Duration of the attack. */ attack_level: Uint16; /**< Level at the start of the attack. */ fade_length: Uint16; /**< Duration of the fade. */ fade_level: Uint16; /**< Level at the end of the fade. */ } /** * A structure containing a template for a Periodic effect. * * The struct handles the following effects: * * - SDL_HAPTIC_SINE * - SDL_HAPTIC_SQUARE * - SDL_HAPTIC_TRIANGLE * - SDL_HAPTIC_SAWTOOTHUP * - SDL_HAPTIC_SAWTOOTHDOWN * * A periodic effect consists in a wave-shaped effect that repeats itself over * time. The type determines the shape of the wave and the parameters * determine the dimensions of the wave. * * Phase is given by hundredth of a degree meaning that giving the phase a * value of 9000 will displace it 25% of its period. Here are sample values: * * - 0: No phase displacement. * - 9000: Displaced 25% of its period. * - 18000: Displaced 50% of its period. * - 27000: Displaced 75% of its period. * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. * * Examples: * * ``` * SDL_HAPTIC_SINE * __ __ __ __ * / \ / \ / \ / * / \__/ \__/ \__/ * * SDL_HAPTIC_SQUARE * __ __ __ __ __ * | | | | | | | | | | * | |__| |__| |__| |__| | * * SDL_HAPTIC_TRIANGLE * /\ /\ /\ /\ /\ * / \ / \ / \ / \ / * / \/ \/ \/ \/ * * SDL_HAPTIC_SAWTOOTHUP * /| /| /| /| /| /| /| * / | / | / | / | / | / | / | * / |/ |/ |/ |/ |/ |/ | * * SDL_HAPTIC_SAWTOOTHDOWN * \ |\ |\ |\ |\ |\ |\ | * \ | \ | \ | \ | \ | \ | \ | * \| \| \| \| \| \| \| * ``` * * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_SINE * \sa SDL_HAPTIC_SQUARE * \sa SDL_HAPTIC_TRIANGLE * \sa SDL_HAPTIC_SAWTOOTHUP * \sa SDL_HAPTIC_SAWTOOTHDOWN * \sa SDL_HapticEffect */ SDL_HapticPeriodic :: struct { /**< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or SDL_HAPTIC_SAWTOOTHDOWN */ type: Uint16; direction: SDL_HapticDirection; /**< Direction of the effect. */ length: Uint32; /**< Duration of the effect. */ delay: Uint16; /**< Delay before starting the effect. */ button: Uint16; /**< Button that triggers the effect. */ interval: Uint16; /**< How soon it can be triggered again after button. */ period: Uint16; /**< Period of the wave. */ magnitude: Sint16; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */ offset: Sint16; /**< Mean value of the wave. */ phase: Uint16; /**< Positive phase shift given by hundredth of a degree. */ attack_length: Uint16; /**< Duration of the attack. */ attack_level: Uint16; /**< Level at the start of the attack. */ fade_length: Uint16; /**< Duration of the fade. */ fade_level: Uint16; /**< Level at the end of the fade. */ } /** * A structure containing a template for a Condition effect. * * The struct handles the following effects: * * - SDL_HAPTIC_SPRING: Effect based on axes position. * - SDL_HAPTIC_DAMPER: Effect based on axes velocity. * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration. * - SDL_HAPTIC_FRICTION: Effect based on axes movement. * * Direction is handled by condition internals instead of a direction member. * The condition effect specific members have three parameters. The first * refers to the X axis, the second refers to the Y axis and the third refers * to the Z axis. The right terms refer to the positive side of the axis and * the left terms refer to the negative side of the axis. Please refer to the * SDL_HapticDirection diagram for which side is positive and which is * negative. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_HapticDirection * \sa SDL_HAPTIC_SPRING * \sa SDL_HAPTIC_DAMPER * \sa SDL_HAPTIC_INERTIA * \sa SDL_HAPTIC_FRICTION * \sa SDL_HapticEffect */ SDL_HapticCondition :: struct { /**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION */ type: Uint16; direction: SDL_HapticDirection; /**< Direction of the effect. */ length: Uint32; /**< Duration of the effect. */ delay: Uint16; /**< Delay before starting the effect. */ button: Uint16; /**< Button that triggers the effect. */ interval: Uint16; /**< How soon it can be triggered again after button. */ right_sat: [3] Uint16; /**< Level when joystick is to the positive side; max 0xFFFF. */ left_sat: [3] Uint16; /**< Level when joystick is to the negative side; max 0xFFFF. */ right_coeff: [3] Sint16; /**< How fast to increase the force towards the positive side. */ left_coeff: [3] Sint16; /**< How fast to increase the force towards the negative side. */ deadband: [3] Uint16; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */ center: [3] Sint16; /**< Position of the dead zone. */ } /** * A structure containing a template for a Ramp effect. * * This struct is exclusively for the SDL_HAPTIC_RAMP effect. * * The ramp effect starts at start strength and ends at end strength. It * augments in linear fashion. If you use attack and fade with a ramp the * effects get added to the ramp effect making the effect become quadratic * instead of linear. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_RAMP * \sa SDL_HapticEffect */ SDL_HapticRamp :: struct { type: Uint16; /**< SDL_HAPTIC_RAMP */ direction: SDL_HapticDirection; /**< Direction of the effect. */ length: Uint32; /**< Duration of the effect. */ delay: Uint16; /**< Delay before starting the effect. */ button: Uint16; /**< Button that triggers the effect. */ interval: Uint16; /**< How soon it can be triggered again after button. */ start: Sint16; /**< Beginning strength level. */ end: Sint16; /**< Ending strength level. */ attack_length: Uint16; /**< Duration of the attack. */ attack_level: Uint16; /**< Level at the start of the attack. */ fade_length: Uint16; /**< Duration of the fade. */ fade_level: Uint16; /**< Level at the end of the fade. */ } /** * A structure containing a template for a Left/Right effect. * * This struct is exclusively for the SDL_HAPTIC_LEFTRIGHT effect. * * The Left/Right effect is used to explicitly control the large and small * motors, commonly found in modern game controllers. The small (right) motor * is high frequency, and the large (left) motor is low frequency. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HapticEffect */ SDL_HapticLeftRight :: struct { type: Uint16; /**< SDL_HAPTIC_LEFTRIGHT */ length: Uint32; /**< Duration of the effect in milliseconds. */ large_magnitude: Uint16; /**< Control of the large controller motor. */ small_magnitude: Uint16; /**< Control of the small controller motor. */ } /** * A structure containing a template for the SDL_HAPTIC_CUSTOM effect. * * This struct is exclusively for the SDL_HAPTIC_CUSTOM effect. * * A custom force feedback effect is much like a periodic effect, where the * application can define its exact shape. You will have to allocate the data * yourself. Data should consist of channels * samples Uint16 samples. * * If channels is one, the effect is rotated using the defined direction. * Otherwise it uses the samples in data for the different axes. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_HAPTIC_CUSTOM * \sa SDL_HapticEffect */ SDL_HapticCustom :: struct { type: Uint16; /**< SDL_HAPTIC_CUSTOM */ direction: SDL_HapticDirection; /**< Direction of the effect. */ length: Uint32; /**< Duration of the effect. */ delay: Uint16; /**< Delay before starting the effect. */ button: Uint16; /**< Button that triggers the effect. */ interval: Uint16; /**< How soon it can be triggered again after button. */ channels: Uint8; /**< Axes to use, minimum of one. */ period: Uint16; /**< Sample periods. */ samples: Uint16; /**< Amount of samples. */ data: *Uint16; /**< Should contain channels*samples items. */ attack_length: Uint16; /**< Duration of the attack. */ attack_level: Uint16; /**< Level at the start of the attack. */ fade_length: Uint16; /**< Duration of the fade. */ fade_level: Uint16; /**< Level at the end of the fade. */ } /** * The generic template for any haptic effect. * * All values max at 32767 (0x7FFF). Signed values also can be negative. Time * values unless specified otherwise are in milliseconds. * * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value. * Neither delay, interval, attack_length nor fade_length support * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. * * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of * SDL_HAPTIC_INFINITY. * * Button triggers may not be supported on all devices, it is advised to not * use them if possible. Buttons start at index 1 instead of index 0 like the * joystick. * * If both attack_length and fade_level are 0, the envelope is not used, * otherwise both values are used. * * Common parts: * * ```c * // Replay - All effects have this * Uint32 length; // Duration of effect (ms). * Uint16 delay; // Delay before starting effect. * * // Trigger - All effects have this * Uint16 button; // Button that triggers effect. * Uint16 interval; // How soon before effect can be triggered again. * * // Envelope - All effects except condition effects have this * Uint16 attack_length; // Duration of the attack (ms). * Uint16 attack_level; // Level at the start of the attack. * Uint16 fade_length; // Duration of the fade out (ms). * Uint16 fade_level; // Level at the end of the fade. * ``` * * Here we have an example of a constant effect evolution in time: * * ``` * Strength * ^ * | * | effect level --> _________________ * | / \ * | / \ * | / \ * | / \ * | attack_level --> | \ * | | | <--- fade_level * | * +--------------------------------------------------> Time * [--] [---] * attack_length fade_length * * [------------------][-----------------------] * delay length * ``` * * Note either the attack_level or the fade_level may be above the actual * effect level. * * \since This struct is available since SDL 3.2.0. * * \sa SDL_HapticConstant * \sa SDL_HapticPeriodic * \sa SDL_HapticCondition * \sa SDL_HapticRamp * \sa SDL_HapticLeftRight * \sa SDL_HapticCustom */ SDL_HapticEffect :: union { type: Uint16; /**< Effect type. */ constant: SDL_HapticConstant; /**< Constant effect. */ periodic: SDL_HapticPeriodic; /**< Periodic effect. */ condition: SDL_HapticCondition; /**< Condition effect. */ ramp: SDL_HapticRamp; /**< Ramp effect. */ leftright: SDL_HapticLeftRight; /**< Left/Right effect. */ custom: SDL_HapticCustom; /**< Custom effect. */ } /** * This is a unique ID for a haptic device for the time it is connected to the * system, and is never reused for the lifetime of the application. * * If the haptic device is disconnected and reconnected, it will get a new ID. * * The value 0 is an invalid ID. * * \since This datatype is available since SDL 3.2.0. */ SDL_HapticID :: Uint32; /** * Get a list of currently connected haptic devices. * * \param count a pointer filled in with the number of haptic devices * returned, may be NULL. * \returns a 0 terminated array of haptic device instance IDs or NULL on * failure; call SDL_GetError() for more information. This should be * freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenHaptic */ SDL_GetHaptics :: (count: *s32) -> *SDL_HapticID #foreign libsdl3; /** * Get the implementation dependent name of a haptic device. * * This can be called before any haptic devices are opened. * * \param instance_id the haptic device instance ID. * \returns the name of the selected haptic device. If no name can be found, * this function returns NULL; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticName * \sa SDL_OpenHaptic */ SDL_GetHapticNameForID :: (instance_id: SDL_HapticID) -> *u8 #foreign libsdl3; /** * Open a haptic device for use. * * The index passed as an argument refers to the N'th haptic device on this * system. * * When opening a haptic device, its gain will be set to maximum and * autocenter will be disabled. To modify these values use SDL_SetHapticGain() * and SDL_SetHapticAutocenter(). * * \param instance_id the haptic device instance ID. * \returns the device identifier or NULL on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseHaptic * \sa SDL_GetHaptics * \sa SDL_OpenHapticFromJoystick * \sa SDL_OpenHapticFromMouse * \sa SDL_SetHapticAutocenter * \sa SDL_SetHapticGain */ SDL_OpenHaptic :: (instance_id: SDL_HapticID) -> *SDL_Haptic #foreign libsdl3; /** * Get the SDL_Haptic associated with an instance ID, if it has been opened. * * \param instance_id the instance ID to get the SDL_Haptic for. * \returns an SDL_Haptic on success or NULL on failure or if it hasn't been * opened yet; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetHapticFromID :: (instance_id: SDL_HapticID) -> *SDL_Haptic #foreign libsdl3; /** * Get the instance ID of an opened haptic device. * * \param haptic the SDL_Haptic device to query. * \returns the instance ID of the specified haptic device on success or 0 on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetHapticID :: (haptic: *SDL_Haptic) -> SDL_HapticID #foreign libsdl3; /** * Get the implementation dependent name of a haptic device. * * \param haptic the SDL_Haptic obtained from SDL_OpenJoystick(). * \returns the name of the selected haptic device. If no name can be found, * this function returns NULL; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticNameForID */ SDL_GetHapticName :: (haptic: *SDL_Haptic) -> *u8 #foreign libsdl3; /** * Query whether or not the current mouse has haptic capabilities. * * \returns true if the mouse is haptic or false if it isn't. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenHapticFromMouse */ SDL_IsMouseHaptic :: () -> bool #foreign libsdl3; /** * Try to open a haptic device from the current mouse. * * \returns the haptic device identifier or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseHaptic * \sa SDL_IsMouseHaptic */ SDL_OpenHapticFromMouse :: () -> *SDL_Haptic #foreign libsdl3; /** * Query if a joystick has haptic features. * * \param joystick the SDL_Joystick to test for haptic capabilities. * \returns true if the joystick is haptic or false if it isn't. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenHapticFromJoystick */ SDL_IsJoystickHaptic :: (joystick: *SDL_Joystick) -> bool #foreign libsdl3; /** * Open a haptic device for use from a joystick device. * * You must still close the haptic device separately. It will not be closed * with the joystick. * * When opened from a joystick you should first close the haptic device before * closing the joystick device. If not, on some implementations the haptic * device will also get unallocated and you'll be unable to use force feedback * on that device. * * \param joystick the SDL_Joystick to create a haptic device from. * \returns a valid haptic device identifier on success or NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseHaptic * \sa SDL_IsJoystickHaptic */ SDL_OpenHapticFromJoystick :: (joystick: *SDL_Joystick) -> *SDL_Haptic #foreign libsdl3; /** * Close a haptic device previously opened with SDL_OpenHaptic(). * * \param haptic the SDL_Haptic device to close. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenHaptic */ SDL_CloseHaptic :: (haptic: *SDL_Haptic) -> void #foreign libsdl3; /** * Get the number of effects a haptic device can store. * * On some platforms this isn't fully supported, and therefore is an * approximation. Always check to see if your created effect was actually * created and do not rely solely on SDL_GetMaxHapticEffects(). * * \param haptic the SDL_Haptic device to query. * \returns the number of effects the haptic device can store or a negative * error code on failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMaxHapticEffectsPlaying * \sa SDL_GetHapticFeatures */ SDL_GetMaxHapticEffects :: (haptic: *SDL_Haptic) -> s32 #foreign libsdl3; /** * Get the number of effects a haptic device can play at the same time. * * This is not supported on all platforms, but will always return a value. * * \param haptic the SDL_Haptic device to query maximum playing effects. * \returns the number of effects the haptic device can play at the same time * or -1 on failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetMaxHapticEffects * \sa SDL_GetHapticFeatures */ SDL_GetMaxHapticEffectsPlaying :: (haptic: *SDL_Haptic) -> s32 #foreign libsdl3; /** * Get the haptic device's supported features in bitwise manner. * * \param haptic the SDL_Haptic device to query. * \returns a list of supported haptic features in bitwise manner (OR'd), or 0 * on failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_HapticEffectSupported * \sa SDL_GetMaxHapticEffects */ SDL_GetHapticFeatures :: (haptic: *SDL_Haptic) -> Uint32 #foreign libsdl3; /** * Get the number of haptic axes the device has. * * The number of haptic axes might be useful if working with the * SDL_HapticDirection effect. * * \param haptic the SDL_Haptic device to query. * \returns the number of axes on success or -1 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetNumHapticAxes :: (haptic: *SDL_Haptic) -> s32 #foreign libsdl3; /** * Check to see if an effect is supported by a haptic device. * * \param haptic the SDL_Haptic device to query. * \param effect the desired effect to query. * \returns true if the effect is supported or false if it isn't. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateHapticEffect * \sa SDL_GetHapticFeatures */ SDL_HapticEffectSupported :: (haptic: *SDL_Haptic, effect: *SDL_HapticEffect) -> bool #foreign libsdl3; /** * Create a new haptic effect on a specified device. * * \param haptic an SDL_Haptic device to create the effect on. * \param effect an SDL_HapticEffect structure containing the properties of * the effect to create. * \returns the ID of the effect on success or -1 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyHapticEffect * \sa SDL_RunHapticEffect * \sa SDL_UpdateHapticEffect */ SDL_CreateHapticEffect :: (haptic: *SDL_Haptic, effect: *SDL_HapticEffect) -> s32 #foreign libsdl3; /** * Update the properties of an effect. * * Can be used dynamically, although behavior when dynamically changing * direction may be strange. Specifically the effect may re-upload itself and * start playing from the start. You also cannot change the type either when * running SDL_UpdateHapticEffect(). * * \param haptic the SDL_Haptic device that has the effect. * \param effect the identifier of the effect to update. * \param data an SDL_HapticEffect structure containing the new effect * properties to use. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateHapticEffect * \sa SDL_RunHapticEffect */ SDL_UpdateHapticEffect :: (haptic: *SDL_Haptic, effect: s32, data: *SDL_HapticEffect) -> bool #foreign libsdl3; /** * Run the haptic effect on its associated haptic device. * * To repeat the effect over and over indefinitely, set `iterations` to * `SDL_HAPTIC_INFINITY`. (Repeats the envelope - attack and fade.) To make * one instance of the effect last indefinitely (so the effect does not fade), * set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY` * instead. * * \param haptic the SDL_Haptic device to run the effect on. * \param effect the ID of the haptic effect to run. * \param iterations the number of iterations to run the effect; use * `SDL_HAPTIC_INFINITY` to repeat forever. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticEffectStatus * \sa SDL_StopHapticEffect * \sa SDL_StopHapticEffects */ SDL_RunHapticEffect :: (haptic: *SDL_Haptic, effect: s32, iterations: Uint32) -> bool #foreign libsdl3; /** * Stop the haptic effect on its associated haptic device. * * \param haptic the SDL_Haptic device to stop the effect on. * \param effect the ID of the haptic effect to stop. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RunHapticEffect * \sa SDL_StopHapticEffects */ SDL_StopHapticEffect :: (haptic: *SDL_Haptic, effect: s32) -> bool #foreign libsdl3; /** * Destroy a haptic effect on the device. * * This will stop the effect if it's running. Effects are automatically * destroyed when the device is closed. * * \param haptic the SDL_Haptic device to destroy the effect on. * \param effect the ID of the haptic effect to destroy. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateHapticEffect */ SDL_DestroyHapticEffect :: (haptic: *SDL_Haptic, effect: s32) -> void #foreign libsdl3; /** * Get the status of the current effect on the specified haptic device. * * Device must support the SDL_HAPTIC_STATUS feature. * * \param haptic the SDL_Haptic device to query for the effect status on. * \param effect the ID of the haptic effect to query its status. * \returns true if it is playing, false if it isn't playing or haptic status * isn't supported. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticFeatures */ SDL_GetHapticEffectStatus :: (haptic: *SDL_Haptic, effect: s32) -> bool #foreign libsdl3; /** * Set the global gain of the specified haptic device. * * Device must support the SDL_HAPTIC_GAIN feature. * * The user may specify the maximum gain by setting the environment variable * `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to * SDL_SetHapticGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the * maximum. * * \param haptic the SDL_Haptic device to set the gain on. * \param gain value to set the gain to, should be between 0 and 100 (0 - * 100). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticFeatures */ SDL_SetHapticGain :: (haptic: *SDL_Haptic, gain: s32) -> bool #foreign libsdl3; /** * Set the global autocenter of the device. * * Autocenter should be between 0 and 100. Setting it to 0 will disable * autocentering. * * Device must support the SDL_HAPTIC_AUTOCENTER feature. * * \param haptic the SDL_Haptic device to set autocentering on. * \param autocenter value to set autocenter to (0-100). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHapticFeatures */ SDL_SetHapticAutocenter :: (haptic: *SDL_Haptic, autocenter: s32) -> bool #foreign libsdl3; /** * Pause a haptic device. * * Device must support the `SDL_HAPTIC_PAUSE` feature. Call SDL_ResumeHaptic() * to resume playback. * * Do not modify the effects nor add new ones while the device is paused. That * can cause all sorts of weird errors. * * \param haptic the SDL_Haptic device to pause. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ResumeHaptic */ SDL_PauseHaptic :: (haptic: *SDL_Haptic) -> bool #foreign libsdl3; /** * Resume a haptic device. * * Call to unpause after SDL_PauseHaptic(). * * \param haptic the SDL_Haptic device to unpause. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PauseHaptic */ SDL_ResumeHaptic :: (haptic: *SDL_Haptic) -> bool #foreign libsdl3; /** * Stop all the currently playing effects on a haptic device. * * \param haptic the SDL_Haptic device to stop. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RunHapticEffect * \sa SDL_StopHapticEffects */ SDL_StopHapticEffects :: (haptic: *SDL_Haptic) -> bool #foreign libsdl3; /** * Check whether rumble is supported on a haptic device. * * \param haptic haptic device to check for rumble support. * \returns true if the effect is supported or false if it isn't. * * \since This function is available since SDL 3.2.0. * * \sa SDL_InitHapticRumble */ SDL_HapticRumbleSupported :: (haptic: *SDL_Haptic) -> bool #foreign libsdl3; /** * Initialize a haptic device for simple rumble playback. * * \param haptic the haptic device to initialize for simple rumble playback. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PlayHapticRumble * \sa SDL_StopHapticRumble * \sa SDL_HapticRumbleSupported */ SDL_InitHapticRumble :: (haptic: *SDL_Haptic) -> bool #foreign libsdl3; /** * Run a simple rumble effect on a haptic device. * * \param haptic the haptic device to play the rumble effect on. * \param strength strength of the rumble to play as a 0-1 float value. * \param length length of the rumble to play in milliseconds. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_InitHapticRumble * \sa SDL_StopHapticRumble */ SDL_PlayHapticRumble :: (haptic: *SDL_Haptic, strength: float, length: Uint32) -> bool #foreign libsdl3; /** * Stop the simple rumble on a haptic device. * * \param haptic the haptic device to stop the rumble effect on. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_PlayHapticRumble */ SDL_StopHapticRumble :: (haptic: *SDL_Haptic) -> bool #foreign libsdl3; SDL_hid_device :: struct {} /** * HID underlying bus types. * * \since This enum is available since SDL 3.2.0. */ using SDL_hid_bus_type :: enum u32 { SDL_HID_API_BUS_UNKNOWN :: 0; SDL_HID_API_BUS_USB :: 1; SDL_HID_API_BUS_BLUETOOTH :: 2; SDL_HID_API_BUS_I2C :: 3; SDL_HID_API_BUS_SPI :: 4; } /** * Information about a connected HID device * * \since This struct is available since SDL 3.2.0. */ SDL_hid_device_info :: struct { /** Platform-specific device path */ path: *u8; /** Device Vendor ID */ vendor_id: u16; /** Device Product ID */ product_id: u16; /** Serial Number */ serial_number: *s32; /** Device Release Number in binary-coded decimal, also known as Device Version Number */ release_number: u16; /** Manufacturer String */ manufacturer_string: *s32; /** Product string */ product_string: *s32; /** Usage Page for this Device/Interface (Windows/Mac/hidraw only) */ usage_page: u16; /** Usage for this Device/Interface (Windows/Mac/hidraw only) */ usage: u16; /** The USB interface which this logical device represents. Valid only if the device is a USB HID device. Set to -1 in all other cases. */ interface_number: s32; /** Additional information about the USB interface. Valid on libusb and Android implementations. */ interface_class: s32; interface_subclass: s32; interface_protocol: s32; /** Underlying bus type */ bus_type: SDL_hid_bus_type; /** Pointer to the next device */ next: *SDL_hid_device_info; } /** * Initialize the HIDAPI library. * * This function initializes the HIDAPI library. Calling it is not strictly * necessary, as it will be called automatically by SDL_hid_enumerate() and * any of the SDL_hid_open_*() functions if it is needed. This function should * be called at the beginning of execution however, if there is a chance of * HIDAPI handles being opened by different threads simultaneously. * * Each call to this function should have a matching call to SDL_hid_exit() * * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_hid_exit */ SDL_hid_init :: () -> s32 #foreign libsdl3; /** * Finalize the HIDAPI library. * * This function frees all of the static data associated with HIDAPI. It * should be called at the end of execution to avoid memory leaks. * * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_hid_init */ SDL_hid_exit :: () -> s32 #foreign libsdl3; /** * Check to see if devices may have been added or removed. * * Enumerating the HID devices is an expensive operation, so you can call this * to see if there have been any system device changes since the last call to * this function. A change in the counter returned doesn't necessarily mean * that anything has changed, but you can call SDL_hid_enumerate() to get an * updated device list. * * Calling this function for the first time may cause a thread or other system * resource to be allocated to track device change notifications. * * \returns a change counter that is incremented with each potential device * change, or 0 if device change detection isn't available. * * \since This function is available since SDL 3.2.0. * * \sa SDL_hid_enumerate */ SDL_hid_device_change_count :: () -> Uint32 #foreign libsdl3; /** * Enumerate the HID Devices. * * This function returns a linked list of all the HID devices attached to the * system which match vendor_id and product_id. If `vendor_id` is set to 0 * then any vendor matches. If `product_id` is set to 0 then any product * matches. If `vendor_id` and `product_id` are both set to 0, then all HID * devices will be returned. * * By default SDL will only enumerate controllers, to reduce risk of hanging * or crashing on bad drivers, but SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS * can be set to "0" to enumerate all HID devices. * * \param vendor_id the Vendor ID (VID) of the types of device to open, or 0 * to match any vendor. * \param product_id the Product ID (PID) of the types of device to open, or 0 * to match any product. * \returns a pointer to a linked list of type SDL_hid_device_info, containing * information about the HID devices attached to the system, or NULL * in the case of failure. Free this linked list by calling * SDL_hid_free_enumeration(). * * \since This function is available since SDL 3.2.0. * * \sa SDL_hid_device_change_count */ SDL_hid_enumerate :: (vendor_id: u16, product_id: u16) -> *SDL_hid_device_info #foreign libsdl3; /** * Free an enumeration linked list. * * This function frees a linked list created by SDL_hid_enumerate(). * * \param devs pointer to a list of struct_device returned from * SDL_hid_enumerate(). * * \since This function is available since SDL 3.2.0. */ SDL_hid_free_enumeration :: (devs: *SDL_hid_device_info) -> void #foreign libsdl3; /** * Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally * a serial number. * * If `serial_number` is NULL, the first device with the specified VID and PID * is opened. * * \param vendor_id the Vendor ID (VID) of the device to open. * \param product_id the Product ID (PID) of the device to open. * \param serial_number the Serial Number of the device to open (Optionally * NULL). * \returns a pointer to a SDL_hid_device object on success or NULL on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_open :: (vendor_id: u16, product_id: u16, serial_number: *s32) -> *SDL_hid_device #foreign libsdl3; /** * Open a HID device by its path name. * * The path name be determined by calling SDL_hid_enumerate(), or a * platform-specific path name can be used (eg: /dev/hidraw0 on Linux). * * \param path the path name of the device to open. * \returns a pointer to a SDL_hid_device object on success or NULL on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_open_path :: (path: *u8) -> *SDL_hid_device #foreign libsdl3; /** * Write an Output report to a HID device. * * The first byte of `data` must contain the Report ID. For devices which only * support a single report, this must be set to 0x0. The remaining bytes * contain the report data. Since the Report ID is mandatory, calls to * SDL_hid_write() will always contain one more byte than the report contains. * For example, if a hid report is 16 bytes long, 17 bytes must be passed to * SDL_hid_write(), the Report ID (or 0x0, for devices with a single report), * followed by the report data (16 bytes). In this example, the length passed * in would be 17. * * SDL_hid_write() will send the data on the first OUT endpoint, if one * exists. If it does not, it will send the data through the Control Endpoint * (Endpoint 0). * * \param dev a device handle returned from SDL_hid_open(). * \param data the data to send, including the report number as the first * byte. * \param length the length in bytes of the data to send. * \returns the actual number of bytes written and -1 on on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_write :: (dev: *SDL_hid_device, data: *u8, length: u64) -> s32 #foreign libsdl3; /** * Read an Input report from a HID device with timeout. * * Input reports are returned to the host through the INTERRUPT IN endpoint. * The first byte will contain the Report number if the device uses numbered * reports. * * \param dev a device handle returned from SDL_hid_open(). * \param data a buffer to put the read data into. * \param length the number of bytes to read. For devices with multiple * reports, make sure to read an extra byte for the report * number. * \param milliseconds timeout in milliseconds or -1 for blocking wait. * \returns the actual number of bytes read and -1 on on failure; call * SDL_GetError() for more information. If no packet was available to * be read within the timeout period, this function returns 0. * * \since This function is available since SDL 3.2.0. */ SDL_hid_read_timeout :: (dev: *SDL_hid_device, data: *u8, length: u64, milliseconds: s32) -> s32 #foreign libsdl3; /** * Read an Input report from a HID device. * * Input reports are returned to the host through the INTERRUPT IN endpoint. * The first byte will contain the Report number if the device uses numbered * reports. * * \param dev a device handle returned from SDL_hid_open(). * \param data a buffer to put the read data into. * \param length the number of bytes to read. For devices with multiple * reports, make sure to read an extra byte for the report * number. * \returns the actual number of bytes read and -1 on failure; call * SDL_GetError() for more information. If no packet was available to * be read and the handle is in non-blocking mode, this function * returns 0. * * \since This function is available since SDL 3.2.0. */ SDL_hid_read :: (dev: *SDL_hid_device, data: *u8, length: u64) -> s32 #foreign libsdl3; /** * Set the device handle to be non-blocking. * * In non-blocking mode calls to SDL_hid_read() will return immediately with a * value of 0 if there is no data to be read. In blocking mode, SDL_hid_read() * will wait (block) until there is data to read before returning. * * Nonblocking can be turned on and off at any time. * * \param dev a device handle returned from SDL_hid_open(). * \param nonblock enable or not the nonblocking reads - 1 to enable * nonblocking - 0 to disable nonblocking. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_set_nonblocking :: (dev: *SDL_hid_device, nonblock: s32) -> s32 #foreign libsdl3; /** * Send a Feature report to the device. * * Feature reports are sent over the Control endpoint as a Set_Report * transfer. The first byte of `data` must contain the Report ID. For devices * which only support a single report, this must be set to 0x0. The remaining * bytes contain the report data. Since the Report ID is mandatory, calls to * SDL_hid_send_feature_report() will always contain one more byte than the * report contains. For example, if a hid report is 16 bytes long, 17 bytes * must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for * devices which do not use numbered reports), followed by the report data (16 * bytes). In this example, the length passed in would be 17. * * \param dev a device handle returned from SDL_hid_open(). * \param data the data to send, including the report number as the first * byte. * \param length the length in bytes of the data to send, including the report * number. * \returns the actual number of bytes written and -1 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_send_feature_report :: (dev: *SDL_hid_device, data: *u8, length: u64) -> s32 #foreign libsdl3; /** * Get a feature report from a HID device. * * Set the first byte of `data` to the Report ID of the report to be read. * Make sure to allow space for this extra byte in `data`. Upon return, the * first byte will still contain the Report ID, and the report data will start * in data[1]. * * \param dev a device handle returned from SDL_hid_open(). * \param data a buffer to put the read data into, including the Report ID. * Set the first byte of `data` to the Report ID of the report to * be read, or set it to zero if your device does not use numbered * reports. * \param length the number of bytes to read, including an extra byte for the * report ID. The buffer can be longer than the actual report. * \returns the number of bytes read plus one for the report ID (which is * still in the first byte), or -1 on on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_get_feature_report :: (dev: *SDL_hid_device, data: *u8, length: u64) -> s32 #foreign libsdl3; /** * Get an input report from a HID device. * * Set the first byte of `data` to the Report ID of the report to be read. * Make sure to allow space for this extra byte in `data`. Upon return, the * first byte will still contain the Report ID, and the report data will start * in data[1]. * * \param dev a device handle returned from SDL_hid_open(). * \param data a buffer to put the read data into, including the Report ID. * Set the first byte of `data` to the Report ID of the report to * be read, or set it to zero if your device does not use numbered * reports. * \param length the number of bytes to read, including an extra byte for the * report ID. The buffer can be longer than the actual report. * \returns the number of bytes read plus one for the report ID (which is * still in the first byte), or -1 on on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_get_input_report :: (dev: *SDL_hid_device, data: *u8, length: u64) -> s32 #foreign libsdl3; /** * Close a HID device. * * \param dev a device handle returned from SDL_hid_open(). * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_close :: (dev: *SDL_hid_device) -> s32 #foreign libsdl3; /** * Get The Manufacturer String from a HID device. * * \param dev a device handle returned from SDL_hid_open(). * \param string a wide string buffer to put the data into. * \param maxlen the length of the buffer in multiples of wchar_t. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_get_manufacturer_string :: (dev: *SDL_hid_device, _string: *s32, maxlen: u64) -> s32 #foreign libsdl3; /** * Get The Product String from a HID device. * * \param dev a device handle returned from SDL_hid_open(). * \param string a wide string buffer to put the data into. * \param maxlen the length of the buffer in multiples of wchar_t. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_get_product_string :: (dev: *SDL_hid_device, _string: *s32, maxlen: u64) -> s32 #foreign libsdl3; /** * Get The Serial Number String from a HID device. * * \param dev a device handle returned from SDL_hid_open(). * \param string a wide string buffer to put the data into. * \param maxlen the length of the buffer in multiples of wchar_t. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_get_serial_number_string :: (dev: *SDL_hid_device, _string: *s32, maxlen: u64) -> s32 #foreign libsdl3; /** * Get a string from a HID device, based on its string index. * * \param dev a device handle returned from SDL_hid_open(). * \param string_index the index of the string to get. * \param string a wide string buffer to put the data into. * \param maxlen the length of the buffer in multiples of wchar_t. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_get_indexed_string :: (dev: *SDL_hid_device, string_index: s32, _string: *s32, maxlen: u64) -> s32 #foreign libsdl3; /** * Get the device info from a HID device. * * \param dev a device handle returned from SDL_hid_open(). * \returns a pointer to the SDL_hid_device_info for this hid_device or NULL * on failure; call SDL_GetError() for more information. This struct * is valid until the device is closed with SDL_hid_close(). * * \since This function is available since SDL 3.2.0. */ SDL_hid_get_device_info :: (dev: *SDL_hid_device) -> *SDL_hid_device_info #foreign libsdl3; /** * Get a report descriptor from a HID device. * * User has to provide a preallocated buffer where descriptor will be copied * to. The recommended size for a preallocated buffer is 4096 bytes. * * \param dev a device handle returned from SDL_hid_open(). * \param buf the buffer to copy descriptor into. * \param buf_size the size of the buffer in bytes. * \returns the number of bytes actually copied or -1 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_hid_get_report_descriptor :: (dev: *SDL_hid_device, buf: *u8, buf_size: u64) -> s32 #foreign libsdl3; /** * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers. * * \param active true to start the scan, false to stop the scan. * * \since This function is available since SDL 3.2.0. */ SDL_hid_ble_scan :: (active: bool) -> void #foreign libsdl3; /** * An enumeration of hint priorities. * * \since This enum is available since SDL 3.2.0. */ using SDL_HintPriority :: enum u32 { SDL_HINT_DEFAULT :: 0; SDL_HINT_NORMAL :: 1; SDL_HINT_OVERRIDE :: 2; } /** * Set a hint with a specific priority. * * The priority controls the behavior when setting a hint that already has a * value. Hints will replace existing hints of their priority and lower. * Environment variables are considered to have override priority. * * \param name the hint to set. * \param value the value of the hint variable. * \param priority the SDL_HintPriority level for the hint. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHint * \sa SDL_ResetHint * \sa SDL_SetHint */ SDL_SetHintWithPriority :: (name: *u8, value: *u8, priority: SDL_HintPriority) -> bool #foreign libsdl3; /** * Set a hint with normal priority. * * Hints will not be set if there is an existing override hint or environment * variable that takes precedence. You can use SDL_SetHintWithPriority() to * set the hint with override priority instead. * * \param name the hint to set. * \param value the value of the hint variable. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHint * \sa SDL_ResetHint * \sa SDL_SetHintWithPriority */ SDL_SetHint :: (name: *u8, value: *u8) -> bool #foreign libsdl3; /** * Reset a hint to the default value. * * This will reset a hint to the value of the environment variable, or NULL if * the environment isn't set. Callbacks will be called normally with this * change. * * \param name the hint to set. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetHint * \sa SDL_ResetHints */ SDL_ResetHint :: (name: *u8) -> bool #foreign libsdl3; /** * Reset all hints to the default values. * * This will reset all hints to the value of the associated environment * variable, or NULL if the environment isn't set. Callbacks will be called * normally with this change. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ResetHint */ SDL_ResetHints :: () -> void #foreign libsdl3; /** * Get the value of a hint. * * \param name the hint to query. * \returns the string value of a hint or NULL if the hint isn't set. * * \threadsafety It is safe to call this function from any thread, however the * return value only remains valid until the hint is changed; if * another thread might do so, the app should supply locks * and/or make a copy of the string. Note that using a hint * callback instead is always thread-safe, as SDL holds a lock * on the thread subsystem during the callback. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetHint * \sa SDL_SetHintWithPriority */ SDL_GetHint :: (name: *u8) -> *u8 #foreign libsdl3; /** * Get the boolean value of a hint variable. * * \param name the name of the hint to get the boolean value from. * \param default_value the value to return if the hint does not exist. * \returns the boolean value of a hint or the provided default value if the * hint does not exist. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetHint * \sa SDL_SetHint */ SDL_GetHintBoolean :: (name: *u8, default_value: bool) -> bool #foreign libsdl3; /** * A callback used to send notifications of hint value changes. * * This is called an initial time during SDL_AddHintCallback with the hint's * current value, and then again each time the hint's value changes. * * \param userdata what was passed as `userdata` to SDL_AddHintCallback(). * \param name what was passed as `name` to SDL_AddHintCallback(). * \param oldValue the previous hint value. * \param newValue the new value hint is to be set to. * * \threadsafety This callback is fired from whatever thread is setting a new * hint value. SDL holds a lock on the hint subsystem when * calling this callback. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_AddHintCallback */ SDL_HintCallback :: #type (userdata: *void, name: *u8, oldValue: *u8, newValue: *u8) -> void #c_call; /** * Add a function to watch a particular hint. * * The callback function is called _during_ this function, to provide it an * initial value, and again each time the hint's value changes. * * \param name the hint to watch. * \param callback An SDL_HintCallback function that will be called when the * hint value changes. * \param userdata a pointer to pass to the callback function. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RemoveHintCallback */ SDL_AddHintCallback :: (name: *u8, callback: SDL_HintCallback, userdata: *void) -> bool #foreign libsdl3; /** * Remove a function watching a particular hint. * * \param name the hint being watched. * \param callback an SDL_HintCallback function that will be called when the * hint value changes. * \param userdata a pointer being passed to the callback function. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddHintCallback */ SDL_RemoveHintCallback :: (name: *u8, callback: SDL_HintCallback, userdata: *void) -> void #foreign libsdl3; /** * Initialization flags for SDL_Init and/or SDL_InitSubSystem * * These are the flags which may be passed to SDL_Init(). You should specify * the subsystems which you will be using in your application. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_Init * \sa SDL_Quit * \sa SDL_InitSubSystem * \sa SDL_QuitSubSystem * \sa SDL_WasInit */ SDL_InitFlags :: Uint32; /** * Return values for optional main callbacks. * * Returning SDL_APP_SUCCESS or SDL_APP_FAILURE from SDL_AppInit, * SDL_AppEvent, or SDL_AppIterate will terminate the program and report * success/failure to the operating system. What that means is * platform-dependent. On Unix, for example, on success, the process error * code will be zero, and on failure it will be 1. This interface doesn't * allow you to return specific exit codes, just whether there was an error * generally or not. * * Returning SDL_APP_CONTINUE from these functions will let the app continue * to run. * * See * [Main callbacks in SDL3](https://wiki.libsdl.org/SDL3/README/main-functions#main-callbacks-in-sdl3) * for complete details. * * \since This enum is available since SDL 3.2.0. */ using SDL_AppResult :: enum u32 { SDL_APP_CONTINUE :: 0; SDL_APP_SUCCESS :: 1; SDL_APP_FAILURE :: 2; } /** * Function pointer typedef for SDL_AppInit. * * These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind * the scenes for apps using the optional main callbacks. Apps that want to * use this should just implement SDL_AppInit directly. * * \param appstate a place where the app can optionally store a pointer for * future use. * \param argc the standard ANSI C main's argc; number of elements in `argv`. * \param argv the standard ANSI C main's argv; array of command line * arguments. * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to * terminate with success, SDL_APP_CONTINUE to continue. * * \since This datatype is available since SDL 3.2.0. */ SDL_AppInit_func :: #type (appstate: **void, argc: s32, argv: **u8) -> SDL_AppResult #c_call; /** * Function pointer typedef for SDL_AppIterate. * * These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind * the scenes for apps using the optional main callbacks. Apps that want to * use this should just implement SDL_AppIterate directly. * * \param appstate an optional pointer, provided by the app in SDL_AppInit. * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to * terminate with success, SDL_APP_CONTINUE to continue. * * \since This datatype is available since SDL 3.2.0. */ SDL_AppIterate_func :: #type (appstate: *void) -> SDL_AppResult #c_call; /** * Function pointer typedef for SDL_AppEvent. * * These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind * the scenes for apps using the optional main callbacks. Apps that want to * use this should just implement SDL_AppEvent directly. * * \param appstate an optional pointer, provided by the app in SDL_AppInit. * \param event the new event for the app to examine. * \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to * terminate with success, SDL_APP_CONTINUE to continue. * * \since This datatype is available since SDL 3.2.0. */ SDL_AppEvent_func :: #type (appstate: *void, event: *SDL_Event) -> SDL_AppResult #c_call; /** * Function pointer typedef for SDL_AppQuit. * * These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind * the scenes for apps using the optional main callbacks. Apps that want to * use this should just implement SDL_AppEvent directly. * * \param appstate an optional pointer, provided by the app in SDL_AppInit. * \param result the result code that terminated the app (success or failure). * * \since This datatype is available since SDL 3.2.0. */ SDL_AppQuit_func :: #type (appstate: *void, result: SDL_AppResult) -> void #c_call; /** * Initialize the SDL library. * * SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the * two may be used interchangeably. Though for readability of your code * SDL_InitSubSystem() might be preferred. * * The file I/O (for example: SDL_IOFromFile) and threading (SDL_CreateThread) * subsystems are initialized by default. Message boxes * (SDL_ShowSimpleMessageBox) also attempt to work without initializing the * video subsystem, in hopes of being useful in showing an error dialog when * SDL_Init fails. You must specifically initialize other subsystems if you * use them in your application. * * Logging (such as SDL_Log) works without initialization, too. * * `flags` may be any of the following OR'd together: * * - `SDL_INIT_AUDIO`: audio subsystem; automatically initializes the events * subsystem * - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events * subsystem, should be initialized on the main thread. * - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the * events subsystem * - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem * - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically initializes the * joystick subsystem * - `SDL_INIT_EVENTS`: events subsystem * - `SDL_INIT_SENSOR`: sensor subsystem; automatically initializes the events * subsystem * - `SDL_INIT_CAMERA`: camera subsystem; automatically initializes the events * subsystem * * Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem() * for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or * call SDL_Quit() to force shutdown). If a subsystem is already loaded then * this call will increase the ref-count and return. * * Consider reporting some basic metadata about your application before * calling SDL_Init, using either SDL_SetAppMetadata() or * SDL_SetAppMetadataProperty(). * * \param flags subsystem initialization flags. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAppMetadata * \sa SDL_SetAppMetadataProperty * \sa SDL_InitSubSystem * \sa SDL_Quit * \sa SDL_SetMainReady * \sa SDL_WasInit */ SDL_Init :: (flags: SDL_InitFlags) -> bool #foreign libsdl3; /** * Compatibility function to initialize the SDL library. * * This function and SDL_Init() are interchangeable. * * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Init * \sa SDL_Quit * \sa SDL_QuitSubSystem */ SDL_InitSubSystem :: (flags: SDL_InitFlags) -> bool #foreign libsdl3; /** * Shut down specific SDL subsystems. * * You still need to call SDL_Quit() even if you close all open subsystems * with SDL_QuitSubSystem(). * * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. * * \since This function is available since SDL 3.2.0. * * \sa SDL_InitSubSystem * \sa SDL_Quit */ SDL_QuitSubSystem :: (flags: SDL_InitFlags) -> void #foreign libsdl3; /** * Get a mask of the specified subsystems which are currently initialized. * * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. * \returns a mask of all initialized subsystems if `flags` is 0, otherwise it * returns the initialization status of the specified subsystems. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Init * \sa SDL_InitSubSystem */ SDL_WasInit :: (flags: SDL_InitFlags) -> SDL_InitFlags #foreign libsdl3; /** * Clean up all initialized subsystems. * * You should call this function even if you have already shutdown each * initialized subsystem with SDL_QuitSubSystem(). It is safe to call this * function even in the case of errors in initialization. * * You can use this function with atexit() to ensure that it is run when your * application is shutdown, but it is not wise to do this from a library or * other dynamically loaded code. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Init * \sa SDL_QuitSubSystem */ SDL_Quit :: () -> void #foreign libsdl3; /** * Return whether this is the main thread. * * On Apple platforms, the main thread is the thread that runs your program's * main() entry point. On other platforms, the main thread is the one that * calls SDL_Init(SDL_INIT_VIDEO), which should usually be the one that runs * your program's main() entry point. If you are using the main callbacks, * SDL_AppInit(), SDL_AppIterate(), and SDL_AppQuit() are all called on the * main thread. * * \returns true if this thread is the main thread, or false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RunOnMainThread */ SDL_IsMainThread :: () -> bool #foreign libsdl3; /** * Callback run on the main thread. * * \param userdata an app-controlled pointer that is passed to the callback. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_RunOnMainThread */ SDL_MainThreadCallback :: #type (userdata: *void) -> void #c_call; /** * Call a function on the main thread during event processing. * * If this is called on the main thread, the callback is executed immediately. * If this is called on another thread, this callback is queued for execution * on the main thread during event processing. * * Be careful of deadlocks when using this functionality. You should not have * the main thread wait for the current thread while this function is being * called with `wait_complete` true. * * \param callback the callback to call on the main thread. * \param userdata a pointer that is passed to `callback`. * \param wait_complete true to wait for the callback to complete, false to * return immediately. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_IsMainThread */ SDL_RunOnMainThread :: (callback: SDL_MainThreadCallback, userdata: *void, wait_complete: bool) -> bool #foreign libsdl3; /** * Specify basic metadata about your app. * * You can optionally provide metadata about your app to SDL. This is not * required, but strongly encouraged. * * There are several locations where SDL can make use of metadata (an "About" * box in the macOS menu bar, the name of the app can be shown on some audio * mixers, etc). Any piece of metadata can be left as NULL, if a specific * detail doesn't make sense for the app. * * This function should be called as early as possible, before SDL_Init. * Multiple calls to this function are allowed, but various state might not * change once it has been set up with a previous call to this function. * * Passing a NULL removes any previous metadata. * * This is a simplified interface for the most important information. You can * supply significantly more detailed metadata with * SDL_SetAppMetadataProperty(). * * \param appname The name of the application ("My Game 2: Bad Guy's * Revenge!"). * \param appversion The version of the application ("1.0.0beta5" or a git * hash, or whatever makes sense). * \param appidentifier A unique string in reverse-domain format that * identifies this app ("com.example.mygame2"). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAppMetadataProperty */ SDL_SetAppMetadata :: (appname: *u8, appversion: *u8, appidentifier: *u8) -> bool #foreign libsdl3; /** * Specify metadata about your app through a set of properties. * * You can optionally provide metadata about your app to SDL. This is not * required, but strongly encouraged. * * There are several locations where SDL can make use of metadata (an "About" * box in the macOS menu bar, the name of the app can be shown on some audio * mixers, etc). Any piece of metadata can be left out, if a specific detail * doesn't make sense for the app. * * This function should be called as early as possible, before SDL_Init. * Multiple calls to this function are allowed, but various state might not * change once it has been set up with a previous call to this function. * * Once set, this metadata can be read using SDL_GetAppMetadataProperty(). * * These are the supported properties: * * - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of the * application, like "My Game 2: Bad Guy's Revenge!". This will show up * anywhere the OS shows the name of the application separately from window * titles, such as volume control applets, etc. This defaults to "SDL * Application". * - `SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is * running; there are no rules on format, so "1.0.3beta2" and "April 22nd, * 2024" and a git hash are all valid options. This has no default. * - `SDL_PROP_APP_METADATA_IDENTIFIER_STRING`: A unique string that * identifies this app. This must be in reverse-domain format, like * "com.example.mygame2". This string is used by desktop compositors to * identify and group windows together, as well as match applications with * associated desktop settings and icons. If you plan to package your * application in a container such as Flatpak, the app ID should match the * name of your Flatpak container as well. This has no default. * - `SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the * creator/developer/maker of this app, like "MojoWorkshop, LLC" * - `SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright * notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this * to one line, don't paste a copy of a whole software license in here. This * has no default. * - `SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a * product page, or a storefront, or even a GitHub repository, for user's * further information This has no default. * - `SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is. * Currently this string can be "game" for a video game, "mediaplayer" for a * media player, or generically "application" if nothing else applies. * Future versions of SDL might add new types. This defaults to * "application". * * \param name the name of the metadata property to set. * \param value the value of the property, or NULL to remove that property. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetAppMetadataProperty * \sa SDL_SetAppMetadata */ SDL_SetAppMetadataProperty :: (name: *u8, value: *u8) -> bool #foreign libsdl3; /** * Get metadata about your app. * * This returns metadata previously set using SDL_SetAppMetadata() or * SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list * of available properties and their meanings. * * \param name the name of the metadata property to get. * \returns the current value of the metadata property, or the default if it * is not set, NULL for properties with no default. * * \threadsafety It is safe to call this function from any thread, although * the string returned is not protected and could potentially be * freed if you call SDL_SetAppMetadataProperty() to set that * property from another thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetAppMetadata * \sa SDL_SetAppMetadataProperty */ SDL_GetAppMetadataProperty :: (name: *u8) -> *u8 #foreign libsdl3; SDL_SharedObject :: struct {} /** * Dynamically load a shared object. * * \param sofile a system-dependent name of the object file. * \returns an opaque pointer to the object handle or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadFunction * \sa SDL_UnloadObject */ SDL_LoadObject :: (sofile: *u8) -> *SDL_SharedObject #foreign libsdl3; /** * Look up the address of the named function in a shared object. * * This function pointer is no longer valid after calling SDL_UnloadObject(). * * This function can only look up C function names. Other languages may have * name mangling and intrinsic language support that varies from compiler to * compiler. * * Make sure you declare your function pointers with the same calling * convention as the actual library function. Your code will crash * mysteriously if you do not do this. * * If the requested function doesn't exist, NULL is returned. * * \param handle a valid shared object handle returned by SDL_LoadObject(). * \param name the name of the function to look up. * \returns a pointer to the function or NULL on failure; call SDL_GetError() * for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadObject */ SDL_LoadFunction :: (handle: *SDL_SharedObject, name: *u8) -> SDL_FunctionPointer #foreign libsdl3; /** * Unload a shared object from memory. * * Note that any pointers from this object looked up through * SDL_LoadFunction() will no longer be valid. * * \param handle a valid shared object handle returned by SDL_LoadObject(). * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LoadObject */ SDL_UnloadObject :: (handle: *SDL_SharedObject) -> void #foreign libsdl3; /** * A struct to provide locale data. * * Locale data is split into a spoken language, like English, and an optional * country, like Canada. The language will be in ISO-639 format (so English * would be "en"), and the country, if not NULL, will be an ISO-3166 country * code (so Canada would be "CA"). * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPreferredLocales */ SDL_Locale :: struct { language: *u8; /**< A language name, like "en" for English. */ country: *u8; /**< A country, like "US" for America. Can be NULL. */ } /** * Report the user's preferred locale. * * Returned language strings are in the format xx, where 'xx' is an ISO-639 * language specifier (such as "en" for English, "de" for German, etc). * Country strings are in the format YY, where "YY" is an ISO-3166 country * code (such as "US" for the United States, "CA" for Canada, etc). Country * might be NULL if there's no specific guidance on them (so you might get { * "en", "US" } for American English, but { "en", NULL } means "English * language, generically"). Language strings are never NULL, except to * terminate the array. * * Please note that not all of these strings are 2 characters; some are three * or more. * * The returned list of locales are in the order of the user's preference. For * example, a German citizen that is fluent in US English and knows enough * Japanese to navigate around Tokyo might have a list like: { "de", "en_US", * "jp", NULL }. Someone from England might prefer British English (where * "color" is spelled "colour", etc), but will settle for anything like it: { * "en_GB", "en", NULL }. * * This function returns NULL on error, including when the platform does not * supply this information at all. * * This might be a "slow" call that has to query the operating system. It's * best to ask for this once and save the results. However, this list can * change, usually because the user has changed a system preference outside of * your program; SDL will send an SDL_EVENT_LOCALE_CHANGED event in this case, * if possible, and you can call this function again to get an updated copy of * preferred locales. * * \param count a pointer filled in with the number of locales returned, may * be NULL. * \returns a NULL terminated array of locale pointers, or NULL on failure; * call SDL_GetError() for more information. This is a single * allocation that should be freed with SDL_free() when it is no * longer needed. * * \since This function is available since SDL 3.2.0. */ SDL_GetPreferredLocales :: (count: *s32) -> **SDL_Locale #foreign libsdl3; /** * The predefined log categories * * By default the application and gpu categories are enabled at the INFO * level, the assert category is enabled at the WARN level, test is enabled at * the VERBOSE level and all other categories are enabled at the ERROR level. * * \since This enum is available since SDL 3.2.0. */ using SDL_LogCategory :: enum u32 { SDL_LOG_CATEGORY_APPLICATION :: 0; SDL_LOG_CATEGORY_ERROR :: 1; SDL_LOG_CATEGORY_ASSERT :: 2; SDL_LOG_CATEGORY_SYSTEM :: 3; SDL_LOG_CATEGORY_AUDIO :: 4; SDL_LOG_CATEGORY_VIDEO :: 5; SDL_LOG_CATEGORY_RENDER :: 6; SDL_LOG_CATEGORY_INPUT :: 7; SDL_LOG_CATEGORY_TEST :: 8; SDL_LOG_CATEGORY_GPU :: 9; SDL_LOG_CATEGORY_RESERVED2 :: 10; SDL_LOG_CATEGORY_RESERVED3 :: 11; SDL_LOG_CATEGORY_RESERVED4 :: 12; SDL_LOG_CATEGORY_RESERVED5 :: 13; SDL_LOG_CATEGORY_RESERVED6 :: 14; SDL_LOG_CATEGORY_RESERVED7 :: 15; SDL_LOG_CATEGORY_RESERVED8 :: 16; SDL_LOG_CATEGORY_RESERVED9 :: 17; SDL_LOG_CATEGORY_RESERVED10 :: 18; SDL_LOG_CATEGORY_CUSTOM :: 19; } /** * The predefined log priorities * * \since This enum is available since SDL 3.2.0. */ using SDL_LogPriority :: enum u32 { SDL_LOG_PRIORITY_INVALID :: 0; SDL_LOG_PRIORITY_TRACE :: 1; SDL_LOG_PRIORITY_VERBOSE :: 2; SDL_LOG_PRIORITY_DEBUG :: 3; SDL_LOG_PRIORITY_INFO :: 4; SDL_LOG_PRIORITY_WARN :: 5; SDL_LOG_PRIORITY_ERROR :: 6; SDL_LOG_PRIORITY_CRITICAL :: 7; SDL_LOG_PRIORITY_COUNT :: 8; } /** * Set the priority of all log categories. * * \param priority the SDL_LogPriority to assign. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ResetLogPriorities * \sa SDL_SetLogPriority */ SDL_SetLogPriorities :: (priority: SDL_LogPriority) -> void #foreign libsdl3; /** * Set the priority of a particular log category. * * \param category the category to assign a priority to. * \param priority the SDL_LogPriority to assign. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetLogPriority * \sa SDL_ResetLogPriorities * \sa SDL_SetLogPriorities */ SDL_SetLogPriority :: (category: s32, priority: SDL_LogPriority) -> void #foreign libsdl3; /** * Get the priority of a particular log category. * * \param category the category to query. * \returns the SDL_LogPriority for the requested category. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetLogPriority */ SDL_GetLogPriority :: (category: s32) -> SDL_LogPriority #foreign libsdl3; /** * Reset all priorities to default. * * This is called by SDL_Quit(). * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetLogPriorities * \sa SDL_SetLogPriority */ SDL_ResetLogPriorities :: () -> void #foreign libsdl3; /** * Set the text prepended to log messages of a given priority. * * By default SDL_LOG_PRIORITY_INFO and below have no prefix, and * SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g. * "WARNING: ". * * \param priority the SDL_LogPriority to modify. * \param prefix the prefix to use for that log priority, or NULL to use no * prefix. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetLogPriorities * \sa SDL_SetLogPriority */ SDL_SetLogPriorityPrefix :: (priority: SDL_LogPriority, prefix: *u8) -> bool #foreign libsdl3; /** * Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO. * * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the `fmt` string, if * any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LogCritical * \sa SDL_LogDebug * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ SDL_Log_CFormat :: (fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_Log"; SDL_Log :: (fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_Log_CFormat("%s", formatted_text.data); } @PrintLike /** * Log a message with SDL_LOG_PRIORITY_TRACE. * * \param category the category of the message. * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical * \sa SDL_LogDebug * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ SDL_LogTrace_CFormat :: (category: s32, fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_LogTrace"; SDL_LogTrace :: (category: s32, fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_LogTrace_CFormat(category, "%s", formatted_text.data); } @PrintLike /** * Log a message with SDL_LOG_PRIORITY_VERBOSE. * * \param category the category of the message. * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical * \sa SDL_LogDebug * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV * \sa SDL_LogWarn */ SDL_LogVerbose_CFormat :: (category: s32, fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_LogVerbose"; SDL_LogVerbose :: (category: s32, fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_LogVerbose_CFormat(category, "%s", formatted_text.data); } @PrintLike /** * Log a message with SDL_LOG_PRIORITY_DEBUG. * * \param category the category of the message. * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ SDL_LogDebug_CFormat :: (category: s32, fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_LogDebug"; SDL_LogDebug :: (category: s32, fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_LogDebug_CFormat(category, "%s", formatted_text.data); } @PrintLike /** * Log a message with SDL_LOG_PRIORITY_INFO. * * \param category the category of the message. * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical * \sa SDL_LogDebug * \sa SDL_LogError * \sa SDL_LogMessage * \sa SDL_LogMessageV * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ SDL_LogInfo_CFormat :: (category: s32, fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_LogInfo"; SDL_LogInfo :: (category: s32, fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_LogInfo_CFormat(category, "%s", formatted_text.data); } @PrintLike /** * Log a message with SDL_LOG_PRIORITY_WARN. * * \param category the category of the message. * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical * \sa SDL_LogDebug * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV * \sa SDL_LogTrace * \sa SDL_LogVerbose */ SDL_LogWarn_CFormat :: (category: s32, fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_LogWarn"; SDL_LogWarn :: (category: s32, fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_LogWarn_CFormat(category, "%s", formatted_text.data); } @PrintLike /** * Log a message with SDL_LOG_PRIORITY_ERROR. * * \param category the category of the message. * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical * \sa SDL_LogDebug * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ SDL_LogError_CFormat :: (category: s32, fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_LogError"; SDL_LogError :: (category: s32, fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_LogError_CFormat(category, "%s", formatted_text.data); } @PrintLike /** * Log a message with SDL_LOG_PRIORITY_CRITICAL. * * \param category the category of the message. * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogDebug * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ SDL_LogCritical_CFormat :: (category: s32, fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_LogCritical"; SDL_LogCritical :: (category: s32, fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_LogCritical_CFormat(category, "%s", formatted_text.data); } @PrintLike /** * Log a message with the specified category and priority. * * \param category the category of the message. * \param priority the priority of the message. * \param fmt a printf() style message format string. * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Log * \sa SDL_LogCritical * \sa SDL_LogDebug * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessageV * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ SDL_LogMessage_CFormat :: (category: s32, priority: SDL_LogPriority, fmt: *u8, __args: ..Any) -> void #foreign libsdl3 "SDL_LogMessage"; SDL_LogMessage :: (category: s32, priority: SDL_LogPriority, fmt: string, __args: ..Any) { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); SDL_LogMessage_CFormat(category, priority, "%s", formatted_text.data); } @PrintLike /** * The prototype for the log output callback function. * * This function is called by SDL when there is new text to be logged. A mutex * is held so that this function is never called by more than one thread at * once. * * \param userdata what was passed as `userdata` to * SDL_SetLogOutputFunction(). * \param category the category of the message. * \param priority the priority of the message. * \param message the message being output. * * \since This datatype is available since SDL 3.2.0. */ SDL_LogOutputFunction :: #type (userdata: *void, category: s32, priority: SDL_LogPriority, message: *u8) -> void #c_call; /** * Get the default log output function. * * \returns the default log output callback. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetLogOutputFunction * \sa SDL_GetLogOutputFunction */ SDL_GetDefaultLogOutputFunction :: () -> SDL_LogOutputFunction #foreign libsdl3; /** * Get the current log output function. * * \param callback an SDL_LogOutputFunction filled in with the current log * callback. * \param userdata a pointer filled in with the pointer that is passed to * `callback`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDefaultLogOutputFunction * \sa SDL_SetLogOutputFunction */ SDL_GetLogOutputFunction :: (callback: *SDL_LogOutputFunction, userdata: **void) -> void #foreign libsdl3; /** * Replace the default log output function with one of your own. * * \param callback an SDL_LogOutputFunction to call instead of the default. * \param userdata a pointer that is passed to `callback`. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetDefaultLogOutputFunction * \sa SDL_GetLogOutputFunction */ SDL_SetLogOutputFunction :: (callback: SDL_LogOutputFunction, userdata: *void) -> void #foreign libsdl3; /** * Message box flags. * * If supported will display warning icon, etc. * * \since This datatype is available since SDL 3.2.0. */ SDL_MessageBoxFlags :: Uint32; /** * SDL_MessageBoxButtonData flags. * * \since This datatype is available since SDL 3.2.0. */ SDL_MessageBoxButtonFlags :: Uint32; /** * Individual button data. * * \since This struct is available since SDL 3.2.0. */ SDL_MessageBoxButtonData :: struct { flags: SDL_MessageBoxButtonFlags; buttonID: s32; /**< User defined button id (value returned via SDL_ShowMessageBox) */ text: *u8; /**< The UTF-8 button text */ } /** * RGB value used in a message box color scheme * * \since This struct is available since SDL 3.2.0. */ SDL_MessageBoxColor :: struct { r: Uint8; g: Uint8; b: Uint8; } /** * An enumeration of indices inside the colors array of * SDL_MessageBoxColorScheme. */ using SDL_MessageBoxColorType :: enum u32 { SDL_MESSAGEBOX_COLOR_BACKGROUND :: 0; SDL_MESSAGEBOX_COLOR_TEXT :: 1; SDL_MESSAGEBOX_COLOR_BUTTON_BORDER :: 2; SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND :: 3; SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED :: 4; SDL_MESSAGEBOX_COLOR_COUNT :: 5; } /** * A set of colors to use for message box dialogs * * \since This struct is available since SDL 3.2.0. */ SDL_MessageBoxColorScheme :: struct { colors: [5] SDL_MessageBoxColor; } /** * MessageBox structure containing title, text, window, etc. * * \since This struct is available since SDL 3.2.0. */ SDL_MessageBoxData :: struct { flags: SDL_MessageBoxFlags; window: *SDL_Window; /**< Parent window, can be NULL */ title: *u8; /**< UTF-8 title */ message: *u8; /**< UTF-8 message text */ numbuttons: s32; buttons: *SDL_MessageBoxButtonData; colorScheme: *SDL_MessageBoxColorScheme; /**< SDL_MessageBoxColorScheme, can be NULL to use system settings */ } /** * Create a modal message box. * * If your needs aren't complex, it might be easier to use * SDL_ShowSimpleMessageBox. * * This function should be called on the thread that created the parent * window, or on the main thread if the messagebox has no parent. It will * block execution of that thread until the user clicks a button or closes the * messagebox. * * This function may be called at any time, even before SDL_Init(). This makes * it useful for reporting errors like a failure to create a renderer or * OpenGL context. * * On X11, SDL rolls its own dialog box with X11 primitives instead of a * formal toolkit like GTK+ or Qt. * * Note that if SDL_Init() would fail because there isn't any available video * target, this function is likely to fail for the same reasons. If this is a * concern, check the return value from this function and fall back to writing * to stderr if you can. * * \param messageboxdata the SDL_MessageBoxData structure with title, text and * other options. * \param buttonid the pointer to which user id of hit button should be * copied. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ShowSimpleMessageBox */ SDL_ShowMessageBox :: (messageboxdata: *SDL_MessageBoxData, buttonid: *s32) -> bool #foreign libsdl3; /** * Display a simple modal message box. * * If your needs aren't complex, this function is preferred over * SDL_ShowMessageBox. * * `flags` may be any of the following: * * - `SDL_MESSAGEBOX_ERROR`: error dialog * - `SDL_MESSAGEBOX_WARNING`: warning dialog * - `SDL_MESSAGEBOX_INFORMATION`: informational dialog * * This function should be called on the thread that created the parent * window, or on the main thread if the messagebox has no parent. It will * block execution of that thread until the user clicks a button or closes the * messagebox. * * This function may be called at any time, even before SDL_Init(). This makes * it useful for reporting errors like a failure to create a renderer or * OpenGL context. * * On X11, SDL rolls its own dialog box with X11 primitives instead of a * formal toolkit like GTK+ or Qt. * * Note that if SDL_Init() would fail because there isn't any available video * target, this function is likely to fail for the same reasons. If this is a * concern, check the return value from this function and fall back to writing * to stderr if you can. * * \param flags an SDL_MessageBoxFlags value. * \param title UTF-8 title text. * \param message UTF-8 message text. * \param window the parent window, or NULL for no parent. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ShowMessageBox */ SDL_ShowSimpleMessageBox :: (flags: SDL_MessageBoxFlags, title: *u8, message: *u8, window: *SDL_Window) -> bool #foreign libsdl3; /** * A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). * * \since This datatype is available since SDL 3.2.0. */ SDL_MetalView :: *void; /** * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified * window. * * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on * its own. It is up to user code to do that. * * The returned handle can be casted directly to a NSView or UIView. To access * the backing CAMetalLayer, call SDL_Metal_GetLayer(). * * \param window the window. * \returns handle NSView or UIView. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Metal_DestroyView * \sa SDL_Metal_GetLayer */ SDL_Metal_CreateView :: (window: *SDL_Window) -> SDL_MetalView #foreign libsdl3; /** * Destroy an existing SDL_MetalView object. * * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was * called after SDL_CreateWindow. * * \param view the SDL_MetalView object. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Metal_CreateView */ SDL_Metal_DestroyView :: (view: SDL_MetalView) -> void #foreign libsdl3; /** * Get a pointer to the backing CAMetalLayer for the given view. * * \param view the SDL_MetalView object. * \returns a pointer. * * \since This function is available since SDL 3.2.0. */ SDL_Metal_GetLayer :: (view: SDL_MetalView) -> *void #foreign libsdl3; /** * Open a URL/URI in the browser or other appropriate external application. * * Open a URL in a separate, system-provided application. How this works will * vary wildly depending on the platform. This will likely launch what makes * sense to handle a specific URL's protocol (a web browser for `http://`, * etc), but it might also be able to launch file managers for directories and * other things. * * What happens when you open a URL varies wildly as well: your game window * may lose focus (and may or may not lose focus if your game was fullscreen * or grabbing input at the time). On mobile devices, your app will likely * move to the background or your process might be paused. Any given platform * may or may not handle a given URL. * * If this is unimplemented (or simply unavailable) for a platform, this will * fail with an error. A successful result does not mean the URL loaded, just * that we launched _something_ to handle it (or at least believe we did). * * All this to say: this function can be useful, but you should definitely * test it on every platform you target. * * \param url a valid URL/URI to open. Use `file:///full/path/to/file` for * local files, if supported. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_OpenURL :: (url: *u8) -> bool #foreign libsdl3; /** * Get the name of the platform. * * Here are the names returned for some (but not all) supported platforms: * * - "Windows" * - "macOS" * - "Linux" * - "iOS" * - "Android" * * \returns the name of the platform. If the correct platform name is not * available, returns a string beginning with the text "Unknown". * * \since This function is available since SDL 3.2.0. */ SDL_GetPlatform :: () -> *u8 #foreign libsdl3; SDL_Process :: struct {} /** * Create a new process. * * The path to the executable is supplied in args[0]. args[1..N] are * additional arguments passed on the command line of the new process, and the * argument list should be terminated with a NULL, e.g.: * * ```c * const char *args[] = { "myprogram", "argument", NULL }; * ``` * * Setting pipe_stdio to true is equivalent to setting * `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` and * `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` to `SDL_PROCESS_STDIO_APP`, and * will allow the use of SDL_ReadProcess() or SDL_GetProcessInput() and * SDL_GetProcessOutput(). * * See SDL_CreateProcessWithProperties() for more details. * * \param args the path and arguments for the new process. * \param pipe_stdio true to create pipes to the process's standard input and * from the process's standard output, false for the process * to have no input and inherit the application's standard * output. * \returns the newly created and running process, or NULL if the process * couldn't be created. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcessWithProperties * \sa SDL_GetProcessProperties * \sa SDL_ReadProcess * \sa SDL_GetProcessInput * \sa SDL_GetProcessOutput * \sa SDL_KillProcess * \sa SDL_WaitProcess * \sa SDL_DestroyProcess */ SDL_CreateProcess :: (args: **u8, pipe_stdio: bool) -> *SDL_Process #foreign libsdl3; /** * Description of where standard I/O should be directed when creating a * process. * * If a standard I/O stream is set to SDL_PROCESS_STDIO_INHERITED, it will go * to the same place as the application's I/O stream. This is the default for * standard output and standard error. * * If a standard I/O stream is set to SDL_PROCESS_STDIO_NULL, it is connected * to `NUL:` on Windows and `/dev/null` on POSIX systems. This is the default * for standard input. * * If a standard I/O stream is set to SDL_PROCESS_STDIO_APP, it is connected * to a new SDL_IOStream that is available to the application. Standard input * will be available as `SDL_PROP_PROCESS_STDIN_POINTER` and allows * SDL_GetProcessInput(), standard output will be available as * `SDL_PROP_PROCESS_STDOUT_POINTER` and allows SDL_ReadProcess() and * SDL_GetProcessOutput(), and standard error will be available as * `SDL_PROP_PROCESS_STDERR_POINTER` in the properties for the created * process. * * If a standard I/O stream is set to SDL_PROCESS_STDIO_REDIRECT, it is * connected to an existing SDL_IOStream provided by the application. Standard * input is provided using `SDL_PROP_PROCESS_CREATE_STDIN_POINTER`, standard * output is provided using `SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`, and * standard error is provided using `SDL_PROP_PROCESS_CREATE_STDERR_POINTER` * in the creation properties. These existing streams should be closed by the * application once the new process is created. * * In order to use an SDL_IOStream with SDL_PROCESS_STDIO_REDIRECT, it must * have `SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER` or * `SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER` set. This is true for streams * representing files and process I/O. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_CreateProcessWithProperties * \sa SDL_GetProcessProperties * \sa SDL_ReadProcess * \sa SDL_GetProcessInput * \sa SDL_GetProcessOutput */ using SDL_ProcessIO :: enum u32 { SDL_PROCESS_STDIO_INHERITED :: 0; SDL_PROCESS_STDIO_NULL :: 1; SDL_PROCESS_STDIO_APP :: 2; SDL_PROCESS_STDIO_REDIRECT :: 3; } /** * Create a new process with the specified properties. * * These are the supported properties: * * - `SDL_PROP_PROCESS_CREATE_ARGS_POINTER`: an array of strings containing * the program to run, any arguments, and a NULL pointer, e.g. const char * *args[] = { "myprogram", "argument", NULL }. This is a required property. * - `SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER`: an SDL_Environment * pointer. If this property is set, it will be the entire environment for * the process, otherwise the current environment is used. * - `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER`: an SDL_ProcessIO value describing * where standard input for the process comes from, defaults to * `SDL_PROCESS_STDIO_NULL`. * - `SDL_PROP_PROCESS_CREATE_STDIN_POINTER`: an SDL_IOStream pointer used for * standard input when `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` is set to * `SDL_PROCESS_STDIO_REDIRECT`. * - `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`: an SDL_ProcessIO value * describing where standard output for the process goes go, defaults to * `SDL_PROCESS_STDIO_INHERITED`. * - `SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`: an SDL_IOStream pointer used * for standard output when `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` is set * to `SDL_PROCESS_STDIO_REDIRECT`. * - `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER`: an SDL_ProcessIO value * describing where standard error for the process goes go, defaults to * `SDL_PROCESS_STDIO_INHERITED`. * - `SDL_PROP_PROCESS_CREATE_STDERR_POINTER`: an SDL_IOStream pointer used * for standard error when `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER` is set to * `SDL_PROCESS_STDIO_REDIRECT`. * - `SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN`: true if the error * output of the process should be redirected into the standard output of * the process. This property has no effect if * `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER` is set. * - `SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN`: true if the process should * run in the background. In this case the default input and output is * `SDL_PROCESS_STDIO_NULL` and the exitcode of the process is not * available, and will always be 0. * * On POSIX platforms, wait() and waitpid(-1, ...) should not be called, and * SIGCHLD should not be ignored or handled because those would prevent SDL * from properly tracking the lifetime of the underlying process. You should * use SDL_WaitProcess() instead. * * \param props the properties to use. * \returns the newly created and running process, or NULL if the process * couldn't be created. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_GetProcessProperties * \sa SDL_ReadProcess * \sa SDL_GetProcessInput * \sa SDL_GetProcessOutput * \sa SDL_KillProcess * \sa SDL_WaitProcess * \sa SDL_DestroyProcess */ SDL_CreateProcessWithProperties :: (props: SDL_PropertiesID) -> *SDL_Process #foreign libsdl3; /** * Get the properties associated with a process. * * The following read-only properties are provided by SDL: * * - `SDL_PROP_PROCESS_PID_NUMBER`: the process ID of the process. * - `SDL_PROP_PROCESS_STDIN_POINTER`: an SDL_IOStream that can be used to * write input to the process, if it was created with * `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` set to `SDL_PROCESS_STDIO_APP`. * - `SDL_PROP_PROCESS_STDOUT_POINTER`: a non-blocking SDL_IOStream that can * be used to read output from the process, if it was created with * `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` set to `SDL_PROCESS_STDIO_APP`. * - `SDL_PROP_PROCESS_STDERR_POINTER`: a non-blocking SDL_IOStream that can * be used to read error output from the process, if it was created with * `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER` set to `SDL_PROCESS_STDIO_APP`. * - `SDL_PROP_PROCESS_BACKGROUND_BOOLEAN`: true if the process is running in * the background. * * \param process the process to query. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties */ SDL_GetProcessProperties :: (process: *SDL_Process) -> SDL_PropertiesID #foreign libsdl3; /** * Read all the output from a process. * * If a process was created with I/O enabled, you can use this function to * read the output. This function blocks until the process is complete, * capturing all output, and providing the process exit code. * * The data is allocated with a zero byte at the end (null terminated) for * convenience. This extra byte is not included in the value reported via * `datasize`. * * The data should be freed with SDL_free(). * * \param process The process to read. * \param datasize a pointer filled in with the number of bytes read, may be * NULL. * \param exitcode a pointer filled in with the process exit code if the * process has exited, may be NULL. * \returns the data or NULL on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties * \sa SDL_DestroyProcess */ SDL_ReadProcess :: (process: *SDL_Process, datasize: *u64, exitcode: *s32) -> *void #foreign libsdl3; /** * Get the SDL_IOStream associated with process standard input. * * The process must have been created with SDL_CreateProcess() and pipe_stdio * set to true, or with SDL_CreateProcessWithProperties() and * `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` set to `SDL_PROCESS_STDIO_APP`. * * Writing to this stream can return less data than expected if the process * hasn't read its input. It may be blocked waiting for its output to be read, * if so you may need to call SDL_GetProcessOutput() and read the output in * parallel with writing input. * * \param process The process to get the input stream for. * \returns the input stream or NULL on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties * \sa SDL_GetProcessOutput */ SDL_GetProcessInput :: (process: *SDL_Process) -> *SDL_IOStream #foreign libsdl3; /** * Get the SDL_IOStream associated with process standard output. * * The process must have been created with SDL_CreateProcess() and pipe_stdio * set to true, or with SDL_CreateProcessWithProperties() and * `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` set to `SDL_PROCESS_STDIO_APP`. * * Reading from this stream can return 0 with SDL_GetIOStatus() returning * SDL_IO_STATUS_NOT_READY if no output is available yet. * * \param process The process to get the output stream for. * \returns the output stream or NULL on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties * \sa SDL_GetProcessInput */ SDL_GetProcessOutput :: (process: *SDL_Process) -> *SDL_IOStream #foreign libsdl3; /** * Stop a process. * * \param process The process to stop. * \param force true to terminate the process immediately, false to try to * stop the process gracefully. In general you should try to stop * the process gracefully first as terminating a process may * leave it with half-written data or in some other unstable * state. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties * \sa SDL_WaitProcess * \sa SDL_DestroyProcess */ SDL_KillProcess :: (process: *SDL_Process, force: bool) -> bool #foreign libsdl3; /** * Wait for a process to finish. * * This can be called multiple times to get the status of a process. * * The exit code will be the exit code of the process if it terminates * normally, a negative signal if it terminated due to a signal, or -255 * otherwise. It will not be changed if the process is still running. * * If you create a process with standard output piped to the application * (`pipe_stdio` being true) then you should read all of the process output * before calling SDL_WaitProcess(). If you don't do this the process might be * blocked indefinitely waiting for output to be read and SDL_WaitProcess() * will never return true; * * \param process The process to wait for. * \param block If true, block until the process finishes; otherwise, report * on the process' status. * \param exitcode a pointer filled in with the process exit code if the * process has exited, may be NULL. * \returns true if the process exited, false otherwise. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties * \sa SDL_KillProcess * \sa SDL_DestroyProcess */ SDL_WaitProcess :: (process: *SDL_Process, block: bool, exitcode: *s32) -> bool #foreign libsdl3; /** * Destroy a previously created process object. * * Note that this does not stop the process, just destroys the SDL object used * to track it. If you want to stop the process you should use * SDL_KillProcess(). * * \param process The process object to destroy. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProcess * \sa SDL_CreateProcessWithProperties * \sa SDL_KillProcess */ SDL_DestroyProcess :: (process: *SDL_Process) -> void #foreign libsdl3; /** * Vertex structure. * * \since This struct is available since SDL 3.2.0. */ SDL_Vertex :: struct { position: SDL_FPoint; /**< Vertex position, in SDL_Renderer coordinates */ color: SDL_FColor; /**< Vertex color */ tex_coord: SDL_FPoint; /**< Normalized texture coordinates, if needed */ } /** * The access pattern allowed for a texture. * * \since This enum is available since SDL 3.2.0. */ using SDL_TextureAccess :: enum u32 { SDL_TEXTUREACCESS_STATIC :: 0; SDL_TEXTUREACCESS_STREAMING :: 1; SDL_TEXTUREACCESS_TARGET :: 2; } /** * How the logical size is mapped to the output. * * \since This enum is available since SDL 3.2.0. */ using SDL_RendererLogicalPresentation :: enum u32 { SDL_LOGICAL_PRESENTATION_DISABLED :: 0; SDL_LOGICAL_PRESENTATION_STRETCH :: 1; SDL_LOGICAL_PRESENTATION_LETTERBOX :: 2; SDL_LOGICAL_PRESENTATION_OVERSCAN :: 3; SDL_LOGICAL_PRESENTATION_INTEGER_SCALE :: 4; } SDL_Renderer :: struct {} /** * An efficient driver-specific representation of pixel data * * \since This struct is available since SDL 3.2.0. * * \sa SDL_CreateTexture * \sa SDL_CreateTextureFromSurface * \sa SDL_CreateTextureWithProperties * \sa SDL_DestroyTexture */ SDL_Texture :: struct { format: SDL_PixelFormat; /**< The format of the texture, read-only */ w: s32; /**< The width of the texture, read-only. */ h: s32; /**< The height of the texture, read-only. */ refcount: s32; /**< Application reference count, used when freeing texture */ } /** * Get the number of 2D rendering drivers available for the current display. * * A render driver is a set of code that handles rendering and texture * management on a particular display. Normally there is only one, but some * drivers may have several available with different capabilities. * * There may be none if SDL was compiled without render support. * * \returns the number of built in render drivers. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer * \sa SDL_GetRenderDriver */ SDL_GetNumRenderDrivers :: () -> s32 #foreign libsdl3; /** * Use this function to get the name of a built in 2D rendering driver. * * The list of rendering drivers is given in the order that they are normally * initialized by default; the drivers that seem more reasonable to choose * first (as far as the SDL developers believe) are earlier in the list. * * The names of drivers are all simple, low-ASCII identifiers, like "opengl", * "direct3d12" or "metal". These never have Unicode characters, and are not * meant to be proper names. * * \param index the index of the rendering driver; the value ranges from 0 to * SDL_GetNumRenderDrivers() - 1. * \returns the name of the rendering driver at the requested index, or NULL * if an invalid index was specified. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetNumRenderDrivers */ SDL_GetRenderDriver :: (index: s32) -> *u8 #foreign libsdl3; /** * Create a window and default renderer. * * \param title the title of the window, in UTF-8 encoding. * \param width the width of the window. * \param height the height of the window. * \param window_flags the flags used to create the window (see * SDL_CreateWindow()). * \param window a pointer filled with the window, or NULL on error. * \param renderer a pointer filled with the renderer, or NULL on error. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer * \sa SDL_CreateWindow */ SDL_CreateWindowAndRenderer :: (title: *u8, width: s32, height: s32, window_flags: SDL_WindowFlags, window: **SDL_Window, renderer: **SDL_Renderer) -> bool #foreign libsdl3; /** * Create a 2D rendering context for a window. * * If you want a specific renderer, you can specify its name here. A list of * available renderers can be obtained by calling SDL_GetRenderDriver() * multiple times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If you * don't need a specific renderer, specify NULL and SDL will attempt to choose * the best option for you, based on what is available on the user's system. * * If `name` is a comma-separated list, SDL will try each name, in the order * listed, until one succeeds or all of them fail. * * By default the rendering size matches the window size in pixels, but you * can call SDL_SetRenderLogicalPresentation() to change the content size and * scaling options. * * \param window the window where rendering is displayed. * \param name the name of the rendering driver to initialize, or NULL to let * SDL choose one. * \returns a valid rendering context or NULL if there was an error; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRendererWithProperties * \sa SDL_CreateSoftwareRenderer * \sa SDL_DestroyRenderer * \sa SDL_GetNumRenderDrivers * \sa SDL_GetRenderDriver * \sa SDL_GetRendererName */ SDL_CreateRenderer :: (window: *SDL_Window, name: *u8) -> *SDL_Renderer #foreign libsdl3; /** * Create a 2D rendering context for a window, with the specified properties. * * These are the supported properties: * * - `SDL_PROP_RENDERER_CREATE_NAME_STRING`: the name of the rendering driver * to use, if a specific one is desired * - `SDL_PROP_RENDERER_CREATE_WINDOW_POINTER`: the window where rendering is * displayed, required if this isn't a software renderer using a surface * - `SDL_PROP_RENDERER_CREATE_SURFACE_POINTER`: the surface where rendering * is displayed, if you want a software renderer without a window * - `SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER`: an SDL_Colorspace * value describing the colorspace for output to the display, defaults to * SDL_COLORSPACE_SRGB. The direct3d11, direct3d12, and metal renderers * support SDL_COLORSPACE_SRGB_LINEAR, which is a linear color space and * supports HDR output. If you select SDL_COLORSPACE_SRGB_LINEAR, drawing * still uses the sRGB colorspace, but values can go beyond 1.0 and float * (linear) format textures can be used for HDR content. * - `SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER`: non-zero if you want * present synchronized with the refresh rate. This property can take any * value that is supported by SDL_SetRenderVSync() for the renderer. * * With the vulkan renderer: * * - `SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER`: the VkInstance to use * with the renderer, optional. * - `SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER`: the VkSurfaceKHR to use * with the renderer, optional. * - `SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER`: the * VkPhysicalDevice to use with the renderer, optional. * - `SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER`: the VkDevice to use * with the renderer, optional. * - `SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`: the * queue family index used for rendering. * - `SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the * queue family index used for presentation. * * \param props the properties to use. * \returns a valid rendering context or NULL if there was an error; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProperties * \sa SDL_CreateRenderer * \sa SDL_CreateSoftwareRenderer * \sa SDL_DestroyRenderer * \sa SDL_GetRendererName */ SDL_CreateRendererWithProperties :: (props: SDL_PropertiesID) -> *SDL_Renderer #foreign libsdl3; /** * Create a 2D software rendering context for a surface. * * Two other API which can be used to create SDL_Renderer: * SDL_CreateRenderer() and SDL_CreateWindowAndRenderer(). These can _also_ * create a software renderer, but they are intended to be used with an * SDL_Window as the final destination and not an SDL_Surface. * * \param surface the SDL_Surface structure representing the surface where * rendering is done. * \returns a valid rendering context or NULL if there was an error; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DestroyRenderer */ SDL_CreateSoftwareRenderer :: (surface: *SDL_Surface) -> *SDL_Renderer #foreign libsdl3; /** * Get the renderer associated with a window. * * \param window the window to query. * \returns the rendering context on success or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetRenderer :: (window: *SDL_Window) -> *SDL_Renderer #foreign libsdl3; /** * Get the window associated with a renderer. * * \param renderer the renderer to query. * \returns the window on success or NULL on failure; call SDL_GetError() for * more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetRenderWindow :: (renderer: *SDL_Renderer) -> *SDL_Window #foreign libsdl3; /** * Get the name of a renderer. * * \param renderer the rendering context. * \returns the name of the selected renderer, or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer * \sa SDL_CreateRendererWithProperties */ SDL_GetRendererName :: (renderer: *SDL_Renderer) -> *u8 #foreign libsdl3; /** * Get the properties associated with a renderer. * * The following read-only properties are provided by SDL: * * - `SDL_PROP_RENDERER_NAME_STRING`: the name of the rendering driver * - `SDL_PROP_RENDERER_WINDOW_POINTER`: the window where rendering is * displayed, if any * - `SDL_PROP_RENDERER_SURFACE_POINTER`: the surface where rendering is * displayed, if this is a software renderer without a window * - `SDL_PROP_RENDERER_VSYNC_NUMBER`: the current vsync setting * - `SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER`: the maximum texture width * and height * - `SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER`: a (const SDL_PixelFormat *) * array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN, * representing the available texture formats for this renderer. * - `SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER`: an SDL_Colorspace value * describing the colorspace for output to the display, defaults to * SDL_COLORSPACE_SRGB. * - `SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN`: true if the output colorspace is * SDL_COLORSPACE_SRGB_LINEAR and the renderer is showing on a display with * HDR enabled. This property can change dynamically when * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. * - `SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT`: the value of SDR white in the * SDL_COLORSPACE_SRGB_LINEAR colorspace. When HDR is enabled, this value is * automatically multiplied into the color scale. This property can change * dynamically when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. * - `SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT`: the additional high dynamic range * that can be displayed, in terms of the SDR white point. When HDR is not * enabled, this will be 1.0. This property can change dynamically when * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. * * With the direct3d renderer: * * - `SDL_PROP_RENDERER_D3D9_DEVICE_POINTER`: the IDirect3DDevice9 associated * with the renderer * * With the direct3d11 renderer: * * - `SDL_PROP_RENDERER_D3D11_DEVICE_POINTER`: the ID3D11Device associated * with the renderer * - `SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER`: the IDXGISwapChain1 * associated with the renderer. This may change when the window is resized. * * With the direct3d12 renderer: * * - `SDL_PROP_RENDERER_D3D12_DEVICE_POINTER`: the ID3D12Device associated * with the renderer * - `SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER`: the IDXGISwapChain4 * associated with the renderer. * - `SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER`: the ID3D12CommandQueue * associated with the renderer * * With the vulkan renderer: * * - `SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER`: the VkInstance associated * with the renderer * - `SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER`: the VkSurfaceKHR associated * with the renderer * - `SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER`: the VkPhysicalDevice * associated with the renderer * - `SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER`: the VkDevice associated with * the renderer * - `SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`: the queue * family index used for rendering * - `SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the queue * family index used for presentation * - `SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER`: the number of * swapchain images, or potential frames in flight, used by the Vulkan * renderer * * With the gpu renderer: * * - `SDL_PROP_RENDERER_GPU_DEVICE_POINTER`: the SDL_GPUDevice associated with * the renderer * * \param renderer the rendering context. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetRendererProperties :: (renderer: *SDL_Renderer) -> SDL_PropertiesID #foreign libsdl3; /** * Get the output size in pixels of a rendering context. * * This returns the true output size in pixels, ignoring any render targets or * logical size and presentation. * * \param renderer the rendering context. * \param w a pointer filled in with the width in pixels. * \param h a pointer filled in with the height in pixels. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetCurrentRenderOutputSize */ SDL_GetRenderOutputSize :: (renderer: *SDL_Renderer, w: *s32, h: *s32) -> bool #foreign libsdl3; /** * Get the current output size in pixels of a rendering context. * * If a rendering target is active, this will return the size of the rendering * target in pixels, otherwise if a logical size is set, it will return the * logical size, otherwise it will return the value of * SDL_GetRenderOutputSize(). * * \param renderer the rendering context. * \param w a pointer filled in with the current width. * \param h a pointer filled in with the current height. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderOutputSize */ SDL_GetCurrentRenderOutputSize :: (renderer: *SDL_Renderer, w: *s32, h: *s32) -> bool #foreign libsdl3; /** * Create a texture for a rendering context. * * The contents of a texture when first created are not defined. * * \param renderer the rendering context. * \param format one of the enumerated values in SDL_PixelFormat. * \param access one of the enumerated values in SDL_TextureAccess. * \param w the width of the texture in pixels. * \param h the height of the texture in pixels. * \returns the created texture or NULL on failure; call SDL_GetError() for * more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTextureFromSurface * \sa SDL_CreateTextureWithProperties * \sa SDL_DestroyTexture * \sa SDL_GetTextureSize * \sa SDL_UpdateTexture */ SDL_CreateTexture :: (renderer: *SDL_Renderer, format: SDL_PixelFormat, access: SDL_TextureAccess, w: s32, h: s32) -> *SDL_Texture #foreign libsdl3; /** * Create a texture from an existing surface. * * The surface is not modified or freed by this function. * * The SDL_TextureAccess hint for the created texture is * `SDL_TEXTUREACCESS_STATIC`. * * The pixel format of the created texture may be different from the pixel * format of the surface, and can be queried using the * SDL_PROP_TEXTURE_FORMAT_NUMBER property. * * \param renderer the rendering context. * \param surface the SDL_Surface structure containing pixel data used to fill * the texture. * \returns the created texture or NULL on failure; call SDL_GetError() for * more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTexture * \sa SDL_CreateTextureWithProperties * \sa SDL_DestroyTexture */ SDL_CreateTextureFromSurface :: (renderer: *SDL_Renderer, surface: *SDL_Surface) -> *SDL_Texture #foreign libsdl3; /** * Create a texture for a rendering context with the specified properties. * * These are the supported properties: * * - `SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER`: an SDL_Colorspace value * describing the texture colorspace, defaults to SDL_COLORSPACE_SRGB_LINEAR * for floating point textures, SDL_COLORSPACE_HDR10 for 10-bit textures, * SDL_COLORSPACE_SRGB for other RGB textures and SDL_COLORSPACE_JPEG for * YUV textures. * - `SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER`: one of the enumerated values in * SDL_PixelFormat, defaults to the best RGBA format for the renderer * - `SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER`: one of the enumerated values in * SDL_TextureAccess, defaults to SDL_TEXTUREACCESS_STATIC * - `SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER`: the width of the texture in * pixels, required * - `SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER`: the height of the texture in * pixels, required * - `SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating * point textures, this defines the value of 100% diffuse white, with higher * values being displayed in the High Dynamic Range headroom. This defaults * to 100 for HDR10 textures and 1.0 for floating point textures. * - `SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT`: for HDR10 and floating * point textures, this defines the maximum dynamic range used by the * content, in terms of the SDR white point. This would be equivalent to * maxCLL / SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT for HDR10 content. * If this is defined, any values outside the range supported by the display * will be scaled into the available HDR headroom, otherwise they are * clipped. * * With the direct3d11 renderer: * * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D * associated with the texture, if you want to wrap an existing texture. * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D * associated with the U plane of a YUV texture, if you want to wrap an * existing texture. * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D * associated with the V plane of a YUV texture, if you want to wrap an * existing texture. * * With the direct3d12 renderer: * * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER`: the ID3D12Resource * associated with the texture, if you want to wrap an existing texture. * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource * associated with the U plane of a YUV texture, if you want to wrap an * existing texture. * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource * associated with the V plane of a YUV texture, if you want to wrap an * existing texture. * * With the metal renderer: * * - `SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER`: the CVPixelBufferRef * associated with the texture, if you want to create a texture from an * existing pixel buffer. * * With the opengl renderer: * * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER`: the GLuint texture * associated with the texture, if you want to wrap an existing texture. * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture * associated with the UV plane of an NV12 texture, if you want to wrap an * existing texture. * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture * associated with the U plane of a YUV texture, if you want to wrap an * existing texture. * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture * associated with the V plane of a YUV texture, if you want to wrap an * existing texture. * * With the opengles2 renderer: * * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture * associated with the texture, if you want to wrap an existing texture. * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture * associated with the texture, if you want to wrap an existing texture. * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture * associated with the UV plane of an NV12 texture, if you want to wrap an * existing texture. * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture * associated with the U plane of a YUV texture, if you want to wrap an * existing texture. * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture * associated with the V plane of a YUV texture, if you want to wrap an * existing texture. * * With the vulkan renderer: * * - `SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER`: the VkImage with layout * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL associated with the texture, if * you want to wrap an existing texture. * * \param renderer the rendering context. * \param props the properties to use. * \returns the created texture or NULL on failure; call SDL_GetError() for * more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateProperties * \sa SDL_CreateTexture * \sa SDL_CreateTextureFromSurface * \sa SDL_DestroyTexture * \sa SDL_GetTextureSize * \sa SDL_UpdateTexture */ SDL_CreateTextureWithProperties :: (renderer: *SDL_Renderer, props: SDL_PropertiesID) -> *SDL_Texture #foreign libsdl3; /** * Get the properties associated with a texture. * * The following read-only properties are provided by SDL: * * - `SDL_PROP_TEXTURE_COLORSPACE_NUMBER`: an SDL_Colorspace value describing * the texture colorspace. * - `SDL_PROP_TEXTURE_FORMAT_NUMBER`: one of the enumerated values in * SDL_PixelFormat. * - `SDL_PROP_TEXTURE_ACCESS_NUMBER`: one of the enumerated values in * SDL_TextureAccess. * - `SDL_PROP_TEXTURE_WIDTH_NUMBER`: the width of the texture in pixels. * - `SDL_PROP_TEXTURE_HEIGHT_NUMBER`: the height of the texture in pixels. * - `SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point * textures, this defines the value of 100% diffuse white, with higher * values being displayed in the High Dynamic Range headroom. This defaults * to 100 for HDR10 textures and 1.0 for other textures. * - `SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point * textures, this defines the maximum dynamic range used by the content, in * terms of the SDR white point. If this is defined, any values outside the * range supported by the display will be scaled into the available HDR * headroom, otherwise they are clipped. This defaults to 1.0 for SDR * textures, 4.0 for HDR10 textures, and no default for floating point * textures. * * With the direct3d11 renderer: * * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D associated * with the texture * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D * associated with the U plane of a YUV texture * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D * associated with the V plane of a YUV texture * * With the direct3d12 renderer: * * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER`: the ID3D12Resource associated * with the texture * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource associated * with the U plane of a YUV texture * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource associated * with the V plane of a YUV texture * * With the vulkan renderer: * * - `SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER`: the VkImage associated with the * texture * * With the opengl renderer: * * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER`: the GLuint texture associated * with the texture * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture * associated with the UV plane of an NV12 texture * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture associated * with the U plane of a YUV texture * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture associated * with the V plane of a YUV texture * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER`: the GLenum for the * texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_RECTANGLE_ARB`, etc) * - `SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT`: the texture coordinate width of * the texture (0.0 - 1.0) * - `SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT`: the texture coordinate height of * the texture (0.0 - 1.0) * * With the opengles2 renderer: * * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture * associated with the texture * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture * associated with the UV plane of an NV12 texture * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture * associated with the U plane of a YUV texture * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture * associated with the V plane of a YUV texture * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER`: the GLenum for the * texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc) * * \param texture the texture to query. * \returns a valid property ID on success or 0 on failure; call * SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetTextureProperties :: (texture: *SDL_Texture) -> SDL_PropertiesID #foreign libsdl3; /** * Get the renderer that created an SDL_Texture. * * \param texture the texture to query. * \returns a pointer to the SDL_Renderer that created the texture, or NULL on * failure; call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetRendererFromTexture :: (texture: *SDL_Texture) -> *SDL_Renderer #foreign libsdl3; /** * Get the size of a texture, as floating point values. * * \param texture the texture to query. * \param w a pointer filled in with the width of the texture in pixels. This * argument can be NULL if you don't need this information. * \param h a pointer filled in with the height of the texture in pixels. This * argument can be NULL if you don't need this information. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetTextureSize :: (texture: *SDL_Texture, w: *float, h: *float) -> bool #foreign libsdl3; /** * Set an additional color value multiplied into render copy operations. * * When this texture is rendered, during the copy operation each source color * channel is modulated by the appropriate color value according to the * following formula: * * `srcC = srcC * (color / 255)` * * Color modulation is not always supported by the renderer; it will return * false if color modulation is not supported. * * \param texture the texture to update. * \param r the red color value multiplied into copy operations. * \param g the green color value multiplied into copy operations. * \param b the blue color value multiplied into copy operations. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureColorMod * \sa SDL_SetTextureAlphaMod * \sa SDL_SetTextureColorModFloat */ SDL_SetTextureColorMod :: (texture: *SDL_Texture, r: Uint8, g: Uint8, b: Uint8) -> bool #foreign libsdl3; /** * Set an additional color value multiplied into render copy operations. * * When this texture is rendered, during the copy operation each source color * channel is modulated by the appropriate color value according to the * following formula: * * `srcC = srcC * color` * * Color modulation is not always supported by the renderer; it will return * false if color modulation is not supported. * * \param texture the texture to update. * \param r the red color value multiplied into copy operations. * \param g the green color value multiplied into copy operations. * \param b the blue color value multiplied into copy operations. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureColorModFloat * \sa SDL_SetTextureAlphaModFloat * \sa SDL_SetTextureColorMod */ SDL_SetTextureColorModFloat :: (texture: *SDL_Texture, r: float, g: float, b: float) -> bool #foreign libsdl3; /** * Get the additional color value multiplied into render copy operations. * * \param texture the texture to query. * \param r a pointer filled in with the current red color value. * \param g a pointer filled in with the current green color value. * \param b a pointer filled in with the current blue color value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaMod * \sa SDL_GetTextureColorModFloat * \sa SDL_SetTextureColorMod */ SDL_GetTextureColorMod :: (texture: *SDL_Texture, r: *Uint8, g: *Uint8, b: *Uint8) -> bool #foreign libsdl3; /** * Get the additional color value multiplied into render copy operations. * * \param texture the texture to query. * \param r a pointer filled in with the current red color value. * \param g a pointer filled in with the current green color value. * \param b a pointer filled in with the current blue color value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaModFloat * \sa SDL_GetTextureColorMod * \sa SDL_SetTextureColorModFloat */ SDL_GetTextureColorModFloat :: (texture: *SDL_Texture, r: *float, g: *float, b: *float) -> bool #foreign libsdl3; /** * Set an additional alpha value multiplied into render copy operations. * * When this texture is rendered, during the copy operation the source alpha * value is modulated by this alpha value according to the following formula: * * `srcA = srcA * (alpha / 255)` * * Alpha modulation is not always supported by the renderer; it will return * false if alpha modulation is not supported. * * \param texture the texture to update. * \param alpha the source alpha value multiplied into copy operations. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaMod * \sa SDL_SetTextureAlphaModFloat * \sa SDL_SetTextureColorMod */ SDL_SetTextureAlphaMod :: (texture: *SDL_Texture, alpha: Uint8) -> bool #foreign libsdl3; /** * Set an additional alpha value multiplied into render copy operations. * * When this texture is rendered, during the copy operation the source alpha * value is modulated by this alpha value according to the following formula: * * `srcA = srcA * alpha` * * Alpha modulation is not always supported by the renderer; it will return * false if alpha modulation is not supported. * * \param texture the texture to update. * \param alpha the source alpha value multiplied into copy operations. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaModFloat * \sa SDL_SetTextureAlphaMod * \sa SDL_SetTextureColorModFloat */ SDL_SetTextureAlphaModFloat :: (texture: *SDL_Texture, alpha: float) -> bool #foreign libsdl3; /** * Get the additional alpha value multiplied into render copy operations. * * \param texture the texture to query. * \param alpha a pointer filled in with the current alpha value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaModFloat * \sa SDL_GetTextureColorMod * \sa SDL_SetTextureAlphaMod */ SDL_GetTextureAlphaMod :: (texture: *SDL_Texture, alpha: *Uint8) -> bool #foreign libsdl3; /** * Get the additional alpha value multiplied into render copy operations. * * \param texture the texture to query. * \param alpha a pointer filled in with the current alpha value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureAlphaMod * \sa SDL_GetTextureColorModFloat * \sa SDL_SetTextureAlphaModFloat */ SDL_GetTextureAlphaModFloat :: (texture: *SDL_Texture, alpha: *float) -> bool #foreign libsdl3; /** * Set the blend mode for a texture, used by SDL_RenderTexture(). * * If the blend mode is not supported, the closest supported mode is chosen * and this function returns false. * * \param texture the texture to update. * \param blendMode the SDL_BlendMode to use for texture blending. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureBlendMode */ SDL_SetTextureBlendMode :: (texture: *SDL_Texture, blendMode: SDL_BlendMode) -> bool #foreign libsdl3; /** * Get the blend mode used for texture copy operations. * * \param texture the texture to query. * \param blendMode a pointer filled in with the current SDL_BlendMode. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextureBlendMode */ SDL_GetTextureBlendMode :: (texture: *SDL_Texture, blendMode: *SDL_BlendMode) -> bool #foreign libsdl3; /** * Set the scale mode used for texture scale operations. * * The default texture scale mode is SDL_SCALEMODE_LINEAR. * * If the scale mode is not supported, the closest supported mode is chosen. * * \param texture the texture to update. * \param scaleMode the SDL_ScaleMode to use for texture scaling. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTextureScaleMode */ SDL_SetTextureScaleMode :: (texture: *SDL_Texture, scaleMode: SDL_ScaleMode) -> bool #foreign libsdl3; /** * Get the scale mode used for texture scale operations. * * \param texture the texture to query. * \param scaleMode a pointer filled in with the current scale mode. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetTextureScaleMode */ SDL_GetTextureScaleMode :: (texture: *SDL_Texture, scaleMode: *SDL_ScaleMode) -> bool #foreign libsdl3; /** * Update the given texture rectangle with new pixel data. * * The pixel data must be in the pixel format of the texture, which can be * queried using the SDL_PROP_TEXTURE_FORMAT_NUMBER property. * * This is a fairly slow function, intended for use with static textures that * do not change often. * * If the texture is intended to be updated often, it is preferred to create * the texture as streaming and use the locking functions referenced below. * While this function will work with streaming textures, for optimization * reasons you may not get the pixels back if you lock the texture afterward. * * \param texture the texture to update. * \param rect an SDL_Rect structure representing the area to update, or NULL * to update the entire texture. * \param pixels the raw pixel data in the format of the texture. * \param pitch the number of bytes in a row of pixel data, including padding * between lines. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockTexture * \sa SDL_UnlockTexture * \sa SDL_UpdateNVTexture * \sa SDL_UpdateYUVTexture */ SDL_UpdateTexture :: (texture: *SDL_Texture, rect: *SDL_Rect, pixels: *void, pitch: s32) -> bool #foreign libsdl3; /** * Update a rectangle within a planar YV12 or IYUV texture with new pixel * data. * * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous * block of Y and U/V planes in the proper order, but this function is * available if your pixel data is not contiguous. * * \param texture the texture to update. * \param rect a pointer to the rectangle of pixels to update, or NULL to * update the entire texture. * \param Yplane the raw pixel data for the Y plane. * \param Ypitch the number of bytes between rows of pixel data for the Y * plane. * \param Uplane the raw pixel data for the U plane. * \param Upitch the number of bytes between rows of pixel data for the U * plane. * \param Vplane the raw pixel data for the V plane. * \param Vpitch the number of bytes between rows of pixel data for the V * plane. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UpdateNVTexture * \sa SDL_UpdateTexture */ SDL_UpdateYUVTexture :: (texture: *SDL_Texture, rect: *SDL_Rect, Yplane: *Uint8, Ypitch: s32, Uplane: *Uint8, Upitch: s32, Vplane: *Uint8, Vpitch: s32) -> bool #foreign libsdl3; /** * Update a rectangle within a planar NV12 or NV21 texture with new pixels. * * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous * block of NV12/21 planes in the proper order, but this function is available * if your pixel data is not contiguous. * * \param texture the texture to update. * \param rect a pointer to the rectangle of pixels to update, or NULL to * update the entire texture. * \param Yplane the raw pixel data for the Y plane. * \param Ypitch the number of bytes between rows of pixel data for the Y * plane. * \param UVplane the raw pixel data for the UV plane. * \param UVpitch the number of bytes between rows of pixel data for the UV * plane. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_UpdateTexture * \sa SDL_UpdateYUVTexture */ SDL_UpdateNVTexture :: (texture: *SDL_Texture, rect: *SDL_Rect, Yplane: *Uint8, Ypitch: s32, UVplane: *Uint8, UVpitch: s32) -> bool #foreign libsdl3; /** * Lock a portion of the texture for **write-only** pixel access. * * As an optimization, the pixels made available for editing don't necessarily * contain the old texture data. This is a write-only operation, and if you * need to keep a copy of the texture data you should do that at the * application level. * * You must use SDL_UnlockTexture() to unlock the pixels and apply any * changes. * * \param texture the texture to lock for access, which was created with * `SDL_TEXTUREACCESS_STREAMING`. * \param rect an SDL_Rect structure representing the area to lock for access; * NULL to lock the entire texture. * \param pixels this is filled in with a pointer to the locked pixels, * appropriately offset by the locked area. * \param pitch this is filled in with the pitch of the locked pixels; the * pitch is the length of one row in bytes. * \returns true on success or false if the texture is not valid or was not * created with `SDL_TEXTUREACCESS_STREAMING`; call SDL_GetError() * for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockTextureToSurface * \sa SDL_UnlockTexture */ SDL_LockTexture :: (texture: *SDL_Texture, rect: *SDL_Rect, pixels: **void, pitch: *s32) -> bool #foreign libsdl3; /** * Lock a portion of the texture for **write-only** pixel access, and expose * it as a SDL surface. * * Besides providing an SDL_Surface instead of raw pixel data, this function * operates like SDL_LockTexture. * * As an optimization, the pixels made available for editing don't necessarily * contain the old texture data. This is a write-only operation, and if you * need to keep a copy of the texture data you should do that at the * application level. * * You must use SDL_UnlockTexture() to unlock the pixels and apply any * changes. * * The returned surface is freed internally after calling SDL_UnlockTexture() * or SDL_DestroyTexture(). The caller should not free it. * * \param texture the texture to lock for access, which must be created with * `SDL_TEXTUREACCESS_STREAMING`. * \param rect a pointer to the rectangle to lock for access. If the rect is * NULL, the entire texture will be locked. * \param surface a pointer to an SDL surface of size **rect**. Don't assume * any specific pixel content. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockTexture * \sa SDL_UnlockTexture */ SDL_LockTextureToSurface :: (texture: *SDL_Texture, rect: *SDL_Rect, surface: **SDL_Surface) -> bool #foreign libsdl3; /** * Unlock a texture, uploading the changes to video memory, if needed. * * **Warning**: Please note that SDL_LockTexture() is intended to be * write-only; it will not guarantee the previous contents of the texture will * be provided. You must fully initialize any area of a texture that you lock * before unlocking it, as the pixels might otherwise be uninitialized memory. * * Which is to say: locking and immediately unlocking a texture can result in * corrupted textures, depending on the renderer in use. * * \param texture a texture locked by SDL_LockTexture(). * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_LockTexture */ SDL_UnlockTexture :: (texture: *SDL_Texture) -> void #foreign libsdl3; /** * Set a texture as the current rendering target. * * The default render target is the window for which the renderer was created. * To stop rendering to a texture and render to the window again, call this * function with a NULL `texture`. * * \param renderer the rendering context. * \param texture the targeted texture, which must be created with the * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the * window instead of a texture. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderTarget */ SDL_SetRenderTarget :: (renderer: *SDL_Renderer, texture: *SDL_Texture) -> bool #foreign libsdl3; /** * Get the current render target. * * The default render target is the window for which the renderer was created, * and is reported a NULL here. * * \param renderer the rendering context. * \returns the current render target or NULL for the default render target. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderTarget */ SDL_GetRenderTarget :: (renderer: *SDL_Renderer) -> *SDL_Texture #foreign libsdl3; /** * Set a device independent resolution and presentation mode for rendering. * * This function sets the width and height of the logical rendering output. * The renderer will act as if the window is always the requested dimensions, * scaling to the actual window resolution as necessary. * * This can be useful for games that expect a fixed size, but would like to * scale the output to whatever is available, regardless of how a user resizes * a window, or if the display is high DPI. * * You can disable logical coordinates by setting the mode to * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full pixel * resolution of the output window; it is safe to toggle logical presentation * during the rendering of a frame: perhaps most of the rendering is done to * specific dimensions but to make fonts look sharp, the app turns off logical * presentation while drawing text. * * Letterboxing will only happen if logical presentation is enabled during * SDL_RenderPresent; be sure to reenable it first if you were using it. * * You can convert coordinates in an event into rendering coordinates using * SDL_ConvertEventToRenderCoordinates(). * * \param renderer the rendering context. * \param w the width of the logical resolution. * \param h the height of the logical resolution. * \param mode the presentation mode used. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ConvertEventToRenderCoordinates * \sa SDL_GetRenderLogicalPresentation * \sa SDL_GetRenderLogicalPresentationRect */ SDL_SetRenderLogicalPresentation :: (renderer: *SDL_Renderer, w: s32, h: s32, mode: SDL_RendererLogicalPresentation) -> bool #foreign libsdl3; /** * Get device independent resolution and presentation mode for rendering. * * This function gets the width and height of the logical rendering output, or * the output size in pixels if a logical resolution is not enabled. * * \param renderer the rendering context. * \param w an int to be filled with the width. * \param h an int to be filled with the height. * \param mode the presentation mode used. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderLogicalPresentation */ SDL_GetRenderLogicalPresentation :: (renderer: *SDL_Renderer, w: *s32, h: *s32, mode: *SDL_RendererLogicalPresentation) -> bool #foreign libsdl3; /** * Get the final presentation rectangle for rendering. * * This function returns the calculated rectangle used for logical * presentation, based on the presentation mode and output size. If logical * presentation is disabled, it will fill the rectangle with the output size, * in pixels. * * \param renderer the rendering context. * \param rect a pointer filled in with the final presentation rectangle, may * be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderLogicalPresentation */ SDL_GetRenderLogicalPresentationRect :: (renderer: *SDL_Renderer, rect: *SDL_FRect) -> bool #foreign libsdl3; /** * Get a point in render coordinates when given a point in window coordinates. * * This takes into account several states: * * - The window dimensions. * - The logical presentation settings (SDL_SetRenderLogicalPresentation) * - The scale (SDL_SetRenderScale) * - The viewport (SDL_SetRenderViewport) * * \param renderer the rendering context. * \param window_x the x coordinate in window coordinates. * \param window_y the y coordinate in window coordinates. * \param x a pointer filled with the x coordinate in render coordinates. * \param y a pointer filled with the y coordinate in render coordinates. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderLogicalPresentation * \sa SDL_SetRenderScale */ SDL_RenderCoordinatesFromWindow :: (renderer: *SDL_Renderer, window_x: float, window_y: float, x: *float, y: *float) -> bool #foreign libsdl3; /** * Get a point in window coordinates when given a point in render coordinates. * * This takes into account several states: * * - The window dimensions. * - The logical presentation settings (SDL_SetRenderLogicalPresentation) * - The scale (SDL_SetRenderScale) * - The viewport (SDL_SetRenderViewport) * * \param renderer the rendering context. * \param x the x coordinate in render coordinates. * \param y the y coordinate in render coordinates. * \param window_x a pointer filled with the x coordinate in window * coordinates. * \param window_y a pointer filled with the y coordinate in window * coordinates. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderLogicalPresentation * \sa SDL_SetRenderScale * \sa SDL_SetRenderViewport */ SDL_RenderCoordinatesToWindow :: (renderer: *SDL_Renderer, x: float, y: float, window_x: *float, window_y: *float) -> bool #foreign libsdl3; /** * Convert the coordinates in an event to render coordinates. * * This takes into account several states: * * - The window dimensions. * - The logical presentation settings (SDL_SetRenderLogicalPresentation) * - The scale (SDL_SetRenderScale) * - The viewport (SDL_SetRenderViewport) * * Various event types are converted with this function: mouse, touch, pen, * etc. * * Touch coordinates are converted from normalized coordinates in the window * to non-normalized rendering coordinates. * * Relative mouse coordinates (xrel and yrel event fields) are _also_ * converted. Applications that do not want these fields converted should use * SDL_RenderCoordinatesFromWindow() on the specific event fields instead of * converting the entire event structure. * * Once converted, coordinates may be outside the rendering area. * * \param renderer the rendering context. * \param event the event to modify. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderCoordinatesFromWindow */ SDL_ConvertEventToRenderCoordinates :: (renderer: *SDL_Renderer, event: *SDL_Event) -> bool #foreign libsdl3; /** * Set the drawing area for rendering on the current target. * * Drawing will clip to this area (separately from any clipping done with * SDL_SetRenderClipRect), and the top left of the area will become coordinate * (0, 0) for future drawing commands. * * The area's width and height must be >= 0. * * \param renderer the rendering context. * \param rect the SDL_Rect structure representing the drawing area, or NULL * to set the viewport to the entire target. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderViewport * \sa SDL_RenderViewportSet */ SDL_SetRenderViewport :: (renderer: *SDL_Renderer, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Get the drawing area for the current target. * * \param renderer the rendering context. * \param rect an SDL_Rect structure filled in with the current drawing area. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderViewportSet * \sa SDL_SetRenderViewport */ SDL_GetRenderViewport :: (renderer: *SDL_Renderer, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Return whether an explicit rectangle was set as the viewport. * * This is useful if you're saving and restoring the viewport and want to know * whether you should restore a specific rectangle or NULL. Note that the * viewport is always reset when changing rendering targets. * * \param renderer the rendering context. * \returns true if the viewport was set to a specific rectangle, or false if * it was set to NULL (the entire target). * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderViewport * \sa SDL_SetRenderViewport */ SDL_RenderViewportSet :: (renderer: *SDL_Renderer) -> bool #foreign libsdl3; /** * Get the safe area for rendering within the current viewport. * * Some devices have portions of the screen which are partially obscured or * not interactive, possibly due to on-screen controls, curved edges, camera * notches, TV overscan, etc. This function provides the area of the current * viewport which is safe to have interactible content. You should continue * rendering into the rest of the render target, but it should not contain * visually important or interactible content. * * \param renderer the rendering context. * \param rect a pointer filled in with the area that is safe for interactive * content. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetRenderSafeArea :: (renderer: *SDL_Renderer, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Set the clip rectangle for rendering on the specified target. * * \param renderer the rendering context. * \param rect an SDL_Rect structure representing the clip area, relative to * the viewport, or NULL to disable clipping. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderClipRect * \sa SDL_RenderClipEnabled */ SDL_SetRenderClipRect :: (renderer: *SDL_Renderer, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Get the clip rectangle for the current target. * * \param renderer the rendering context. * \param rect an SDL_Rect structure filled in with the current clipping area * or an empty rectangle if clipping is disabled. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderClipEnabled * \sa SDL_SetRenderClipRect */ SDL_GetRenderClipRect :: (renderer: *SDL_Renderer, rect: *SDL_Rect) -> bool #foreign libsdl3; /** * Get whether clipping is enabled on the given renderer. * * \param renderer the rendering context. * \returns true if clipping is enabled or false if not; call SDL_GetError() * for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderClipRect * \sa SDL_SetRenderClipRect */ SDL_RenderClipEnabled :: (renderer: *SDL_Renderer) -> bool #foreign libsdl3; /** * Set the drawing scale for rendering on the current target. * * The drawing coordinates are scaled by the x/y scaling factors before they * are used by the renderer. This allows resolution independent drawing with a * single coordinate system. * * If this results in scaling or subpixel drawing by the rendering backend, it * will be handled using the appropriate quality hints. For best results use * integer scaling factors. * * \param renderer the rendering context. * \param scaleX the horizontal scaling factor. * \param scaleY the vertical scaling factor. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderScale */ SDL_SetRenderScale :: (renderer: *SDL_Renderer, scaleX: float, scaleY: float) -> bool #foreign libsdl3; /** * Get the drawing scale for the current target. * * \param renderer the rendering context. * \param scaleX a pointer filled in with the horizontal scaling factor. * \param scaleY a pointer filled in with the vertical scaling factor. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderScale */ SDL_GetRenderScale :: (renderer: *SDL_Renderer, scaleX: *float, scaleY: *float) -> bool #foreign libsdl3; /** * Set the color used for drawing operations. * * Set the color for drawing or filling rectangles, lines, and points, and for * SDL_RenderClear(). * * \param renderer the rendering context. * \param r the red value used to draw on the rendering target. * \param g the green value used to draw on the rendering target. * \param b the blue value used to draw on the rendering target. * \param a the alpha value used to draw on the rendering target; usually * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to * specify how the alpha channel is used. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderDrawColor * \sa SDL_SetRenderDrawColorFloat */ SDL_SetRenderDrawColor :: (renderer: *SDL_Renderer, r: Uint8, g: Uint8, b: Uint8, a: Uint8) -> bool #foreign libsdl3; /** * Set the color used for drawing operations (Rect, Line and Clear). * * Set the color for drawing or filling rectangles, lines, and points, and for * SDL_RenderClear(). * * \param renderer the rendering context. * \param r the red value used to draw on the rendering target. * \param g the green value used to draw on the rendering target. * \param b the blue value used to draw on the rendering target. * \param a the alpha value used to draw on the rendering target. Use * SDL_SetRenderDrawBlendMode to specify how the alpha channel is * used. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderDrawColorFloat * \sa SDL_SetRenderDrawColor */ SDL_SetRenderDrawColorFloat :: (renderer: *SDL_Renderer, r: float, g: float, b: float, a: float) -> bool #foreign libsdl3; /** * Get the color used for drawing operations (Rect, Line and Clear). * * \param renderer the rendering context. * \param r a pointer filled in with the red value used to draw on the * rendering target. * \param g a pointer filled in with the green value used to draw on the * rendering target. * \param b a pointer filled in with the blue value used to draw on the * rendering target. * \param a a pointer filled in with the alpha value used to draw on the * rendering target; usually `SDL_ALPHA_OPAQUE` (255). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderDrawColorFloat * \sa SDL_SetRenderDrawColor */ SDL_GetRenderDrawColor :: (renderer: *SDL_Renderer, r: *Uint8, g: *Uint8, b: *Uint8, a: *Uint8) -> bool #foreign libsdl3; /** * Get the color used for drawing operations (Rect, Line and Clear). * * \param renderer the rendering context. * \param r a pointer filled in with the red value used to draw on the * rendering target. * \param g a pointer filled in with the green value used to draw on the * rendering target. * \param b a pointer filled in with the blue value used to draw on the * rendering target. * \param a a pointer filled in with the alpha value used to draw on the * rendering target. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderDrawColorFloat * \sa SDL_GetRenderDrawColor */ SDL_GetRenderDrawColorFloat :: (renderer: *SDL_Renderer, r: *float, g: *float, b: *float, a: *float) -> bool #foreign libsdl3; /** * Set the color scale used for render operations. * * The color scale is an additional scale multiplied into the pixel color * value while rendering. This can be used to adjust the brightness of colors * during HDR rendering, or changing HDR video brightness when playing on an * SDR display. * * The color scale does not affect the alpha channel, only the color * brightness. * * \param renderer the rendering context. * \param scale the color scale value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderColorScale */ SDL_SetRenderColorScale :: (renderer: *SDL_Renderer, scale: float) -> bool #foreign libsdl3; /** * Get the color scale used for render operations. * * \param renderer the rendering context. * \param scale a pointer filled in with the current color scale value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderColorScale */ SDL_GetRenderColorScale :: (renderer: *SDL_Renderer, scale: *float) -> bool #foreign libsdl3; /** * Set the blend mode used for drawing operations (Fill and Line). * * If the blend mode is not supported, the closest supported mode is chosen. * * \param renderer the rendering context. * \param blendMode the SDL_BlendMode to use for blending. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderDrawBlendMode */ SDL_SetRenderDrawBlendMode :: (renderer: *SDL_Renderer, blendMode: SDL_BlendMode) -> bool #foreign libsdl3; /** * Get the blend mode used for drawing operations. * * \param renderer the rendering context. * \param blendMode a pointer filled in with the current SDL_BlendMode. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderDrawBlendMode */ SDL_GetRenderDrawBlendMode :: (renderer: *SDL_Renderer, blendMode: *SDL_BlendMode) -> bool #foreign libsdl3; /** * Clear the current rendering target with the drawing color. * * This function clears the entire rendering target, ignoring the viewport and * the clip rectangle. Note, that clearing will also set/fill all pixels of * the rendering target to current renderer draw color, so make sure to invoke * SDL_SetRenderDrawColor() when needed. * * \param renderer the rendering context. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderDrawColor */ SDL_RenderClear :: (renderer: *SDL_Renderer) -> bool #foreign libsdl3; /** * Draw a point on the current rendering target at subpixel precision. * * \param renderer the renderer which should draw a point. * \param x the x coordinate of the point. * \param y the y coordinate of the point. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderPoints */ SDL_RenderPoint :: (renderer: *SDL_Renderer, x: float, y: float) -> bool #foreign libsdl3; /** * Draw multiple points on the current rendering target at subpixel precision. * * \param renderer the renderer which should draw multiple points. * \param points the points to draw. * \param count the number of points to draw. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderPoint */ SDL_RenderPoints :: (renderer: *SDL_Renderer, points: *SDL_FPoint, count: s32) -> bool #foreign libsdl3; /** * Draw a line on the current rendering target at subpixel precision. * * \param renderer the renderer which should draw a line. * \param x1 the x coordinate of the start point. * \param y1 the y coordinate of the start point. * \param x2 the x coordinate of the end point. * \param y2 the y coordinate of the end point. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderLines */ SDL_RenderLine :: (renderer: *SDL_Renderer, x1: float, y1: float, x2: float, y2: float) -> bool #foreign libsdl3; /** * Draw a series of connected lines on the current rendering target at * subpixel precision. * * \param renderer the renderer which should draw multiple lines. * \param points the points along the lines. * \param count the number of points, drawing count-1 lines. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderLine */ SDL_RenderLines :: (renderer: *SDL_Renderer, points: *SDL_FPoint, count: s32) -> bool #foreign libsdl3; /** * Draw a rectangle on the current rendering target at subpixel precision. * * \param renderer the renderer which should draw a rectangle. * \param rect a pointer to the destination rectangle, or NULL to outline the * entire rendering target. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderRects */ SDL_RenderRect :: (renderer: *SDL_Renderer, rect: *SDL_FRect) -> bool #foreign libsdl3; /** * Draw some number of rectangles on the current rendering target at subpixel * precision. * * \param renderer the renderer which should draw multiple rectangles. * \param rects a pointer to an array of destination rectangles. * \param count the number of rectangles. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderRect */ SDL_RenderRects :: (renderer: *SDL_Renderer, rects: *SDL_FRect, count: s32) -> bool #foreign libsdl3; /** * Fill a rectangle on the current rendering target with the drawing color at * subpixel precision. * * \param renderer the renderer which should fill a rectangle. * \param rect a pointer to the destination rectangle, or NULL for the entire * rendering target. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderFillRects */ SDL_RenderFillRect :: (renderer: *SDL_Renderer, rect: *SDL_FRect) -> bool #foreign libsdl3; /** * Fill some number of rectangles on the current rendering target with the * drawing color at subpixel precision. * * \param renderer the renderer which should fill multiple rectangles. * \param rects a pointer to an array of destination rectangles. * \param count the number of rectangles. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderFillRect */ SDL_RenderFillRects :: (renderer: *SDL_Renderer, rects: *SDL_FRect, count: s32) -> bool #foreign libsdl3; /** * Copy a portion of the texture to the current rendering target at subpixel * precision. * * \param renderer the renderer which should copy parts of a texture. * \param texture the source texture. * \param srcrect a pointer to the source rectangle, or NULL for the entire * texture. * \param dstrect a pointer to the destination rectangle, or NULL for the * entire rendering target. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTextureRotated * \sa SDL_RenderTextureTiled */ SDL_RenderTexture :: (renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_FRect, dstrect: *SDL_FRect) -> bool #foreign libsdl3; /** * Copy a portion of the source texture to the current rendering target, with * rotation and flipping, at subpixel precision. * * \param renderer the renderer which should copy parts of a texture. * \param texture the source texture. * \param srcrect a pointer to the source rectangle, or NULL for the entire * texture. * \param dstrect a pointer to the destination rectangle, or NULL for the * entire rendering target. * \param angle an angle in degrees that indicates the rotation that will be * applied to dstrect, rotating it in a clockwise direction. * \param center a pointer to a point indicating the point around which * dstrect will be rotated (if NULL, rotation will be done * around dstrect.w/2, dstrect.h/2). * \param flip an SDL_FlipMode value stating which flipping actions should be * performed on the texture. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTexture */ SDL_RenderTextureRotated :: (renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_FRect, dstrect: *SDL_FRect, angle: float64, center: *SDL_FPoint, flip: SDL_FlipMode) -> bool #foreign libsdl3; /** * Copy a portion of the source texture to the current rendering target, with * affine transform, at subpixel precision. * * \param renderer the renderer which should copy parts of a texture. * \param texture the source texture. * \param srcrect a pointer to the source rectangle, or NULL for the entire * texture. * \param origin a pointer to a point indicating where the top-left corner of * srcrect should be mapped to, or NULL for the rendering * target's origin. * \param right a pointer to a point indicating where the top-right corner of * srcrect should be mapped to, or NULL for the rendering * target's top-right corner. * \param down a pointer to a point indicating where the bottom-left corner of * srcrect should be mapped to, or NULL for the rendering target's * bottom-left corner. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety You may only call this function from the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTexture */ SDL_RenderTextureAffine :: (renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_FRect, origin: *SDL_FPoint, right: *SDL_FPoint, down: *SDL_FPoint) -> bool #foreign libsdl3; /** * Tile a portion of the texture to the current rendering target at subpixel * precision. * * The pixels in `srcrect` will be repeated as many times as needed to * completely fill `dstrect`. * * \param renderer the renderer which should copy parts of a texture. * \param texture the source texture. * \param srcrect a pointer to the source rectangle, or NULL for the entire * texture. * \param scale the scale used to transform srcrect into the destination * rectangle, e.g. a 32x32 texture with a scale of 2 would fill * 64x64 tiles. * \param dstrect a pointer to the destination rectangle, or NULL for the * entire rendering target. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTexture */ SDL_RenderTextureTiled :: (renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_FRect, scale: float, dstrect: *SDL_FRect) -> bool #foreign libsdl3; /** * Perform a scaled copy using the 9-grid algorithm to the current rendering * target at subpixel precision. * * The pixels in the texture are split into a 3x3 grid, using the different * corner sizes for each corner, and the sides and center making up the * remaining pixels. The corners are then scaled using `scale` and fit into * the corners of the destination rectangle. The sides and center are then * stretched into place to cover the remaining destination rectangle. * * \param renderer the renderer which should copy parts of a texture. * \param texture the source texture. * \param srcrect the SDL_Rect structure representing the rectangle to be used * for the 9-grid, or NULL to use the entire texture. * \param left_width the width, in pixels, of the left corners in `srcrect`. * \param right_width the width, in pixels, of the right corners in `srcrect`. * \param top_height the height, in pixels, of the top corners in `srcrect`. * \param bottom_height the height, in pixels, of the bottom corners in * `srcrect`. * \param scale the scale used to transform the corner of `srcrect` into the * corner of `dstrect`, or 0.0f for an unscaled copy. * \param dstrect a pointer to the destination rectangle, or NULL for the * entire rendering target. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderTexture */ SDL_RenderTexture9Grid :: (renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_FRect, left_width: float, right_width: float, top_height: float, bottom_height: float, scale: float, dstrect: *SDL_FRect) -> bool #foreign libsdl3; /** * Render a list of triangles, optionally using a texture and indices into the * vertex array Color and alpha modulation is done per vertex * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). * * \param renderer the rendering context. * \param texture (optional) The SDL texture to use. * \param vertices vertices. * \param num_vertices number of vertices. * \param indices (optional) An array of integer indices into the 'vertices' * array, if NULL all vertices will be rendered in sequential * order. * \param num_indices number of indices. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderGeometryRaw */ SDL_RenderGeometry :: (renderer: *SDL_Renderer, texture: *SDL_Texture, vertices: *SDL_Vertex, num_vertices: s32, indices: *s32, num_indices: s32) -> bool #foreign libsdl3; /** * Render a list of triangles, optionally using a texture and indices into the * vertex arrays Color and alpha modulation is done per vertex * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). * * \param renderer the rendering context. * \param texture (optional) The SDL texture to use. * \param xy vertex positions. * \param xy_stride byte size to move from one element to the next element. * \param color vertex colors (as SDL_FColor). * \param color_stride byte size to move from one element to the next element. * \param uv vertex normalized texture coordinates. * \param uv_stride byte size to move from one element to the next element. * \param num_vertices number of vertices. * \param indices (optional) An array of indices into the 'vertices' arrays, * if NULL all vertices will be rendered in sequential order. * \param num_indices number of indices. * \param size_indices index size: 1 (byte), 2 (short), 4 (int). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderGeometry */ SDL_RenderGeometryRaw :: (renderer: *SDL_Renderer, texture: *SDL_Texture, xy: *float, xy_stride: s32, color: *SDL_FColor, color_stride: s32, uv: *float, uv_stride: s32, num_vertices: s32, indices: *void, num_indices: s32, size_indices: s32) -> bool #foreign libsdl3; /** * Read pixels from the current rendering target. * * The returned surface should be freed with SDL_DestroySurface() * * **WARNING**: This is a very slow operation, and should not be used * frequently. If you're using this on the main rendering target, it should be * called after rendering and before SDL_RenderPresent(). * * \param renderer the rendering context. * \param rect an SDL_Rect structure representing the area in pixels relative * to the to current viewport, or NULL for the entire viewport. * \returns a new SDL_Surface on success or NULL on failure; call * SDL_GetError() for more information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_RenderReadPixels :: (renderer: *SDL_Renderer, rect: *SDL_Rect) -> *SDL_Surface #foreign libsdl3; /** * Update the screen with any rendering performed since the previous call. * * SDL's rendering functions operate on a backbuffer; that is, calling a * rendering function such as SDL_RenderLine() does not directly put a line on * the screen, but rather updates the backbuffer. As such, you compose your * entire scene and *present* the composed backbuffer to the screen as a * complete picture. * * Therefore, when using SDL's rendering API, one does all drawing intended * for the frame, and then calls this function once per frame to present the * final drawing to the user. * * The backbuffer should be considered invalidated after each present; do not * assume that previous contents will exist between frames. You are strongly * encouraged to call SDL_RenderClear() to initialize the backbuffer before * starting each new frame's drawing, even if you plan to overwrite every * pixel. * * Please note, that in case of rendering to a texture - there is **no need** * to call `SDL_RenderPresent` after drawing needed objects to a texture, and * should not be done; you are only required to change back the rendering * target to default via `SDL_SetRenderTarget(renderer, NULL)` afterwards, as * textures by themselves do not have a concept of backbuffers. Calling * SDL_RenderPresent while rendering to a texture will still update the screen * with any current drawing that has been done _to the window itself_. * * \param renderer the rendering context. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer * \sa SDL_RenderClear * \sa SDL_RenderFillRect * \sa SDL_RenderFillRects * \sa SDL_RenderLine * \sa SDL_RenderLines * \sa SDL_RenderPoint * \sa SDL_RenderPoints * \sa SDL_RenderRect * \sa SDL_RenderRects * \sa SDL_SetRenderDrawBlendMode * \sa SDL_SetRenderDrawColor */ SDL_RenderPresent :: (renderer: *SDL_Renderer) -> bool #foreign libsdl3; /** * Destroy the specified texture. * * Passing NULL or an otherwise invalid texture will set the SDL error message * to "Invalid texture". * * \param texture the texture to destroy. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTexture * \sa SDL_CreateTextureFromSurface */ SDL_DestroyTexture :: (texture: *SDL_Texture) -> void #foreign libsdl3; /** * Destroy the rendering context for a window and free all associated * textures. * * This should be called before destroying the associated window. * * \param renderer the rendering context. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateRenderer */ SDL_DestroyRenderer :: (renderer: *SDL_Renderer) -> void #foreign libsdl3; /** * Force the rendering context to flush any pending commands and state. * * You do not need to (and in fact, shouldn't) call this function unless you * are planning to call into OpenGL/Direct3D/Metal/whatever directly, in * addition to using an SDL_Renderer. * * This is for a very-specific case: if you are using SDL's render API, and * you plan to make OpenGL/D3D/whatever calls in addition to SDL render API * calls. If this applies, you should call this function between calls to * SDL's render API and the low-level API you're using in cooperation. * * In all other cases, you can ignore this function. * * This call makes SDL flush any pending rendering work it was queueing up to * do later in a single batch, and marks any internal cached state as invalid, * so it'll prepare all its state again later, from scratch. * * This means you do not need to save state in your rendering code to protect * the SDL renderer. However, there lots of arbitrary pieces of Direct3D and * OpenGL state that can confuse things; you should use your best judgment and * be prepared to make changes if specific state needs to be protected. * * \param renderer the rendering context. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_FlushRenderer :: (renderer: *SDL_Renderer) -> bool #foreign libsdl3; /** * Get the CAMetalLayer associated with the given Metal renderer. * * This function returns `void *`, so SDL doesn't have to include Metal's * headers, but it can be safely cast to a `CAMetalLayer *`. * * \param renderer the renderer to query. * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a * Metal renderer. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderMetalCommandEncoder */ SDL_GetRenderMetalLayer :: (renderer: *SDL_Renderer) -> *void #foreign libsdl3; /** * Get the Metal command encoder for the current frame. * * This function returns `void *`, so SDL doesn't have to include Metal's * headers, but it can be safely cast to an `id`. * * This will return NULL if Metal refuses to give SDL a drawable to render to, * which might happen if the window is hidden/minimized/offscreen. This * doesn't apply to command encoders for render targets, just the window's * backbuffer. Check your return values! * * \param renderer the renderer to query. * \returns an `id` on success, or NULL if the * renderer isn't a Metal renderer or there was an error. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderMetalLayer */ SDL_GetRenderMetalCommandEncoder :: (renderer: *SDL_Renderer) -> *void #foreign libsdl3; /** * Add a set of synchronization semaphores for the current frame. * * The Vulkan renderer will wait for `wait_semaphore` before submitting * rendering commands and signal `signal_semaphore` after rendering commands * are complete for this frame. * * This should be called each frame that you want semaphore synchronization. * The Vulkan renderer may have multiple frames in flight on the GPU, so you * should have multiple semaphores that are used for synchronization. Querying * SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER will give you the * maximum number of semaphores you'll need. * * \param renderer the rendering context. * \param wait_stage_mask the VkPipelineStageFlags for the wait. * \param wait_semaphore a VkSempahore to wait on before rendering the current * frame, or 0 if not needed. * \param signal_semaphore a VkSempahore that SDL will signal when rendering * for the current frame is complete, or 0 if not * needed. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is **NOT** safe to call this function from two threads at * once. * * \since This function is available since SDL 3.2.0. */ SDL_AddVulkanRenderSemaphores :: (renderer: *SDL_Renderer, wait_stage_mask: Uint32, wait_semaphore: Sint64, signal_semaphore: Sint64) -> bool #foreign libsdl3; /** * Toggle VSync of the given renderer. * * When a renderer is created, vsync defaults to SDL_RENDERER_VSYNC_DISABLED. * * The `vsync` parameter can be 1 to synchronize present with every vertical * refresh, 2 to synchronize present with every second vertical refresh, etc., * SDL_RENDERER_VSYNC_ADAPTIVE for late swap tearing (adaptive vsync), or * SDL_RENDERER_VSYNC_DISABLED to disable. Not every value is supported by * every driver, so you should check the return value to see whether the * requested setting is supported. * * \param renderer the renderer to toggle. * \param vsync the vertical refresh sync interval. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRenderVSync */ SDL_SetRenderVSync :: (renderer: *SDL_Renderer, vsync: s32) -> bool #foreign libsdl3; /** * Get VSync of the given renderer. * * \param renderer the renderer to toggle. * \param vsync an int filled with the current vertical refresh sync interval. * See SDL_SetRenderVSync() for the meaning of the value. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_SetRenderVSync */ SDL_GetRenderVSync :: (renderer: *SDL_Renderer, vsync: *s32) -> bool #foreign libsdl3; /** * Draw debug text to an SDL_Renderer. * * This function will render a string of text to an SDL_Renderer. Note that * this is a convenience function for debugging, with severe limitations, and * not intended to be used for production apps and games. * * Among these limitations: * * - It accepts UTF-8 strings, but will only renders ASCII characters. * - It has a single, tiny size (8x8 pixels). One can use logical presentation * or scaling to adjust it, but it will be blurry. * - It uses a simple, hardcoded bitmap font. It does not allow different font * selections and it does not support truetype, for proper scaling. * - It does no word-wrapping and does not treat newline characters as a line * break. If the text goes out of the window, it's gone. * * For serious text rendering, there are several good options, such as * SDL_ttf, stb_truetype, or other external libraries. * * On first use, this will create an internal texture for rendering glyphs. * This texture will live until the renderer is destroyed. * * The text is drawn in the color specified by SDL_SetRenderDrawColor(). * * \param renderer the renderer which should draw a line of text. * \param x the x coordinate where the top-left corner of the text will draw. * \param y the y coordinate where the top-left corner of the text will draw. * \param str the string to render. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderDebugTextFormat * \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE */ SDL_RenderDebugText :: (renderer: *SDL_Renderer, x: float, y: float, str: *u8) -> bool #foreign libsdl3; /** * Draw debug text to an SDL_Renderer. * * This function will render a printf()-style format string to a renderer. * Note that this is a convinence function for debugging, with severe * limitations, and is not intended to be used for production apps and games. * * For the full list of limitations and other useful information, see * SDL_RenderDebugText. * * \param renderer the renderer which should draw the text. * \param x the x coordinate where the top-left corner of the text will draw. * \param y the y coordinate where the top-left corner of the text will draw. * \param fmt the format string to draw. * \param ... additional parameters matching % tokens in the `fmt` string, if * any. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RenderDebugText * \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE */ SDL_RenderDebugTextFormat_CFormat :: (renderer: *SDL_Renderer, x: float, y: float, fmt: *u8, __args: ..Any) -> bool #foreign libsdl3 "SDL_RenderDebugTextFormat"; SDL_RenderDebugTextFormat :: (renderer: *SDL_Renderer, x: float, y: float, fmt: string, __args: ..Any) -> bool { push_allocator(temp); formatted_text_builder: String_Builder; print_to_builder(*formatted_text_builder, fmt, ..__args); append(*formatted_text_builder, "\0"); formatted_text := builder_to_string(*formatted_text_builder); return SDL_RenderDebugTextFormat_CFormat(renderer, x, y, "%s", formatted_text.data); } @PrintLike /** * Function interface for SDL_Storage. * * Apps that want to supply a custom implementation of SDL_Storage will fill * in all the functions in this struct, and then pass it to SDL_OpenStorage to * create a custom SDL_Storage object. * * It is not usually necessary to do this; SDL provides standard * implementations for many things you might expect to do with an SDL_Storage. * * This structure should be initialized using SDL_INIT_INTERFACE() * * \since This struct is available since SDL 3.2.0. * * \sa SDL_INIT_INTERFACE */ SDL_StorageInterface :: struct { /* The version of this interface */ version: Uint32; /* Called when the storage is closed */ close: #type (userdata: *void) -> bool #c_call; /* Optional, returns whether the storage is currently ready for access */ ready: #type (userdata: *void) -> bool #c_call; /* Enumerate a directory, optional for write-only storage */ enumerate: #type (userdata: *void, path: *u8, callback: SDL_EnumerateDirectoryCallback, callback_userdata: *void) -> bool #c_call; /* Get path information, optional for write-only storage */ info: #type (userdata: *void, path: *u8, info: *SDL_PathInfo) -> bool #c_call; /* Read a file from storage, optional for write-only storage */ read_file: #type (userdata: *void, path: *u8, destination: *void, length: Uint64) -> bool #c_call; /* Write a file to storage, optional for read-only storage */ write_file: #type (userdata: *void, path: *u8, source: *void, length: Uint64) -> bool #c_call; /* Create a directory, optional for read-only storage */ mkdir: #type (userdata: *void, path: *u8) -> bool #c_call; /* Remove a file or empty directory, optional for read-only storage */ _remove: #type (userdata: *void, path: *u8) -> bool #c_call; /* Rename a path, optional for read-only storage */ rename: #type (userdata: *void, oldpath: *u8, newpath: *u8) -> bool #c_call; /* Copy a file, optional for read-only storage */ copy: #type (userdata: *void, oldpath: *u8, newpath: *u8) -> bool #c_call; /* Get the space remaining, optional for read-only storage */ space_remaining: #type (userdata: *void) -> Uint64 #c_call; } SDL_Storage :: struct {} /** * Opens up a read-only container for the application's filesystem. * * \param override a path to override the backend's default title root. * \param props a property list that may contain backend-specific information. * \returns a title storage container on success or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize * \sa SDL_OpenUserStorage * \sa SDL_ReadStorageFile */ SDL_OpenTitleStorage :: (override: *u8, props: SDL_PropertiesID) -> *SDL_Storage #foreign libsdl3; /** * Opens up a container for a user's unique read/write filesystem. * * While title storage can generally be kept open throughout runtime, user * storage should only be opened when the client is ready to read/write files. * This allows the backend to properly batch file operations and flush them * when the container has been closed; ensuring safe and optimal save I/O. * * \param org the name of your organization. * \param app the name of your application. * \param props a property list that may contain backend-specific information. * \returns a user storage container on success or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize * \sa SDL_GetStorageSpaceRemaining * \sa SDL_OpenTitleStorage * \sa SDL_ReadStorageFile * \sa SDL_StorageReady * \sa SDL_WriteStorageFile */ SDL_OpenUserStorage :: (org: *u8, app: *u8, props: SDL_PropertiesID) -> *SDL_Storage #foreign libsdl3; /** * Opens up a container for local filesystem storage. * * This is provided for development and tools. Portable applications should * use SDL_OpenTitleStorage() for access to game data and * SDL_OpenUserStorage() for access to user data. * * \param path the base path prepended to all storage paths, or NULL for no * base path. * \returns a filesystem storage container on success or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize * \sa SDL_GetStorageSpaceRemaining * \sa SDL_OpenTitleStorage * \sa SDL_OpenUserStorage * \sa SDL_ReadStorageFile * \sa SDL_WriteStorageFile */ SDL_OpenFileStorage :: (path: *u8) -> *SDL_Storage #foreign libsdl3; /** * Opens up a container using a client-provided storage interface. * * Applications do not need to use this function unless they are providing * their own SDL_Storage implementation. If you just need an SDL_Storage, you * should use the built-in implementations in SDL, like SDL_OpenTitleStorage() * or SDL_OpenUserStorage(). * * This function makes a copy of `iface` and the caller does not need to keep * it around after this call. * * \param iface the interface that implements this storage, initialized using * SDL_INIT_INTERFACE(). * \param userdata the pointer that will be passed to the interface functions. * \returns a storage container on success or NULL on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize * \sa SDL_GetStorageSpaceRemaining * \sa SDL_INIT_INTERFACE * \sa SDL_ReadStorageFile * \sa SDL_StorageReady * \sa SDL_WriteStorageFile */ SDL_OpenStorage :: (iface: *SDL_StorageInterface, userdata: *void) -> *SDL_Storage #foreign libsdl3; /** * Closes and frees a storage container. * * \param storage a storage container to close. * \returns true if the container was freed with no errors, false otherwise; * call SDL_GetError() for more information. Even if the function * returns an error, the container data will be freed; the error is * only for informational purposes. * * \since This function is available since SDL 3.2.0. * * \sa SDL_OpenFileStorage * \sa SDL_OpenStorage * \sa SDL_OpenTitleStorage * \sa SDL_OpenUserStorage */ SDL_CloseStorage :: (storage: *SDL_Storage) -> bool #foreign libsdl3; /** * Checks if the storage container is ready to use. * * This function should be called in regular intervals until it returns true - * however, it is not recommended to spinwait on this call, as the backend may * depend on a synchronous message loop. * * \param storage a storage container to query. * \returns true if the container is ready, false otherwise. * * \since This function is available since SDL 3.2.0. */ SDL_StorageReady :: (storage: *SDL_Storage) -> bool #foreign libsdl3; /** * Query the size of a file within a storage container. * * \param storage a storage container to query. * \param path the relative path of the file to query. * \param length a pointer to be filled with the file's length. * \returns true if the file could be queried or false on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_ReadStorageFile * \sa SDL_StorageReady */ SDL_GetStorageFileSize :: (storage: *SDL_Storage, path: *u8, length: *Uint64) -> bool #foreign libsdl3; /** * Synchronously read a file from a storage container into a client-provided * buffer. * * The value of `length` must match the length of the file exactly; call * SDL_GetStorageFileSize() to get this value. This behavior may be relaxed in * a future release. * * \param storage a storage container to read from. * \param path the relative path of the file to read. * \param destination a client-provided buffer to read the file into. * \param length the length of the destination buffer. * \returns true if the file was read or false on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetStorageFileSize * \sa SDL_StorageReady * \sa SDL_WriteStorageFile */ SDL_ReadStorageFile :: (storage: *SDL_Storage, path: *u8, destination: *void, length: Uint64) -> bool #foreign libsdl3; /** * Synchronously write a file from client memory into a storage container. * * \param storage a storage container to write to. * \param path the relative path of the file to write. * \param source a client-provided buffer to write from. * \param length the length of the source buffer. * \returns true if the file was written or false on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetStorageSpaceRemaining * \sa SDL_ReadStorageFile * \sa SDL_StorageReady */ SDL_WriteStorageFile :: (storage: *SDL_Storage, path: *u8, source: *void, length: Uint64) -> bool #foreign libsdl3; /** * Create a directory in a writable storage container. * * \param storage a storage container. * \param path the path of the directory to create. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ SDL_CreateStorageDirectory :: (storage: *SDL_Storage, path: *u8) -> bool #foreign libsdl3; /** * Enumerate a directory in a storage container through a callback function. * * This function provides every directory entry through an app-provided * callback, called once for each directory entry, until all results have been * provided or the callback returns either SDL_ENUM_SUCCESS or * SDL_ENUM_FAILURE. * * This will return false if there was a system problem in general, or if a * callback returns SDL_ENUM_FAILURE. A successful return means a callback * returned SDL_ENUM_SUCCESS to halt enumeration, or all directory entries * were enumerated. * * If `path` is NULL, this is treated as a request to enumerate the root of * the storage container's tree. An empty string also works for this. * * \param storage a storage container. * \param path the path of the directory to enumerate, or NULL for the root. * \param callback a function that is called for each entry in the directory. * \param userdata a pointer that is passed to `callback`. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ SDL_EnumerateStorageDirectory :: (storage: *SDL_Storage, path: *u8, callback: SDL_EnumerateDirectoryCallback, userdata: *void) -> bool #foreign libsdl3; /** * Remove a file or an empty directory in a writable storage container. * * \param storage a storage container. * \param path the path of the directory to enumerate. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ SDL_RemoveStoragePath :: (storage: *SDL_Storage, path: *u8) -> bool #foreign libsdl3; /** * Rename a file or directory in a writable storage container. * * \param storage a storage container. * \param oldpath the old path. * \param newpath the new path. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ SDL_RenameStoragePath :: (storage: *SDL_Storage, oldpath: *u8, newpath: *u8) -> bool #foreign libsdl3; /** * Copy a file in a writable storage container. * * \param storage a storage container. * \param oldpath the old path. * \param newpath the new path. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ SDL_CopyStorageFile :: (storage: *SDL_Storage, oldpath: *u8, newpath: *u8) -> bool #foreign libsdl3; /** * Get information about a filesystem path in a storage container. * * \param storage a storage container. * \param path the path to query. * \param info a pointer filled in with information about the path, or NULL to * check for the existence of a file. * \returns true on success or false if the file doesn't exist, or another * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady */ SDL_GetStoragePathInfo :: (storage: *SDL_Storage, path: *u8, info: *SDL_PathInfo) -> bool #foreign libsdl3; /** * Queries the remaining space in a storage container. * * \param storage a storage container to query. * \returns the amount of remaining space, in bytes. * * \since This function is available since SDL 3.2.0. * * \sa SDL_StorageReady * \sa SDL_WriteStorageFile */ SDL_GetStorageSpaceRemaining :: (storage: *SDL_Storage) -> Uint64 #foreign libsdl3; /** * Enumerate a directory tree, filtered by pattern, and return a list. * * Files are filtered out if they don't match the string in `pattern`, which * may contain wildcard characters '*' (match everything) and '?' (match one * character). If pattern is NULL, no filtering is done and all results are * returned. Subdirectories are permitted, and are specified with a path * separator of '/'. Wildcard characters '*' and '?' never match a path * separator. * * `flags` may be set to SDL_GLOB_CASEINSENSITIVE to make the pattern matching * case-insensitive. * * The returned array is always NULL-terminated, for your iterating * convenience, but if `count` is non-NULL, on return it will contain the * number of items in the array, not counting the NULL terminator. * * If `path` is NULL, this is treated as a request to enumerate the root of * the storage container's tree. An empty string also works for this. * * \param storage a storage container. * \param path the path of the directory to enumerate, or NULL for the root. * \param pattern the pattern that files in the directory must match. Can be * NULL. * \param flags `SDL_GLOB_*` bitflags that affect this search. * \param count on return, will be set to the number of items in the returned * array. Can be NULL. * \returns an array of strings on success or NULL on failure; call * SDL_GetError() for more information. The caller should pass the * returned pointer to SDL_free when done with it. This is a single * allocation that should be freed with SDL_free() when it is no * longer needed. * * \threadsafety It is safe to call this function from any thread, assuming * the `storage` object is thread-safe. * * \since This function is available since SDL 3.2.0. */ SDL_GlobStorageDirectory :: (storage: *SDL_Storage, path: *u8, pattern: *u8, flags: SDL_GlobFlags, count: *s32) -> **u8 #foreign libsdl3; _XEvent :: union {} /* this is defined in Xlib's headers, just need a simple declaration here. */ XEvent :: _XEvent; /** * A callback to be used with SDL_SetX11EventHook. * * This callback may modify the event, and should return true if the event * should continue to be processed, or false to prevent further processing. * * As this is processing an event directly from the X11 event loop, this * callback should do the minimum required work and return quickly. * * \param userdata the app-defined pointer provided to SDL_SetX11EventHook. * \param xevent a pointer to an Xlib XEvent union to process. * \returns true to let event continue on, false to drop it. * * \threadsafety This may only be called (by SDL) from the thread handling the * X11 event loop. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetX11EventHook */ SDL_X11EventHook :: #type (userdata: *void, xevent: *XEvent) -> bool #c_call; /** * Set a callback for every X11 event. * * The callback may modify the event, and should return true if the event * should continue to be processed, or false to prevent further processing. * * \param callback the SDL_X11EventHook function to call. * \param userdata a pointer to pass to every iteration of `callback`. * * \since This function is available since SDL 3.2.0. */ SDL_SetX11EventHook :: (callback: SDL_X11EventHook, userdata: *void) -> void #foreign libsdl3; /** * Query if the current device is a tablet. * * If SDL can't determine this, it will return false. * * \returns true if the device is a tablet, false otherwise. * * \since This function is available since SDL 3.2.0. */ SDL_IsTablet :: () -> bool #foreign libsdl3; /** * Query if the current device is a TV. * * If SDL can't determine this, it will return false. * * \returns true if the device is a TV, false otherwise. * * \since This function is available since SDL 3.2.0. */ SDL_IsTV :: () -> bool #foreign libsdl3; /** * Application sandbox environment. * * \since This enum is available since SDL 3.2.0. */ using SDL_Sandbox :: enum u32 { SDL_SANDBOX_NONE :: 0; SDL_SANDBOX_UNKNOWN_CONTAINER :: 1; SDL_SANDBOX_FLATPAK :: 2; SDL_SANDBOX_SNAP :: 3; SDL_SANDBOX_MACOS :: 4; } /** * Get the application sandbox environment, if any. * * \returns the application sandbox environment or SDL_SANDBOX_NONE if the * application is not running in a sandbox environment. * * \since This function is available since SDL 3.2.0. */ SDL_GetSandbox :: () -> SDL_Sandbox #foreign libsdl3; /** * Let iOS apps with external event handling report * onApplicationWillTerminate. * * This functions allows iOS apps that have their own event handling to hook * into SDL to generate SDL events. This maps directly to an iOS-specific * event, but since it doesn't do anything iOS-specific internally, it is * available on all platforms, in case it might be useful for some specific * paradigm. Most apps do not need to use this directly; SDL's internal event * code will handle all this for windows created by SDL_CreateWindow! * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_OnApplicationWillTerminate :: () -> void #foreign libsdl3; /** * Let iOS apps with external event handling report * onApplicationDidReceiveMemoryWarning. * * This functions allows iOS apps that have their own event handling to hook * into SDL to generate SDL events. This maps directly to an iOS-specific * event, but since it doesn't do anything iOS-specific internally, it is * available on all platforms, in case it might be useful for some specific * paradigm. Most apps do not need to use this directly; SDL's internal event * code will handle all this for windows created by SDL_CreateWindow! * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_OnApplicationDidReceiveMemoryWarning :: () -> void #foreign libsdl3; /** * Let iOS apps with external event handling report * onApplicationWillResignActive. * * This functions allows iOS apps that have their own event handling to hook * into SDL to generate SDL events. This maps directly to an iOS-specific * event, but since it doesn't do anything iOS-specific internally, it is * available on all platforms, in case it might be useful for some specific * paradigm. Most apps do not need to use this directly; SDL's internal event * code will handle all this for windows created by SDL_CreateWindow! * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_OnApplicationWillEnterBackground :: () -> void #foreign libsdl3; /** * Let iOS apps with external event handling report * onApplicationDidEnterBackground. * * This functions allows iOS apps that have their own event handling to hook * into SDL to generate SDL events. This maps directly to an iOS-specific * event, but since it doesn't do anything iOS-specific internally, it is * available on all platforms, in case it might be useful for some specific * paradigm. Most apps do not need to use this directly; SDL's internal event * code will handle all this for windows created by SDL_CreateWindow! * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_OnApplicationDidEnterBackground :: () -> void #foreign libsdl3; /** * Let iOS apps with external event handling report * onApplicationWillEnterForeground. * * This functions allows iOS apps that have their own event handling to hook * into SDL to generate SDL events. This maps directly to an iOS-specific * event, but since it doesn't do anything iOS-specific internally, it is * available on all platforms, in case it might be useful for some specific * paradigm. Most apps do not need to use this directly; SDL's internal event * code will handle all this for windows created by SDL_CreateWindow! * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_OnApplicationWillEnterForeground :: () -> void #foreign libsdl3; /** * Let iOS apps with external event handling report * onApplicationDidBecomeActive. * * This functions allows iOS apps that have their own event handling to hook * into SDL to generate SDL events. This maps directly to an iOS-specific * event, but since it doesn't do anything iOS-specific internally, it is * available on all platforms, in case it might be useful for some specific * paradigm. Most apps do not need to use this directly; SDL's internal event * code will handle all this for windows created by SDL_CreateWindow! * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_OnApplicationDidEnterForeground :: () -> void #foreign libsdl3; /** * A structure holding a calendar date and time broken down into its * components. * * \since This struct is available since SDL 3.2.0. */ SDL_DateTime :: struct { year: s32; /**< Year */ month: s32; /**< Month [01-12] */ day: s32; /**< Day of the month [01-31] */ hour: s32; /**< Hour [0-23] */ minute: s32; /**< Minute [0-59] */ second: s32; /**< Seconds [0-60] */ nanosecond: s32; /**< Nanoseconds [0-999999999] */ day_of_week: s32; /**< Day of the week [0-6] (0 being Sunday) */ utc_offset: s32; /**< Seconds east of UTC */ } /** * The preferred date format of the current system locale. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetDateTimeLocalePreferences */ using SDL_DateFormat :: enum u32 { SDL_DATE_FORMAT_YYYYMMDD :: 0; SDL_DATE_FORMAT_DDMMYYYY :: 1; SDL_DATE_FORMAT_MMDDYYYY :: 2; } /** * The preferred time format of the current system locale. * * \since This enum is available since SDL 3.2.0. * * \sa SDL_GetDateTimeLocalePreferences */ using SDL_TimeFormat :: enum u32 { SDL_TIME_FORMAT_24HR :: 0; SDL_TIME_FORMAT_12HR :: 1; } /** * Gets the current preferred date and time format for the system locale. * * This might be a "slow" call that has to query the operating system. It's * best to ask for this once and save the results. However, the preferred * formats can change, usually because the user has changed a system * preference outside of your program. * * \param dateFormat a pointer to the SDL_DateFormat to hold the returned date * format, may be NULL. * \param timeFormat a pointer to the SDL_TimeFormat to hold the returned time * format, may be NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_GetDateTimeLocalePreferences :: (dateFormat: *SDL_DateFormat, timeFormat: *SDL_TimeFormat) -> bool #foreign libsdl3; /** * Gets the current value of the system realtime clock in nanoseconds since * Jan 1, 1970 in Universal Coordinated Time (UTC). * * \param ticks the SDL_Time to hold the returned tick count. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_GetCurrentTime :: (ticks: *SDL_Time) -> bool #foreign libsdl3; /** * Converts an SDL_Time in nanoseconds since the epoch to a calendar time in * the SDL_DateTime format. * * \param ticks the SDL_Time to be converted. * \param dt the resulting SDL_DateTime. * \param localTime the resulting SDL_DateTime will be expressed in local time * if true, otherwise it will be in Universal Coordinated * Time (UTC). * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_TimeToDateTime :: (ticks: SDL_Time, dt: *SDL_DateTime, localTime: bool) -> bool #foreign libsdl3; /** * Converts a calendar time to an SDL_Time in nanoseconds since the epoch. * * This function ignores the day_of_week member of the SDL_DateTime struct, so * it may remain unset. * * \param dt the source SDL_DateTime. * \param ticks the resulting SDL_Time. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. */ SDL_DateTimeToTime :: (dt: *SDL_DateTime, ticks: *SDL_Time) -> bool #foreign libsdl3; /** * Converts an SDL time into a Windows FILETIME (100-nanosecond intervals * since January 1, 1601). * * This function fills in the two 32-bit values of the FILETIME structure. * * \param ticks the time to convert. * \param dwLowDateTime a pointer filled in with the low portion of the * Windows FILETIME value. * \param dwHighDateTime a pointer filled in with the high portion of the * Windows FILETIME value. * * \since This function is available since SDL 3.2.0. */ SDL_TimeToWindows :: (ticks: SDL_Time, dwLowDateTime: *Uint32, dwHighDateTime: *Uint32) -> void #foreign libsdl3; /** * Converts a Windows FILETIME (100-nanosecond intervals since January 1, * 1601) to an SDL time. * * This function takes the two 32-bit values of the FILETIME structure as * parameters. * * \param dwLowDateTime the low portion of the Windows FILETIME value. * \param dwHighDateTime the high portion of the Windows FILETIME value. * \returns the converted SDL time. * * \since This function is available since SDL 3.2.0. */ SDL_TimeFromWindows :: (dwLowDateTime: Uint32, dwHighDateTime: Uint32) -> SDL_Time #foreign libsdl3; /** * Get the number of days in a month for a given year. * * \param year the year. * \param month the month [1-12]. * \returns the number of days in the requested month or -1 on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetDaysInMonth :: (year: s32, month: s32) -> s32 #foreign libsdl3; /** * Get the day of year for a calendar date. * * \param year the year component of the date. * \param month the month component of the date. * \param day the day component of the date. * \returns the day of year [0-365] if the date is valid or -1 on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetDayOfYear :: (year: s32, month: s32, day: s32) -> s32 #foreign libsdl3; /** * Get the day of week for a calendar date. * * \param year the year component of the date. * \param month the month component of the date. * \param day the day component of the date. * \returns a value between 0 and 6 (0 being Sunday) if the date is valid or * -1 on failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_GetDayOfWeek :: (year: s32, month: s32, day: s32) -> s32 #foreign libsdl3; /** * Get the number of milliseconds since SDL library initialization. * * \returns an unsigned 64-bit value representing the number of milliseconds * since the SDL library initialized. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetTicks :: () -> Uint64 #foreign libsdl3; /** * Get the number of nanoseconds since SDL library initialization. * * \returns an unsigned 64-bit value representing the number of nanoseconds * since the SDL library initialized. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. */ SDL_GetTicksNS :: () -> Uint64 #foreign libsdl3; /** * Get the current value of the high resolution counter. * * This function is typically used for profiling. * * The counter values are only meaningful relative to each other. Differences * between values can be converted to times by using * SDL_GetPerformanceFrequency(). * * \returns the current counter value. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPerformanceFrequency */ SDL_GetPerformanceCounter :: () -> Uint64 #foreign libsdl3; /** * Get the count per second of the high resolution counter. * * \returns a platform-specific count per second. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetPerformanceCounter */ SDL_GetPerformanceFrequency :: () -> Uint64 #foreign libsdl3; /** * Wait a specified number of milliseconds before returning. * * This function waits a specified number of milliseconds before returning. It * waits at least the specified time, but possibly longer due to OS * scheduling. * * \param ms the number of milliseconds to delay. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_DelayNS * \sa SDL_DelayPrecise */ SDL_Delay :: (ms: Uint32) -> void #foreign libsdl3; /** * Wait a specified number of nanoseconds before returning. * * This function waits a specified number of nanoseconds before returning. It * waits at least the specified time, but possibly longer due to OS * scheduling. * * \param ns the number of nanoseconds to delay. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Delay * \sa SDL_DelayPrecise */ SDL_DelayNS :: (ns: Uint64) -> void #foreign libsdl3; /** * Wait a specified number of nanoseconds before returning. * * This function waits a specified number of nanoseconds before returning. It * will attempt to wait as close to the requested time as possible, busy * waiting if necessary, but could return later due to OS scheduling. * * \param ns the number of nanoseconds to delay. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Delay * \sa SDL_DelayNS */ SDL_DelayPrecise :: (ns: Uint64) -> void #foreign libsdl3; /** * Definition of the timer ID type. * * \since This datatype is available since SDL 3.2.0. */ SDL_TimerID :: Uint32; /** * Function prototype for the millisecond timer callback function. * * The callback function is passed the current timer interval and returns the * next timer interval, in milliseconds. If the returned value is the same as * the one passed in, the periodic alarm continues, otherwise a new alarm is * scheduled. If the callback returns 0, the periodic alarm is canceled and * will be removed. * * \param userdata an arbitrary pointer provided by the app through * SDL_AddTimer, for its own use. * \param timerID the current timer being processed. * \param interval the current callback time interval. * \returns the new callback time interval, or 0 to disable further runs of * the callback. * * \threadsafety SDL may call this callback at any time from a background * thread; the application is responsible for locking resources * the callback touches that need to be protected. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_AddTimer */ SDL_TimerCallback :: #type (userdata: *void, timerID: SDL_TimerID, interval: Uint32) -> Uint32 #c_call; /** * Call a callback function at a future time. * * The callback function is passed the current timer interval and the user * supplied parameter from the SDL_AddTimer() call and should return the next * timer interval. If the value returned from the callback is 0, the timer is * canceled and will be removed. * * The callback is run on a separate thread, and for short timeouts can * potentially be called before this function returns. * * Timers take into account the amount of time it took to execute the * callback. For example, if the callback took 250 ms to execute and returned * 1000 (ms), the timer would only wait another 750 ms before its next * iteration. * * Timing may be inexact due to OS scheduling. Be sure to note the current * time with SDL_GetTicksNS() or SDL_GetPerformanceCounter() in case your * callback needs to adjust for variances. * * \param interval the timer delay, in milliseconds, passed to `callback`. * \param callback the SDL_TimerCallback function to call when the specified * `interval` elapses. * \param userdata a pointer that is passed to `callback`. * \returns a timer ID or 0 on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddTimerNS * \sa SDL_RemoveTimer */ SDL_AddTimer :: (interval: Uint32, callback: SDL_TimerCallback, userdata: *void) -> SDL_TimerID #foreign libsdl3; /** * Function prototype for the nanosecond timer callback function. * * The callback function is passed the current timer interval and returns the * next timer interval, in nanoseconds. If the returned value is the same as * the one passed in, the periodic alarm continues, otherwise a new alarm is * scheduled. If the callback returns 0, the periodic alarm is canceled and * will be removed. * * \param userdata an arbitrary pointer provided by the app through * SDL_AddTimer, for its own use. * \param timerID the current timer being processed. * \param interval the current callback time interval. * \returns the new callback time interval, or 0 to disable further runs of * the callback. * * \threadsafety SDL may call this callback at any time from a background * thread; the application is responsible for locking resources * the callback touches that need to be protected. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_AddTimerNS */ SDL_NSTimerCallback :: #type (userdata: *void, timerID: SDL_TimerID, interval: Uint64) -> Uint64 #c_call; /** * Call a callback function at a future time. * * The callback function is passed the current timer interval and the user * supplied parameter from the SDL_AddTimerNS() call and should return the * next timer interval. If the value returned from the callback is 0, the * timer is canceled and will be removed. * * The callback is run on a separate thread, and for short timeouts can * potentially be called before this function returns. * * Timers take into account the amount of time it took to execute the * callback. For example, if the callback took 250 ns to execute and returned * 1000 (ns), the timer would only wait another 750 ns before its next * iteration. * * Timing may be inexact due to OS scheduling. Be sure to note the current * time with SDL_GetTicksNS() or SDL_GetPerformanceCounter() in case your * callback needs to adjust for variances. * * \param interval the timer delay, in nanoseconds, passed to `callback`. * \param callback the SDL_TimerCallback function to call when the specified * `interval` elapses. * \param userdata a pointer that is passed to `callback`. * \returns a timer ID or 0 on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddTimer * \sa SDL_RemoveTimer */ SDL_AddTimerNS :: (interval: Uint64, callback: SDL_NSTimerCallback, userdata: *void) -> SDL_TimerID #foreign libsdl3; /** * Remove a timer created with SDL_AddTimer(). * * \param id the ID of the timer to remove. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_AddTimer */ SDL_RemoveTimer :: (id: SDL_TimerID) -> bool #foreign libsdl3; SDL_Tray :: struct {} SDL_TrayMenu :: struct {} SDL_TrayEntry :: struct {} /** * Flags that control the creation of system tray entries. * * Some of these flags are required; exactly one of them must be specified at * the time a tray entry is created. Other flags are optional; zero or more of * those can be OR'ed together with the required flag. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_InsertTrayEntryAt */ SDL_TrayEntryFlags :: Uint32; /** * A callback that is invoked when a tray entry is selected. * * \param userdata an optional pointer to pass extra data to the callback when * it will be invoked. * \param entry the tray entry that was selected. * * \since This datatype is available since SDL 3.2.0. * * \sa SDL_SetTrayEntryCallback */ SDL_TrayCallback :: #type (userdata: *void, entry: *SDL_TrayEntry) -> void #c_call; /** * Create an icon to be placed in the operating system's tray, or equivalent. * * Many platforms advise not using a system tray unless persistence is a * necessary feature. Avoid needlessly creating a tray icon, as the user may * feel like it clutters their interface. * * Using tray icons require the video subsystem. * * \param icon a surface to be used as icon. May be NULL. * \param tooltip a tooltip to be displayed when the mouse hovers the icon in * UTF-8 encoding. Not supported on all platforms. May be NULL. * \returns The newly created system tray icon. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenu * \sa SDL_DestroyTray */ SDL_CreateTray :: (icon: *SDL_Surface, tooltip: *u8) -> *SDL_Tray #foreign libsdl3; /** * Updates the system tray icon's icon. * * \param tray the tray icon to be updated. * \param icon the new icon. May be NULL. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray */ SDL_SetTrayIcon :: (tray: *SDL_Tray, icon: *SDL_Surface) -> void #foreign libsdl3; /** * Updates the system tray icon's tooltip. * * \param tray the tray icon to be updated. * \param tooltip the new tooltip in UTF-8 encoding. May be NULL. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray */ SDL_SetTrayTooltip :: (tray: *SDL_Tray, tooltip: *u8) -> void #foreign libsdl3; /** * Create a menu for a system tray. * * This should be called at most once per tray icon. * * This function does the same thing as SDL_CreateTraySubmenu(), except that * it takes a SDL_Tray instead of a SDL_TrayEntry. * * A menu does not need to be destroyed; it will be destroyed with the tray. * * \param tray the tray to bind the menu to. * \returns the newly created menu. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray * \sa SDL_GetTrayMenu * \sa SDL_GetTrayMenuParentTray */ SDL_CreateTrayMenu :: (tray: *SDL_Tray) -> *SDL_TrayMenu #foreign libsdl3; /** * Create a submenu for a system tray entry. * * This should be called at most once per tray entry. * * This function does the same thing as SDL_CreateTrayMenu, except that it * takes a SDL_TrayEntry instead of a SDL_Tray. * * A menu does not need to be destroyed; it will be destroyed with the tray. * * \param entry the tray entry to bind the menu to. * \returns the newly created menu. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTraySubmenu * \sa SDL_GetTrayMenuParentEntry */ SDL_CreateTraySubmenu :: (entry: *SDL_TrayEntry) -> *SDL_TrayMenu #foreign libsdl3; /** * Gets a previously created tray menu. * * You should have called SDL_CreateTrayMenu() on the tray object. This * function allows you to fetch it again later. * * This function does the same thing as SDL_GetTraySubmenu(), except that it * takes a SDL_Tray instead of a SDL_TrayEntry. * * A menu does not need to be destroyed; it will be destroyed with the tray. * * \param tray the tray entry to bind the menu to. * \returns the newly created menu. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray * \sa SDL_CreateTrayMenu */ SDL_GetTrayMenu :: (tray: *SDL_Tray) -> *SDL_TrayMenu #foreign libsdl3; /** * Gets a previously created tray entry submenu. * * You should have called SDL_CreateTraySubmenu() on the entry object. This * function allows you to fetch it again later. * * This function does the same thing as SDL_GetTrayMenu(), except that it * takes a SDL_TrayEntry instead of a SDL_Tray. * * A menu does not need to be destroyed; it will be destroyed with the tray. * * \param entry the tray entry to bind the menu to. * \returns the newly created menu. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_InsertTrayEntryAt * \sa SDL_CreateTraySubmenu */ SDL_GetTraySubmenu :: (entry: *SDL_TrayEntry) -> *SDL_TrayMenu #foreign libsdl3; /** * Returns a list of entries in the menu, in order. * * \param menu The menu to get entries from. * \param size An optional pointer to obtain the number of entries in the * menu. * \returns a NULL-terminated list of entries within the given menu. The * pointer becomes invalid when any function that inserts or deletes * entries in the menu is called. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_RemoveTrayEntry * \sa SDL_InsertTrayEntryAt */ SDL_GetTrayEntries :: (menu: *SDL_TrayMenu, size: *s32) -> **SDL_TrayEntry #foreign libsdl3; /** * Removes a tray entry. * * \param entry The entry to be deleted. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt */ SDL_RemoveTrayEntry :: (entry: *SDL_TrayEntry) -> void #foreign libsdl3; /** * Insert a tray entry at a given position. * * If label is NULL, the entry will be a separator. Many functions won't work * for an entry that is a separator. * * An entry does not need to be destroyed; it will be destroyed with the tray. * * \param menu the menu to append the entry to. * \param pos the desired position for the new entry. Entries at or following * this place will be moved. If pos is -1, the entry is appended. * \param label the text to be displayed on the entry, in UTF-8 encoding, or * NULL for a separator. * \param flags a combination of flags, some of which are mandatory. * \returns the newly created entry, or NULL if pos is out of bounds. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_TrayEntryFlags * \sa SDL_GetTrayEntries * \sa SDL_RemoveTrayEntry * \sa SDL_GetTrayEntryParent */ SDL_InsertTrayEntryAt :: (menu: *SDL_TrayMenu, pos: s32, label: *u8, flags: SDL_TrayEntryFlags) -> *SDL_TrayEntry #foreign libsdl3; /** * Sets the label of an entry. * * An entry cannot change between a separator and an ordinary entry; that is, * it is not possible to set a non-NULL label on an entry that has a NULL * label (separators), or to set a NULL label to an entry that has a non-NULL * label. The function will silently fail if that happens. * * \param entry the entry to be updated. * \param label the new label for the entry in UTF-8 encoding. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTrayEntryLabel */ SDL_SetTrayEntryLabel :: (entry: *SDL_TrayEntry, label: *u8) -> void #foreign libsdl3; /** * Gets the label of an entry. * * If the returned value is NULL, the entry is a separator. * * \param entry the entry to be read. * \returns the label of the entry in UTF-8 encoding. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_SetTrayEntryLabel */ SDL_GetTrayEntryLabel :: (entry: *SDL_TrayEntry) -> *u8 #foreign libsdl3; /** * Sets whether or not an entry is checked. * * The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag. * * \param entry the entry to be updated. * \param checked true if the entry should be checked; false otherwise. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTrayEntryChecked */ SDL_SetTrayEntryChecked :: (entry: *SDL_TrayEntry, checked: bool) -> void #foreign libsdl3; /** * Gets whether or not an entry is checked. * * The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag. * * \param entry the entry to be read. * \returns true if the entry is checked; false otherwise. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_SetTrayEntryChecked */ SDL_GetTrayEntryChecked :: (entry: *SDL_TrayEntry) -> bool #foreign libsdl3; /** * Sets whether or not an entry is enabled. * * \param entry the entry to be updated. * \param enabled true if the entry should be enabled; false otherwise. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_GetTrayEntryEnabled */ SDL_SetTrayEntryEnabled :: (entry: *SDL_TrayEntry, enabled: bool) -> void #foreign libsdl3; /** * Gets whether or not an entry is enabled. * * \param entry the entry to be read. * \returns true if the entry is enabled; false otherwise. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt * \sa SDL_SetTrayEntryEnabled */ SDL_GetTrayEntryEnabled :: (entry: *SDL_TrayEntry) -> bool #foreign libsdl3; /** * Sets a callback to be invoked when the entry is selected. * * \param entry the entry to be updated. * \param callback a callback to be invoked when the entry is selected. * \param userdata an optional pointer to pass extra data to the callback when * it will be invoked. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetTrayEntries * \sa SDL_InsertTrayEntryAt */ SDL_SetTrayEntryCallback :: (entry: *SDL_TrayEntry, callback: SDL_TrayCallback, userdata: *void) -> void #foreign libsdl3; /** * Simulate a click on a tray entry. * * \param entry The entry to activate. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. */ SDL_ClickTrayEntry :: (entry: *SDL_TrayEntry) -> void #foreign libsdl3; /** * Destroys a tray object. * * This also destroys all associated menus and entries. * * \param tray the tray icon to be destroyed. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTray */ SDL_DestroyTray :: (tray: *SDL_Tray) -> void #foreign libsdl3; /** * Gets the menu containing a certain tray entry. * * \param entry the entry for which to get the parent menu. * \returns the parent menu. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_InsertTrayEntryAt */ SDL_GetTrayEntryParent :: (entry: *SDL_TrayEntry) -> *SDL_TrayMenu #foreign libsdl3; /** * Gets the entry for which the menu is a submenu, if the current menu is a * submenu. * * Either this function or SDL_GetTrayMenuParentTray() will return non-NULL * for any given menu. * * \param menu the menu for which to get the parent entry. * \returns the parent entry, or NULL if this menu is not a submenu. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTraySubmenu * \sa SDL_GetTrayMenuParentTray */ SDL_GetTrayMenuParentEntry :: (menu: *SDL_TrayMenu) -> *SDL_TrayEntry #foreign libsdl3; /** * Gets the tray for which this menu is the first-level menu, if the current * menu isn't a submenu. * * Either this function or SDL_GetTrayMenuParentEntry() will return non-NULL * for any given menu. * * \param menu the menu for which to get the parent enttrayry. * \returns the parent tray, or NULL if this menu is a submenu. * * \threadsafety This function should be called on the thread that created the * tray. * * \since This function is available since SDL 3.2.0. * * \sa SDL_CreateTrayMenu * \sa SDL_GetTrayMenuParentEntry */ SDL_GetTrayMenuParentTray :: (menu: *SDL_TrayMenu) -> *SDL_Tray #foreign libsdl3; /** * Update the trays. * * This is called automatically by the event loop and is only needed if you're * using trays but aren't handling SDL events. * * \threadsafety This function should only be called on the main thread. * * \since This function is available since SDL 3.2.0. */ SDL_UpdateTrays :: () -> void #foreign libsdl3; /** * Get the version of SDL that is linked against your program. * * If you are linking to SDL dynamically, then it is possible that the current * version will be different than the version you compiled against. This * function returns the current version, while SDL_VERSION is the version you * compiled with. * * This function may be called safely at any time, even before SDL_Init(). * * \returns the version of the linked library. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetRevision */ SDL_GetVersion :: () -> s32 #foreign libsdl3; /** * Get the code revision of SDL that is linked against your program. * * This value is the revision of the code you are linked with and may be * different from the code you are compiling with, which is found in the * constant SDL_REVISION. * * The revision is arbitrary string (a hash value) uniquely identifying the * exact revision of the SDL library in use, and is only useful in comparing * against other revisions. It is NOT an incrementing number. * * If SDL wasn't built from a git repository with the appropriate tools, this * will return an empty string. * * You shouldn't use this function for anything but logging it for debugging * purposes. The string is not intended to be reliable in any way. * * \returns an arbitrary string, uniquely identifying the exact revision of * the SDL library in use. * * \since This function is available since SDL 3.2.0. * * \sa SDL_GetVersion */ SDL_GetRevision :: () -> *u8 #foreign libsdl3; VkInstance_T :: struct {} VkInstance :: *VkInstance_T; VkPhysicalDevice_T :: struct {} VkPhysicalDevice :: *VkPhysicalDevice_T; VkSurfaceKHR_T :: struct {} VkSurfaceKHR :: *VkSurfaceKHR_T; VkAllocationCallbacks :: struct {} /** * Dynamically load the Vulkan loader library. * * This should be called after initializing the video driver, but before * creating any Vulkan windows. If no Vulkan loader library is loaded, the * default library will be loaded upon creation of the first Vulkan window. * * SDL keeps a counter of how many times this function has been successfully * called, so it is safe to call this function multiple times, so long as it * is eventually paired with an equivalent number of calls to * SDL_Vulkan_UnloadLibrary. The `path` argument is ignored unless there is no * library currently loaded, and and the library isn't actually unloaded until * there have been an equivalent number of calls to SDL_Vulkan_UnloadLibrary. * * It is fairly common for Vulkan applications to link with libvulkan instead * of explicitly loading it at run time. This will work with SDL provided the * application links to a dynamic library and both it and SDL use the same * search path. * * If you specify a non-NULL `path`, an application should retrieve all of the * Vulkan functions it uses from the dynamic library using * SDL_Vulkan_GetVkGetInstanceProcAddr unless you can guarantee `path` points * to the same vulkan loader library the application linked to. * * On Apple devices, if `path` is NULL, SDL will attempt to find the * `vkGetInstanceProcAddr` address within all the Mach-O images of the current * process. This is because it is fairly common for Vulkan applications to * link with libvulkan (and historically MoltenVK was provided as a static * library). If it is not found, on macOS, SDL will attempt to load * `vulkan.framework/vulkan`, `libvulkan.1.dylib`, * `MoltenVK.framework/MoltenVK`, and `libMoltenVK.dylib`, in that order. On * iOS, SDL will attempt to load `libMoltenVK.dylib`. Applications using a * dynamic framework or .dylib must ensure it is included in its application * bundle. * * On non-Apple devices, application linking with a static libvulkan is not * supported. Either do not link to the Vulkan loader or link to a dynamic * library version. * * \param path the platform dependent Vulkan loader library name or NULL. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_GetVkGetInstanceProcAddr * \sa SDL_Vulkan_UnloadLibrary */ SDL_Vulkan_LoadLibrary :: (path: *u8) -> bool #foreign libsdl3; /** * Get the address of the `vkGetInstanceProcAddr` function. * * This should be called after either calling SDL_Vulkan_LoadLibrary() or * creating an SDL_Window with the `SDL_WINDOW_VULKAN` flag. * * The actual type of the returned function pointer is * PFN_vkGetInstanceProcAddr, but that isn't available because the Vulkan * headers are not included here. You should cast the return value of this * function to that type, e.g. * * `vkGetInstanceProcAddr = * (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr();` * * \returns the function pointer for `vkGetInstanceProcAddr` or NULL on * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. */ SDL_Vulkan_GetVkGetInstanceProcAddr :: () -> SDL_FunctionPointer #foreign libsdl3; /** * Unload the Vulkan library previously loaded by SDL_Vulkan_LoadLibrary(). * * SDL keeps a counter of how many times this function has been called, so it * is safe to call this function multiple times, so long as it is paired with * an equivalent number of calls to SDL_Vulkan_LoadLibrary. The library isn't * actually unloaded until there have been an equivalent number of calls to * SDL_Vulkan_UnloadLibrary. * * Once the library has actually been unloaded, if any Vulkan instances * remain, they will likely crash the program. Clean up any existing Vulkan * resources, and destroy appropriate windows, renderers and GPU devices * before calling this function. * * \threadsafety This function is not thread safe. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_LoadLibrary */ SDL_Vulkan_UnloadLibrary :: () -> void #foreign libsdl3; /** * Get the Vulkan instance extensions needed for vkCreateInstance. * * This should be called after either calling SDL_Vulkan_LoadLibrary() or * creating an SDL_Window with the `SDL_WINDOW_VULKAN` flag. * * On return, the variable pointed to by `count` will be set to the number of * elements returned, suitable for using with * VkInstanceCreateInfo::enabledExtensionCount, and the returned array can be * used with VkInstanceCreateInfo::ppEnabledExtensionNames, for calling * Vulkan's vkCreateInstance API. * * You should not free the returned array; it is owned by SDL. * * \param count a pointer filled in with the number of extensions returned. * \returns an array of extension name strings on success, NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_CreateSurface */ SDL_Vulkan_GetInstanceExtensions :: (count: *Uint32) -> **u8 #foreign libsdl3; /** * Create a Vulkan rendering surface for a window. * * The `window` must have been created with the `SDL_WINDOW_VULKAN` flag and * `instance` must have been created with extensions returned by * SDL_Vulkan_GetInstanceExtensions() enabled. * * If `allocator` is NULL, Vulkan will use the system default allocator. This * argument is passed directly to Vulkan and isn't used by SDL itself. * * \param window the window to which to attach the Vulkan surface. * \param instance the Vulkan instance handle. * \param allocator a VkAllocationCallbacks struct, which lets the app set the * allocator that creates the surface. Can be NULL. * \param surface a pointer to a VkSurfaceKHR handle to output the newly * created surface. * \returns true on success or false on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_GetInstanceExtensions * \sa SDL_Vulkan_DestroySurface */ SDL_Vulkan_CreateSurface :: (window: *SDL_Window, instance: VkInstance, allocator: *VkAllocationCallbacks, surface: *VkSurfaceKHR) -> bool #foreign libsdl3; /** * Destroy the Vulkan rendering surface of a window. * * This should be called before SDL_DestroyWindow, if SDL_Vulkan_CreateSurface * was called after SDL_CreateWindow. * * The `instance` must have been created with extensions returned by * SDL_Vulkan_GetInstanceExtensions() enabled and `surface` must have been * created successfully by an SDL_Vulkan_CreateSurface() call. * * If `allocator` is NULL, Vulkan will use the system default allocator. This * argument is passed directly to Vulkan and isn't used by SDL itself. * * \param instance the Vulkan instance handle. * \param surface vkSurfaceKHR handle to destroy. * \param allocator a VkAllocationCallbacks struct, which lets the app set the * allocator that destroys the surface. Can be NULL. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_GetInstanceExtensions * \sa SDL_Vulkan_CreateSurface */ SDL_Vulkan_DestroySurface :: (instance: VkInstance, surface: VkSurfaceKHR, allocator: *VkAllocationCallbacks) -> void #foreign libsdl3; /** * Query support for presentation via a given physical device and queue * family. * * The `instance` must have been created with extensions returned by * SDL_Vulkan_GetInstanceExtensions() enabled. * * \param instance the Vulkan instance handle. * \param physicalDevice a valid Vulkan physical device handle. * \param queueFamilyIndex a valid queue family index for the given physical * device. * \returns true if supported, false if unsupported or an error occurred. * * \since This function is available since SDL 3.2.0. * * \sa SDL_Vulkan_GetInstanceExtensions */ SDL_Vulkan_GetPresentationSupport :: (instance: VkInstance, physicalDevice: VkPhysicalDevice, queueFamilyIndex: Uint32) -> bool #foreign libsdl3; #scope_file #import "Basic"; // For assert, push_context libsdl3 :: #library "src/SDL-release-3.2.0/build-macos-debug/libSDL3"; #run { { info := type_info(SDL_alignment_test); for info.members { if it.name == { case "a"; assert(it.offset_in_bytes == 0, "SDL_alignment_test.a has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_alignment_test.a has unexpected size % instead of 1", it.type.runtime_size); case "b"; assert(it.offset_in_bytes == 8, "SDL_alignment_test.b has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_alignment_test.b has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_alignment_test) == 16, "SDL_alignment_test has size % instead of 16", size_of(SDL_alignment_test)); } { info := type_info(SDL_AssertData); for info.members { if it.name == { case "always_ignore"; assert(it.offset_in_bytes == 0, "SDL_AssertData.always_ignore has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_AssertData.always_ignore has unexpected size % instead of 1", it.type.runtime_size); case "trigger_count"; assert(it.offset_in_bytes == 4, "SDL_AssertData.trigger_count has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AssertData.trigger_count has unexpected size % instead of 4", it.type.runtime_size); case "condition"; assert(it.offset_in_bytes == 8, "SDL_AssertData.condition has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AssertData.condition has unexpected size % instead of 8", it.type.runtime_size); case "filename"; assert(it.offset_in_bytes == 16, "SDL_AssertData.filename has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AssertData.filename has unexpected size % instead of 8", it.type.runtime_size); case "linenum"; assert(it.offset_in_bytes == 24, "SDL_AssertData.linenum has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AssertData.linenum has unexpected size % instead of 4", it.type.runtime_size); case "function"; assert(it.offset_in_bytes == 32, "SDL_AssertData.function has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AssertData.function has unexpected size % instead of 8", it.type.runtime_size); case "next"; assert(it.offset_in_bytes == 40, "SDL_AssertData.next has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AssertData.next has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_AssertData) == 48, "SDL_AssertData has size % instead of 48", size_of(SDL_AssertData)); } { info := type_info(SDL_AsyncIOOutcome); for info.members { if it.name == { case "asyncio"; assert(it.offset_in_bytes == 0, "SDL_AsyncIOOutcome.asyncio has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AsyncIOOutcome.asyncio has unexpected size % instead of 8", it.type.runtime_size); case "type"; assert(it.offset_in_bytes == 8, "SDL_AsyncIOOutcome.type has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AsyncIOOutcome.type has unexpected size % instead of 4", it.type.runtime_size); case "result"; assert(it.offset_in_bytes == 12, "SDL_AsyncIOOutcome.result has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AsyncIOOutcome.result has unexpected size % instead of 4", it.type.runtime_size); case "buffer"; assert(it.offset_in_bytes == 16, "SDL_AsyncIOOutcome.buffer has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AsyncIOOutcome.buffer has unexpected size % instead of 8", it.type.runtime_size); case "offset"; assert(it.offset_in_bytes == 24, "SDL_AsyncIOOutcome.offset has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AsyncIOOutcome.offset has unexpected size % instead of 8", it.type.runtime_size); case "bytes_requested"; assert(it.offset_in_bytes == 32, "SDL_AsyncIOOutcome.bytes_requested has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AsyncIOOutcome.bytes_requested has unexpected size % instead of 8", it.type.runtime_size); case "bytes_transferred"; assert(it.offset_in_bytes == 40, "SDL_AsyncIOOutcome.bytes_transferred has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AsyncIOOutcome.bytes_transferred has unexpected size % instead of 8", it.type.runtime_size); case "userdata"; assert(it.offset_in_bytes == 48, "SDL_AsyncIOOutcome.userdata has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AsyncIOOutcome.userdata has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_AsyncIOOutcome) == 56, "SDL_AsyncIOOutcome has size % instead of 56", size_of(SDL_AsyncIOOutcome)); } { info := type_info(SDL_AtomicInt); for info.members { if it.name == { case "value"; assert(it.offset_in_bytes == 0, "SDL_AtomicInt.value has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AtomicInt.value has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_AtomicInt) == 4, "SDL_AtomicInt has size % instead of 4", size_of(SDL_AtomicInt)); } { info := type_info(SDL_AtomicU32); for info.members { if it.name == { case "value"; assert(it.offset_in_bytes == 0, "SDL_AtomicU32.value has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AtomicU32.value has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_AtomicU32) == 4, "SDL_AtomicU32 has size % instead of 4", size_of(SDL_AtomicU32)); } { info := type_info(SDL_InitState); for info.members { if it.name == { case "status"; assert(it.offset_in_bytes == 0, "SDL_InitState.status has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_InitState.status has unexpected size % instead of 4", it.type.runtime_size); case "thread"; assert(it.offset_in_bytes == 8, "SDL_InitState.thread has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_InitState.thread has unexpected size % instead of 8", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 16, "SDL_InitState.reserved has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_InitState.reserved has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_InitState) == 24, "SDL_InitState has size % instead of 24", size_of(SDL_InitState)); } { info := type_info(SDL_IOStreamInterface); for info.members { if it.name == { case "version"; assert(it.offset_in_bytes == 0, "SDL_IOStreamInterface.version has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_IOStreamInterface.version has unexpected size % instead of 4", it.type.runtime_size); case "size"; assert(it.offset_in_bytes == 8, "SDL_IOStreamInterface.size has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_IOStreamInterface.size has unexpected size % instead of 8", it.type.runtime_size); case "seek"; assert(it.offset_in_bytes == 16, "SDL_IOStreamInterface.seek has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_IOStreamInterface.seek has unexpected size % instead of 8", it.type.runtime_size); case "read"; assert(it.offset_in_bytes == 24, "SDL_IOStreamInterface.read has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_IOStreamInterface.read has unexpected size % instead of 8", it.type.runtime_size); case "write"; assert(it.offset_in_bytes == 32, "SDL_IOStreamInterface.write has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_IOStreamInterface.write has unexpected size % instead of 8", it.type.runtime_size); case "flush"; assert(it.offset_in_bytes == 40, "SDL_IOStreamInterface.flush has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_IOStreamInterface.flush has unexpected size % instead of 8", it.type.runtime_size); case "close"; assert(it.offset_in_bytes == 48, "SDL_IOStreamInterface.close has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_IOStreamInterface.close has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_IOStreamInterface) == 56, "SDL_IOStreamInterface has size % instead of 56", size_of(SDL_IOStreamInterface)); } { info := type_info(SDL_AudioSpec); for info.members { if it.name == { case "format"; assert(it.offset_in_bytes == 0, "SDL_AudioSpec.format has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AudioSpec.format has unexpected size % instead of 4", it.type.runtime_size); case "channels"; assert(it.offset_in_bytes == 4, "SDL_AudioSpec.channels has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AudioSpec.channels has unexpected size % instead of 4", it.type.runtime_size); case "freq"; assert(it.offset_in_bytes == 8, "SDL_AudioSpec.freq has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AudioSpec.freq has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_AudioSpec) == 12, "SDL_AudioSpec has size % instead of 12", size_of(SDL_AudioSpec)); } { info := type_info(SDL_Color); for info.members { if it.name == { case "r"; assert(it.offset_in_bytes == 0, "SDL_Color.r has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_Color.r has unexpected size % instead of 1", it.type.runtime_size); case "g"; assert(it.offset_in_bytes == 1, "SDL_Color.g has unexpected offset % instead of 1", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_Color.g has unexpected size % instead of 1", it.type.runtime_size); case "b"; assert(it.offset_in_bytes == 2, "SDL_Color.b has unexpected offset % instead of 2", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_Color.b has unexpected size % instead of 1", it.type.runtime_size); case "a"; assert(it.offset_in_bytes == 3, "SDL_Color.a has unexpected offset % instead of 3", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_Color.a has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_Color) == 4, "SDL_Color has size % instead of 4", size_of(SDL_Color)); } { info := type_info(SDL_FColor); for info.members { if it.name == { case "r"; assert(it.offset_in_bytes == 0, "SDL_FColor.r has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FColor.r has unexpected size % instead of 4", it.type.runtime_size); case "g"; assert(it.offset_in_bytes == 4, "SDL_FColor.g has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FColor.g has unexpected size % instead of 4", it.type.runtime_size); case "b"; assert(it.offset_in_bytes == 8, "SDL_FColor.b has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FColor.b has unexpected size % instead of 4", it.type.runtime_size); case "a"; assert(it.offset_in_bytes == 12, "SDL_FColor.a has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FColor.a has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_FColor) == 16, "SDL_FColor has size % instead of 16", size_of(SDL_FColor)); } { info := type_info(SDL_Palette); for info.members { if it.name == { case "ncolors"; assert(it.offset_in_bytes == 0, "SDL_Palette.ncolors has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Palette.ncolors has unexpected size % instead of 4", it.type.runtime_size); case "colors"; assert(it.offset_in_bytes == 8, "SDL_Palette.colors has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_Palette.colors has unexpected size % instead of 8", it.type.runtime_size); case "version"; assert(it.offset_in_bytes == 16, "SDL_Palette.version has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Palette.version has unexpected size % instead of 4", it.type.runtime_size); case "refcount"; assert(it.offset_in_bytes == 20, "SDL_Palette.refcount has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Palette.refcount has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_Palette) == 24, "SDL_Palette has size % instead of 24", size_of(SDL_Palette)); } { info := type_info(SDL_PixelFormatDetails); for info.members { if it.name == { case "format"; assert(it.offset_in_bytes == 0, "SDL_PixelFormatDetails.format has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PixelFormatDetails.format has unexpected size % instead of 4", it.type.runtime_size); case "bits_per_pixel"; assert(it.offset_in_bytes == 4, "SDL_PixelFormatDetails.bits_per_pixel has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.bits_per_pixel has unexpected size % instead of 1", it.type.runtime_size); case "bytes_per_pixel"; assert(it.offset_in_bytes == 5, "SDL_PixelFormatDetails.bytes_per_pixel has unexpected offset % instead of 5", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.bytes_per_pixel has unexpected size % instead of 1", it.type.runtime_size); case "padding"; assert(it.offset_in_bytes == 6, "SDL_PixelFormatDetails.padding has unexpected offset % instead of 6", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_PixelFormatDetails.padding has unexpected size % instead of 2", it.type.runtime_size); case "Rmask"; assert(it.offset_in_bytes == 8, "SDL_PixelFormatDetails.Rmask has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PixelFormatDetails.Rmask has unexpected size % instead of 4", it.type.runtime_size); case "Gmask"; assert(it.offset_in_bytes == 12, "SDL_PixelFormatDetails.Gmask has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PixelFormatDetails.Gmask has unexpected size % instead of 4", it.type.runtime_size); case "Bmask"; assert(it.offset_in_bytes == 16, "SDL_PixelFormatDetails.Bmask has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PixelFormatDetails.Bmask has unexpected size % instead of 4", it.type.runtime_size); case "Amask"; assert(it.offset_in_bytes == 20, "SDL_PixelFormatDetails.Amask has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PixelFormatDetails.Amask has unexpected size % instead of 4", it.type.runtime_size); case "Rbits"; assert(it.offset_in_bytes == 24, "SDL_PixelFormatDetails.Rbits has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.Rbits has unexpected size % instead of 1", it.type.runtime_size); case "Gbits"; assert(it.offset_in_bytes == 25, "SDL_PixelFormatDetails.Gbits has unexpected offset % instead of 25", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.Gbits has unexpected size % instead of 1", it.type.runtime_size); case "Bbits"; assert(it.offset_in_bytes == 26, "SDL_PixelFormatDetails.Bbits has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.Bbits has unexpected size % instead of 1", it.type.runtime_size); case "Abits"; assert(it.offset_in_bytes == 27, "SDL_PixelFormatDetails.Abits has unexpected offset % instead of 27", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.Abits has unexpected size % instead of 1", it.type.runtime_size); case "Rshift"; assert(it.offset_in_bytes == 28, "SDL_PixelFormatDetails.Rshift has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.Rshift has unexpected size % instead of 1", it.type.runtime_size); case "Gshift"; assert(it.offset_in_bytes == 29, "SDL_PixelFormatDetails.Gshift has unexpected offset % instead of 29", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.Gshift has unexpected size % instead of 1", it.type.runtime_size); case "Bshift"; assert(it.offset_in_bytes == 30, "SDL_PixelFormatDetails.Bshift has unexpected offset % instead of 30", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.Bshift has unexpected size % instead of 1", it.type.runtime_size); case "Ashift"; assert(it.offset_in_bytes == 31, "SDL_PixelFormatDetails.Ashift has unexpected offset % instead of 31", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PixelFormatDetails.Ashift has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_PixelFormatDetails) == 32, "SDL_PixelFormatDetails has size % instead of 32", size_of(SDL_PixelFormatDetails)); } { info := type_info(SDL_Point); for info.members { if it.name == { case "x"; assert(it.offset_in_bytes == 0, "SDL_Point.x has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Point.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 4, "SDL_Point.y has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Point.y has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_Point) == 8, "SDL_Point has size % instead of 8", size_of(SDL_Point)); } { info := type_info(SDL_FPoint); for info.members { if it.name == { case "x"; assert(it.offset_in_bytes == 0, "SDL_FPoint.x has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FPoint.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 4, "SDL_FPoint.y has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FPoint.y has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_FPoint) == 8, "SDL_FPoint has size % instead of 8", size_of(SDL_FPoint)); } { info := type_info(SDL_Rect); for info.members { if it.name == { case "x"; assert(it.offset_in_bytes == 0, "SDL_Rect.x has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Rect.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 4, "SDL_Rect.y has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Rect.y has unexpected size % instead of 4", it.type.runtime_size); case "w"; assert(it.offset_in_bytes == 8, "SDL_Rect.w has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Rect.w has unexpected size % instead of 4", it.type.runtime_size); case "h"; assert(it.offset_in_bytes == 12, "SDL_Rect.h has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Rect.h has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_Rect) == 16, "SDL_Rect has size % instead of 16", size_of(SDL_Rect)); } { info := type_info(SDL_FRect); for info.members { if it.name == { case "x"; assert(it.offset_in_bytes == 0, "SDL_FRect.x has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FRect.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 4, "SDL_FRect.y has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FRect.y has unexpected size % instead of 4", it.type.runtime_size); case "w"; assert(it.offset_in_bytes == 8, "SDL_FRect.w has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FRect.w has unexpected size % instead of 4", it.type.runtime_size); case "h"; assert(it.offset_in_bytes == 12, "SDL_FRect.h has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_FRect.h has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_FRect) == 16, "SDL_FRect has size % instead of 16", size_of(SDL_FRect)); } { info := type_info(SDL_Surface); for info.members { if it.name == { case "flags"; assert(it.offset_in_bytes == 0, "SDL_Surface.flags has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Surface.flags has unexpected size % instead of 4", it.type.runtime_size); case "format"; assert(it.offset_in_bytes == 4, "SDL_Surface.format has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Surface.format has unexpected size % instead of 4", it.type.runtime_size); case "w"; assert(it.offset_in_bytes == 8, "SDL_Surface.w has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Surface.w has unexpected size % instead of 4", it.type.runtime_size); case "h"; assert(it.offset_in_bytes == 12, "SDL_Surface.h has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Surface.h has unexpected size % instead of 4", it.type.runtime_size); case "pitch"; assert(it.offset_in_bytes == 16, "SDL_Surface.pitch has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Surface.pitch has unexpected size % instead of 4", it.type.runtime_size); case "pixels"; assert(it.offset_in_bytes == 24, "SDL_Surface.pixels has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_Surface.pixels has unexpected size % instead of 8", it.type.runtime_size); case "refcount"; assert(it.offset_in_bytes == 32, "SDL_Surface.refcount has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Surface.refcount has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 40, "SDL_Surface.reserved has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_Surface.reserved has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_Surface) == 48, "SDL_Surface has size % instead of 48", size_of(SDL_Surface)); } { info := type_info(SDL_CameraSpec); for info.members { if it.name == { case "format"; assert(it.offset_in_bytes == 0, "SDL_CameraSpec.format has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraSpec.format has unexpected size % instead of 4", it.type.runtime_size); case "colorspace"; assert(it.offset_in_bytes == 4, "SDL_CameraSpec.colorspace has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraSpec.colorspace has unexpected size % instead of 4", it.type.runtime_size); case "width"; assert(it.offset_in_bytes == 8, "SDL_CameraSpec.width has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraSpec.width has unexpected size % instead of 4", it.type.runtime_size); case "height"; assert(it.offset_in_bytes == 12, "SDL_CameraSpec.height has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraSpec.height has unexpected size % instead of 4", it.type.runtime_size); case "framerate_numerator"; assert(it.offset_in_bytes == 16, "SDL_CameraSpec.framerate_numerator has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraSpec.framerate_numerator has unexpected size % instead of 4", it.type.runtime_size); case "framerate_denominator"; assert(it.offset_in_bytes == 20, "SDL_CameraSpec.framerate_denominator has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraSpec.framerate_denominator has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_CameraSpec) == 24, "SDL_CameraSpec has size % instead of 24", size_of(SDL_CameraSpec)); } { info := type_info(SDL_DisplayMode); for info.members { if it.name == { case "displayID"; assert(it.offset_in_bytes == 0, "SDL_DisplayMode.displayID has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayMode.displayID has unexpected size % instead of 4", it.type.runtime_size); case "format"; assert(it.offset_in_bytes == 4, "SDL_DisplayMode.format has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayMode.format has unexpected size % instead of 4", it.type.runtime_size); case "w"; assert(it.offset_in_bytes == 8, "SDL_DisplayMode.w has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayMode.w has unexpected size % instead of 4", it.type.runtime_size); case "h"; assert(it.offset_in_bytes == 12, "SDL_DisplayMode.h has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayMode.h has unexpected size % instead of 4", it.type.runtime_size); case "pixel_density"; assert(it.offset_in_bytes == 16, "SDL_DisplayMode.pixel_density has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayMode.pixel_density has unexpected size % instead of 4", it.type.runtime_size); case "refresh_rate"; assert(it.offset_in_bytes == 20, "SDL_DisplayMode.refresh_rate has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayMode.refresh_rate has unexpected size % instead of 4", it.type.runtime_size); case "refresh_rate_numerator"; assert(it.offset_in_bytes == 24, "SDL_DisplayMode.refresh_rate_numerator has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayMode.refresh_rate_numerator has unexpected size % instead of 4", it.type.runtime_size); case "refresh_rate_denominator"; assert(it.offset_in_bytes == 28, "SDL_DisplayMode.refresh_rate_denominator has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayMode.refresh_rate_denominator has unexpected size % instead of 4", it.type.runtime_size); case "internal"; assert(it.offset_in_bytes == 32, "SDL_DisplayMode.internal has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_DisplayMode.internal has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_DisplayMode) == 40, "SDL_DisplayMode has size % instead of 40", size_of(SDL_DisplayMode)); } { info := type_info(SDL_DialogFileFilter); for info.members { if it.name == { case "name"; assert(it.offset_in_bytes == 0, "SDL_DialogFileFilter.name has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_DialogFileFilter.name has unexpected size % instead of 8", it.type.runtime_size); case "pattern"; assert(it.offset_in_bytes == 8, "SDL_DialogFileFilter.pattern has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_DialogFileFilter.pattern has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_DialogFileFilter) == 16, "SDL_DialogFileFilter has size % instead of 16", size_of(SDL_DialogFileFilter)); } { info := type_info(SDL_GUID); for info.members { if it.name == { case "data"; assert(it.offset_in_bytes == 0, "SDL_GUID.data has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_GUID.data has unexpected size % instead of 16", it.type.runtime_size); } } assert(size_of(SDL_GUID) == 16, "SDL_GUID has size % instead of 16", size_of(SDL_GUID)); } { info := type_info(SDL_VirtualJoystickTouchpadDesc); for info.members { if it.name == { case "nfingers"; assert(it.offset_in_bytes == 0, "SDL_VirtualJoystickTouchpadDesc.nfingers has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickTouchpadDesc.nfingers has unexpected size % instead of 2", it.type.runtime_size); case "padding"; assert(it.offset_in_bytes == 2, "SDL_VirtualJoystickTouchpadDesc.padding has unexpected offset % instead of 2", it.offset_in_bytes); assert(it.type.runtime_size == 6, "SDL_VirtualJoystickTouchpadDesc.padding has unexpected size % instead of 6", it.type.runtime_size); } } assert(size_of(SDL_VirtualJoystickTouchpadDesc) == 8, "SDL_VirtualJoystickTouchpadDesc has size % instead of 8", size_of(SDL_VirtualJoystickTouchpadDesc)); } { info := type_info(SDL_VirtualJoystickSensorDesc); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_VirtualJoystickSensorDesc.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_VirtualJoystickSensorDesc.type has unexpected size % instead of 4", it.type.runtime_size); case "rate"; assert(it.offset_in_bytes == 4, "SDL_VirtualJoystickSensorDesc.rate has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_VirtualJoystickSensorDesc.rate has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_VirtualJoystickSensorDesc) == 8, "SDL_VirtualJoystickSensorDesc has size % instead of 8", size_of(SDL_VirtualJoystickSensorDesc)); } { info := type_info(SDL_VirtualJoystickDesc); for info.members { if it.name == { case "version"; assert(it.offset_in_bytes == 0, "SDL_VirtualJoystickDesc.version has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_VirtualJoystickDesc.version has unexpected size % instead of 4", it.type.runtime_size); case "type"; assert(it.offset_in_bytes == 4, "SDL_VirtualJoystickDesc.type has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.type has unexpected size % instead of 2", it.type.runtime_size); case "padding"; assert(it.offset_in_bytes == 6, "SDL_VirtualJoystickDesc.padding has unexpected offset % instead of 6", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.padding has unexpected size % instead of 2", it.type.runtime_size); case "vendor_id"; assert(it.offset_in_bytes == 8, "SDL_VirtualJoystickDesc.vendor_id has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.vendor_id has unexpected size % instead of 2", it.type.runtime_size); case "product_id"; assert(it.offset_in_bytes == 10, "SDL_VirtualJoystickDesc.product_id has unexpected offset % instead of 10", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.product_id has unexpected size % instead of 2", it.type.runtime_size); case "naxes"; assert(it.offset_in_bytes == 12, "SDL_VirtualJoystickDesc.naxes has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.naxes has unexpected size % instead of 2", it.type.runtime_size); case "nbuttons"; assert(it.offset_in_bytes == 14, "SDL_VirtualJoystickDesc.nbuttons has unexpected offset % instead of 14", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.nbuttons has unexpected size % instead of 2", it.type.runtime_size); case "nballs"; assert(it.offset_in_bytes == 16, "SDL_VirtualJoystickDesc.nballs has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.nballs has unexpected size % instead of 2", it.type.runtime_size); case "nhats"; assert(it.offset_in_bytes == 18, "SDL_VirtualJoystickDesc.nhats has unexpected offset % instead of 18", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.nhats has unexpected size % instead of 2", it.type.runtime_size); case "ntouchpads"; assert(it.offset_in_bytes == 20, "SDL_VirtualJoystickDesc.ntouchpads has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.ntouchpads has unexpected size % instead of 2", it.type.runtime_size); case "nsensors"; assert(it.offset_in_bytes == 22, "SDL_VirtualJoystickDesc.nsensors has unexpected offset % instead of 22", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_VirtualJoystickDesc.nsensors has unexpected size % instead of 2", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 24, "SDL_VirtualJoystickDesc.padding2 has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_VirtualJoystickDesc.padding2 has unexpected size % instead of 4", it.type.runtime_size); case "button_mask"; assert(it.offset_in_bytes == 28, "SDL_VirtualJoystickDesc.button_mask has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_VirtualJoystickDesc.button_mask has unexpected size % instead of 4", it.type.runtime_size); case "axis_mask"; assert(it.offset_in_bytes == 32, "SDL_VirtualJoystickDesc.axis_mask has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_VirtualJoystickDesc.axis_mask has unexpected size % instead of 4", it.type.runtime_size); case "name"; assert(it.offset_in_bytes == 40, "SDL_VirtualJoystickDesc.name has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.name has unexpected size % instead of 8", it.type.runtime_size); case "touchpads"; assert(it.offset_in_bytes == 48, "SDL_VirtualJoystickDesc.touchpads has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.touchpads has unexpected size % instead of 8", it.type.runtime_size); case "sensors"; assert(it.offset_in_bytes == 56, "SDL_VirtualJoystickDesc.sensors has unexpected offset % instead of 56", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.sensors has unexpected size % instead of 8", it.type.runtime_size); case "userdata"; assert(it.offset_in_bytes == 64, "SDL_VirtualJoystickDesc.userdata has unexpected offset % instead of 64", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.userdata has unexpected size % instead of 8", it.type.runtime_size); case "Update"; assert(it.offset_in_bytes == 72, "SDL_VirtualJoystickDesc.Update has unexpected offset % instead of 72", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.Update has unexpected size % instead of 8", it.type.runtime_size); case "SetPlayerIndex"; assert(it.offset_in_bytes == 80, "SDL_VirtualJoystickDesc.SetPlayerIndex has unexpected offset % instead of 80", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.SetPlayerIndex has unexpected size % instead of 8", it.type.runtime_size); case "Rumble"; assert(it.offset_in_bytes == 88, "SDL_VirtualJoystickDesc.Rumble has unexpected offset % instead of 88", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.Rumble has unexpected size % instead of 8", it.type.runtime_size); case "RumbleTriggers"; assert(it.offset_in_bytes == 96, "SDL_VirtualJoystickDesc.RumbleTriggers has unexpected offset % instead of 96", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.RumbleTriggers has unexpected size % instead of 8", it.type.runtime_size); case "SetLED"; assert(it.offset_in_bytes == 104, "SDL_VirtualJoystickDesc.SetLED has unexpected offset % instead of 104", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.SetLED has unexpected size % instead of 8", it.type.runtime_size); case "SendEffect"; assert(it.offset_in_bytes == 112, "SDL_VirtualJoystickDesc.SendEffect has unexpected offset % instead of 112", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.SendEffect has unexpected size % instead of 8", it.type.runtime_size); case "SetSensorsEnabled"; assert(it.offset_in_bytes == 120, "SDL_VirtualJoystickDesc.SetSensorsEnabled has unexpected offset % instead of 120", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.SetSensorsEnabled has unexpected size % instead of 8", it.type.runtime_size); case "Cleanup"; assert(it.offset_in_bytes == 128, "SDL_VirtualJoystickDesc.Cleanup has unexpected offset % instead of 128", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_VirtualJoystickDesc.Cleanup has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_VirtualJoystickDesc) == 136, "SDL_VirtualJoystickDesc has size % instead of 136", size_of(SDL_VirtualJoystickDesc)); } { info := type_info(SDL_GamepadBinding); for info.members { if it.name == { case "input_type"; assert(it.offset_in_bytes == 0, "SDL_GamepadBinding.input_type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadBinding.input_type has unexpected size % instead of 4", it.type.runtime_size); case "input"; assert(it.offset_in_bytes == 4, "SDL_GamepadBinding.input has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 12, "SDL_GamepadBinding.input has unexpected size % instead of 12", it.type.runtime_size); case "output_type"; assert(it.offset_in_bytes == 16, "SDL_GamepadBinding.output_type has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadBinding.output_type has unexpected size % instead of 4", it.type.runtime_size); case "output"; assert(it.offset_in_bytes == 20, "SDL_GamepadBinding.output has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 12, "SDL_GamepadBinding.output has unexpected size % instead of 12", it.type.runtime_size); } } assert(size_of(SDL_GamepadBinding) == 32, "SDL_GamepadBinding has size % instead of 32", size_of(SDL_GamepadBinding)); } { info := type_info(SDL_Finger); for info.members { if it.name == { case "id"; assert(it.offset_in_bytes == 0, "SDL_Finger.id has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_Finger.id has unexpected size % instead of 8", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 8, "SDL_Finger.x has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Finger.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 12, "SDL_Finger.y has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Finger.y has unexpected size % instead of 4", it.type.runtime_size); case "pressure"; assert(it.offset_in_bytes == 16, "SDL_Finger.pressure has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Finger.pressure has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_Finger) == 24, "SDL_Finger has size % instead of 24", size_of(SDL_Finger)); } { info := type_info(SDL_CommonEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_CommonEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CommonEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_CommonEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CommonEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_CommonEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_CommonEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_CommonEvent) == 16, "SDL_CommonEvent has size % instead of 16", size_of(SDL_CommonEvent)); } { info := type_info(SDL_DisplayEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_DisplayEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_DisplayEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_DisplayEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_DisplayEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "displayID"; assert(it.offset_in_bytes == 16, "SDL_DisplayEvent.displayID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayEvent.displayID has unexpected size % instead of 4", it.type.runtime_size); case "data1"; assert(it.offset_in_bytes == 20, "SDL_DisplayEvent.data1 has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayEvent.data1 has unexpected size % instead of 4", it.type.runtime_size); case "data2"; assert(it.offset_in_bytes == 24, "SDL_DisplayEvent.data2 has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DisplayEvent.data2 has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_DisplayEvent) == 32, "SDL_DisplayEvent has size % instead of 32", size_of(SDL_DisplayEvent)); } { info := type_info(SDL_WindowEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_WindowEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_WindowEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_WindowEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_WindowEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_WindowEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_WindowEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_WindowEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_WindowEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "data1"; assert(it.offset_in_bytes == 20, "SDL_WindowEvent.data1 has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_WindowEvent.data1 has unexpected size % instead of 4", it.type.runtime_size); case "data2"; assert(it.offset_in_bytes == 24, "SDL_WindowEvent.data2 has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_WindowEvent.data2 has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_WindowEvent) == 32, "SDL_WindowEvent has size % instead of 32", size_of(SDL_WindowEvent)); } { info := type_info(SDL_KeyboardDeviceEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_KeyboardDeviceEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardDeviceEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_KeyboardDeviceEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardDeviceEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_KeyboardDeviceEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_KeyboardDeviceEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_KeyboardDeviceEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardDeviceEvent.which has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_KeyboardDeviceEvent) == 24, "SDL_KeyboardDeviceEvent has size % instead of 24", size_of(SDL_KeyboardDeviceEvent)); } { info := type_info(SDL_KeyboardEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_KeyboardEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_KeyboardEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_KeyboardEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_KeyboardEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_KeyboardEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_KeyboardEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "scancode"; assert(it.offset_in_bytes == 24, "SDL_KeyboardEvent.scancode has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardEvent.scancode has unexpected size % instead of 4", it.type.runtime_size); case "key"; assert(it.offset_in_bytes == 28, "SDL_KeyboardEvent.key has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_KeyboardEvent.key has unexpected size % instead of 4", it.type.runtime_size); case "mod"; assert(it.offset_in_bytes == 32, "SDL_KeyboardEvent.mod has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_KeyboardEvent.mod has unexpected size % instead of 2", it.type.runtime_size); case "raw"; assert(it.offset_in_bytes == 34, "SDL_KeyboardEvent.raw has unexpected offset % instead of 34", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_KeyboardEvent.raw has unexpected size % instead of 2", it.type.runtime_size); case "down"; assert(it.offset_in_bytes == 36, "SDL_KeyboardEvent.down has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_KeyboardEvent.down has unexpected size % instead of 1", it.type.runtime_size); case "repeat"; assert(it.offset_in_bytes == 37, "SDL_KeyboardEvent.repeat has unexpected offset % instead of 37", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_KeyboardEvent.repeat has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_KeyboardEvent) == 40, "SDL_KeyboardEvent has size % instead of 40", size_of(SDL_KeyboardEvent)); } { info := type_info(SDL_TextEditingEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_TextEditingEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_TextEditingEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_TextEditingEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TextEditingEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_TextEditingEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "text"; assert(it.offset_in_bytes == 24, "SDL_TextEditingEvent.text has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TextEditingEvent.text has unexpected size % instead of 8", it.type.runtime_size); case "start"; assert(it.offset_in_bytes == 32, "SDL_TextEditingEvent.start has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingEvent.start has unexpected size % instead of 4", it.type.runtime_size); case "length"; assert(it.offset_in_bytes == 36, "SDL_TextEditingEvent.length has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingEvent.length has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_TextEditingEvent) == 40, "SDL_TextEditingEvent has size % instead of 40", size_of(SDL_TextEditingEvent)); } { info := type_info(SDL_TextEditingCandidatesEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_TextEditingCandidatesEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingCandidatesEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_TextEditingCandidatesEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingCandidatesEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_TextEditingCandidatesEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TextEditingCandidatesEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_TextEditingCandidatesEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingCandidatesEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "candidates"; assert(it.offset_in_bytes == 24, "SDL_TextEditingCandidatesEvent.candidates has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TextEditingCandidatesEvent.candidates has unexpected size % instead of 8", it.type.runtime_size); case "num_candidates"; assert(it.offset_in_bytes == 32, "SDL_TextEditingCandidatesEvent.num_candidates has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingCandidatesEvent.num_candidates has unexpected size % instead of 4", it.type.runtime_size); case "selected_candidate"; assert(it.offset_in_bytes == 36, "SDL_TextEditingCandidatesEvent.selected_candidate has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextEditingCandidatesEvent.selected_candidate has unexpected size % instead of 4", it.type.runtime_size); case "horizontal"; assert(it.offset_in_bytes == 40, "SDL_TextEditingCandidatesEvent.horizontal has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_TextEditingCandidatesEvent.horizontal has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 41, "SDL_TextEditingCandidatesEvent.padding1 has unexpected offset % instead of 41", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_TextEditingCandidatesEvent.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 42, "SDL_TextEditingCandidatesEvent.padding2 has unexpected offset % instead of 42", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_TextEditingCandidatesEvent.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 43, "SDL_TextEditingCandidatesEvent.padding3 has unexpected offset % instead of 43", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_TextEditingCandidatesEvent.padding3 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_TextEditingCandidatesEvent) == 48, "SDL_TextEditingCandidatesEvent has size % instead of 48", size_of(SDL_TextEditingCandidatesEvent)); } { info := type_info(SDL_TextInputEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_TextInputEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextInputEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_TextInputEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextInputEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_TextInputEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TextInputEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_TextInputEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TextInputEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "text"; assert(it.offset_in_bytes == 24, "SDL_TextInputEvent.text has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TextInputEvent.text has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_TextInputEvent) == 32, "SDL_TextInputEvent has size % instead of 32", size_of(SDL_TextInputEvent)); } { info := type_info(SDL_MouseDeviceEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_MouseDeviceEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseDeviceEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_MouseDeviceEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseDeviceEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_MouseDeviceEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MouseDeviceEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_MouseDeviceEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseDeviceEvent.which has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_MouseDeviceEvent) == 24, "SDL_MouseDeviceEvent has size % instead of 24", size_of(SDL_MouseDeviceEvent)); } { info := type_info(SDL_MouseMotionEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_MouseMotionEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_MouseMotionEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_MouseMotionEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MouseMotionEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_MouseMotionEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_MouseMotionEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "state"; assert(it.offset_in_bytes == 24, "SDL_MouseMotionEvent.state has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.state has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 28, "SDL_MouseMotionEvent.x has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 32, "SDL_MouseMotionEvent.y has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.y has unexpected size % instead of 4", it.type.runtime_size); case "xrel"; assert(it.offset_in_bytes == 36, "SDL_MouseMotionEvent.xrel has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.xrel has unexpected size % instead of 4", it.type.runtime_size); case "yrel"; assert(it.offset_in_bytes == 40, "SDL_MouseMotionEvent.yrel has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseMotionEvent.yrel has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_MouseMotionEvent) == 48, "SDL_MouseMotionEvent has size % instead of 48", size_of(SDL_MouseMotionEvent)); } { info := type_info(SDL_MouseButtonEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_MouseButtonEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseButtonEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_MouseButtonEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseButtonEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_MouseButtonEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MouseButtonEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_MouseButtonEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseButtonEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_MouseButtonEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseButtonEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 24, "SDL_MouseButtonEvent.button has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_MouseButtonEvent.button has unexpected size % instead of 1", it.type.runtime_size); case "down"; assert(it.offset_in_bytes == 25, "SDL_MouseButtonEvent.down has unexpected offset % instead of 25", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_MouseButtonEvent.down has unexpected size % instead of 1", it.type.runtime_size); case "clicks"; assert(it.offset_in_bytes == 26, "SDL_MouseButtonEvent.clicks has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_MouseButtonEvent.clicks has unexpected size % instead of 1", it.type.runtime_size); case "padding"; assert(it.offset_in_bytes == 27, "SDL_MouseButtonEvent.padding has unexpected offset % instead of 27", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_MouseButtonEvent.padding has unexpected size % instead of 1", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 28, "SDL_MouseButtonEvent.x has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseButtonEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 32, "SDL_MouseButtonEvent.y has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseButtonEvent.y has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_MouseButtonEvent) == 40, "SDL_MouseButtonEvent has size % instead of 40", size_of(SDL_MouseButtonEvent)); } { info := type_info(SDL_MouseWheelEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_MouseWheelEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_MouseWheelEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_MouseWheelEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MouseWheelEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_MouseWheelEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_MouseWheelEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 24, "SDL_MouseWheelEvent.x has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 28, "SDL_MouseWheelEvent.y has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.y has unexpected size % instead of 4", it.type.runtime_size); case "direction"; assert(it.offset_in_bytes == 32, "SDL_MouseWheelEvent.direction has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.direction has unexpected size % instead of 4", it.type.runtime_size); case "mouse_x"; assert(it.offset_in_bytes == 36, "SDL_MouseWheelEvent.mouse_x has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.mouse_x has unexpected size % instead of 4", it.type.runtime_size); case "mouse_y"; assert(it.offset_in_bytes == 40, "SDL_MouseWheelEvent.mouse_y has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MouseWheelEvent.mouse_y has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_MouseWheelEvent) == 48, "SDL_MouseWheelEvent has size % instead of 48", size_of(SDL_MouseWheelEvent)); } { info := type_info(SDL_JoyAxisEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_JoyAxisEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyAxisEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_JoyAxisEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyAxisEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_JoyAxisEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_JoyAxisEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_JoyAxisEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyAxisEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "axis"; assert(it.offset_in_bytes == 20, "SDL_JoyAxisEvent.axis has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyAxisEvent.axis has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 21, "SDL_JoyAxisEvent.padding1 has unexpected offset % instead of 21", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyAxisEvent.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 22, "SDL_JoyAxisEvent.padding2 has unexpected offset % instead of 22", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyAxisEvent.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 23, "SDL_JoyAxisEvent.padding3 has unexpected offset % instead of 23", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyAxisEvent.padding3 has unexpected size % instead of 1", it.type.runtime_size); case "value"; assert(it.offset_in_bytes == 24, "SDL_JoyAxisEvent.value has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_JoyAxisEvent.value has unexpected size % instead of 2", it.type.runtime_size); case "padding4"; assert(it.offset_in_bytes == 26, "SDL_JoyAxisEvent.padding4 has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_JoyAxisEvent.padding4 has unexpected size % instead of 2", it.type.runtime_size); } } assert(size_of(SDL_JoyAxisEvent) == 32, "SDL_JoyAxisEvent has size % instead of 32", size_of(SDL_JoyAxisEvent)); } { info := type_info(SDL_JoyBallEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_JoyBallEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyBallEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_JoyBallEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyBallEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_JoyBallEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_JoyBallEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_JoyBallEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyBallEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "ball"; assert(it.offset_in_bytes == 20, "SDL_JoyBallEvent.ball has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyBallEvent.ball has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 21, "SDL_JoyBallEvent.padding1 has unexpected offset % instead of 21", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyBallEvent.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 22, "SDL_JoyBallEvent.padding2 has unexpected offset % instead of 22", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyBallEvent.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 23, "SDL_JoyBallEvent.padding3 has unexpected offset % instead of 23", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyBallEvent.padding3 has unexpected size % instead of 1", it.type.runtime_size); case "xrel"; assert(it.offset_in_bytes == 24, "SDL_JoyBallEvent.xrel has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_JoyBallEvent.xrel has unexpected size % instead of 2", it.type.runtime_size); case "yrel"; assert(it.offset_in_bytes == 26, "SDL_JoyBallEvent.yrel has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_JoyBallEvent.yrel has unexpected size % instead of 2", it.type.runtime_size); } } assert(size_of(SDL_JoyBallEvent) == 32, "SDL_JoyBallEvent has size % instead of 32", size_of(SDL_JoyBallEvent)); } { info := type_info(SDL_JoyHatEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_JoyHatEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyHatEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_JoyHatEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyHatEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_JoyHatEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_JoyHatEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_JoyHatEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyHatEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "hat"; assert(it.offset_in_bytes == 20, "SDL_JoyHatEvent.hat has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyHatEvent.hat has unexpected size % instead of 1", it.type.runtime_size); case "value"; assert(it.offset_in_bytes == 21, "SDL_JoyHatEvent.value has unexpected offset % instead of 21", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyHatEvent.value has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 22, "SDL_JoyHatEvent.padding1 has unexpected offset % instead of 22", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyHatEvent.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 23, "SDL_JoyHatEvent.padding2 has unexpected offset % instead of 23", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyHatEvent.padding2 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_JoyHatEvent) == 24, "SDL_JoyHatEvent has size % instead of 24", size_of(SDL_JoyHatEvent)); } { info := type_info(SDL_JoyButtonEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_JoyButtonEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyButtonEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_JoyButtonEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyButtonEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_JoyButtonEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_JoyButtonEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_JoyButtonEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyButtonEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 20, "SDL_JoyButtonEvent.button has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyButtonEvent.button has unexpected size % instead of 1", it.type.runtime_size); case "down"; assert(it.offset_in_bytes == 21, "SDL_JoyButtonEvent.down has unexpected offset % instead of 21", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyButtonEvent.down has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 22, "SDL_JoyButtonEvent.padding1 has unexpected offset % instead of 22", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyButtonEvent.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 23, "SDL_JoyButtonEvent.padding2 has unexpected offset % instead of 23", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_JoyButtonEvent.padding2 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_JoyButtonEvent) == 24, "SDL_JoyButtonEvent has size % instead of 24", size_of(SDL_JoyButtonEvent)); } { info := type_info(SDL_JoyDeviceEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_JoyDeviceEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyDeviceEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_JoyDeviceEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyDeviceEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_JoyDeviceEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_JoyDeviceEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_JoyDeviceEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyDeviceEvent.which has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_JoyDeviceEvent) == 24, "SDL_JoyDeviceEvent has size % instead of 24", size_of(SDL_JoyDeviceEvent)); } { info := type_info(SDL_JoyBatteryEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_JoyBatteryEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyBatteryEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_JoyBatteryEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyBatteryEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_JoyBatteryEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_JoyBatteryEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_JoyBatteryEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyBatteryEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "state"; assert(it.offset_in_bytes == 20, "SDL_JoyBatteryEvent.state has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyBatteryEvent.state has unexpected size % instead of 4", it.type.runtime_size); case "percent"; assert(it.offset_in_bytes == 24, "SDL_JoyBatteryEvent.percent has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_JoyBatteryEvent.percent has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_JoyBatteryEvent) == 32, "SDL_JoyBatteryEvent has size % instead of 32", size_of(SDL_JoyBatteryEvent)); } { info := type_info(SDL_GamepadAxisEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_GamepadAxisEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadAxisEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_GamepadAxisEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadAxisEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_GamepadAxisEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GamepadAxisEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_GamepadAxisEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadAxisEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "axis"; assert(it.offset_in_bytes == 20, "SDL_GamepadAxisEvent.axis has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GamepadAxisEvent.axis has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 21, "SDL_GamepadAxisEvent.padding1 has unexpected offset % instead of 21", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GamepadAxisEvent.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 22, "SDL_GamepadAxisEvent.padding2 has unexpected offset % instead of 22", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GamepadAxisEvent.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 23, "SDL_GamepadAxisEvent.padding3 has unexpected offset % instead of 23", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GamepadAxisEvent.padding3 has unexpected size % instead of 1", it.type.runtime_size); case "value"; assert(it.offset_in_bytes == 24, "SDL_GamepadAxisEvent.value has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_GamepadAxisEvent.value has unexpected size % instead of 2", it.type.runtime_size); case "padding4"; assert(it.offset_in_bytes == 26, "SDL_GamepadAxisEvent.padding4 has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_GamepadAxisEvent.padding4 has unexpected size % instead of 2", it.type.runtime_size); } } assert(size_of(SDL_GamepadAxisEvent) == 32, "SDL_GamepadAxisEvent has size % instead of 32", size_of(SDL_GamepadAxisEvent)); } { info := type_info(SDL_GamepadButtonEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_GamepadButtonEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadButtonEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_GamepadButtonEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadButtonEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_GamepadButtonEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GamepadButtonEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_GamepadButtonEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadButtonEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 20, "SDL_GamepadButtonEvent.button has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GamepadButtonEvent.button has unexpected size % instead of 1", it.type.runtime_size); case "down"; assert(it.offset_in_bytes == 21, "SDL_GamepadButtonEvent.down has unexpected offset % instead of 21", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GamepadButtonEvent.down has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 22, "SDL_GamepadButtonEvent.padding1 has unexpected offset % instead of 22", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GamepadButtonEvent.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 23, "SDL_GamepadButtonEvent.padding2 has unexpected offset % instead of 23", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GamepadButtonEvent.padding2 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GamepadButtonEvent) == 24, "SDL_GamepadButtonEvent has size % instead of 24", size_of(SDL_GamepadButtonEvent)); } { info := type_info(SDL_GamepadDeviceEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_GamepadDeviceEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadDeviceEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_GamepadDeviceEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadDeviceEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_GamepadDeviceEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GamepadDeviceEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_GamepadDeviceEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadDeviceEvent.which has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GamepadDeviceEvent) == 24, "SDL_GamepadDeviceEvent has size % instead of 24", size_of(SDL_GamepadDeviceEvent)); } { info := type_info(SDL_GamepadTouchpadEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_GamepadTouchpadEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadTouchpadEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_GamepadTouchpadEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadTouchpadEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_GamepadTouchpadEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GamepadTouchpadEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_GamepadTouchpadEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadTouchpadEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "touchpad"; assert(it.offset_in_bytes == 20, "SDL_GamepadTouchpadEvent.touchpad has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadTouchpadEvent.touchpad has unexpected size % instead of 4", it.type.runtime_size); case "finger"; assert(it.offset_in_bytes == 24, "SDL_GamepadTouchpadEvent.finger has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadTouchpadEvent.finger has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 28, "SDL_GamepadTouchpadEvent.x has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadTouchpadEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 32, "SDL_GamepadTouchpadEvent.y has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadTouchpadEvent.y has unexpected size % instead of 4", it.type.runtime_size); case "pressure"; assert(it.offset_in_bytes == 36, "SDL_GamepadTouchpadEvent.pressure has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadTouchpadEvent.pressure has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GamepadTouchpadEvent) == 40, "SDL_GamepadTouchpadEvent has size % instead of 40", size_of(SDL_GamepadTouchpadEvent)); } { info := type_info(SDL_GamepadSensorEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_GamepadSensorEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadSensorEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_GamepadSensorEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadSensorEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_GamepadSensorEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GamepadSensorEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_GamepadSensorEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadSensorEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "sensor"; assert(it.offset_in_bytes == 20, "SDL_GamepadSensorEvent.sensor has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GamepadSensorEvent.sensor has unexpected size % instead of 4", it.type.runtime_size); case "data"; assert(it.offset_in_bytes == 24, "SDL_GamepadSensorEvent.data has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 12, "SDL_GamepadSensorEvent.data has unexpected size % instead of 12", it.type.runtime_size); case "sensor_timestamp"; assert(it.offset_in_bytes == 40, "SDL_GamepadSensorEvent.sensor_timestamp has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GamepadSensorEvent.sensor_timestamp has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_GamepadSensorEvent) == 48, "SDL_GamepadSensorEvent has size % instead of 48", size_of(SDL_GamepadSensorEvent)); } { info := type_info(SDL_AudioDeviceEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_AudioDeviceEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AudioDeviceEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_AudioDeviceEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AudioDeviceEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_AudioDeviceEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_AudioDeviceEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_AudioDeviceEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_AudioDeviceEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "recording"; assert(it.offset_in_bytes == 20, "SDL_AudioDeviceEvent.recording has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_AudioDeviceEvent.recording has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 21, "SDL_AudioDeviceEvent.padding1 has unexpected offset % instead of 21", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_AudioDeviceEvent.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 22, "SDL_AudioDeviceEvent.padding2 has unexpected offset % instead of 22", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_AudioDeviceEvent.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 23, "SDL_AudioDeviceEvent.padding3 has unexpected offset % instead of 23", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_AudioDeviceEvent.padding3 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_AudioDeviceEvent) == 24, "SDL_AudioDeviceEvent has size % instead of 24", size_of(SDL_AudioDeviceEvent)); } { info := type_info(SDL_CameraDeviceEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_CameraDeviceEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraDeviceEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_CameraDeviceEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraDeviceEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_CameraDeviceEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_CameraDeviceEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_CameraDeviceEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_CameraDeviceEvent.which has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_CameraDeviceEvent) == 24, "SDL_CameraDeviceEvent has size % instead of 24", size_of(SDL_CameraDeviceEvent)); } { info := type_info(SDL_RenderEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_RenderEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_RenderEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_RenderEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_RenderEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_RenderEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_RenderEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_RenderEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_RenderEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_RenderEvent) == 24, "SDL_RenderEvent has size % instead of 24", size_of(SDL_RenderEvent)); } { info := type_info(SDL_TouchFingerEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_TouchFingerEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TouchFingerEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_TouchFingerEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TouchFingerEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_TouchFingerEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TouchFingerEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "touchID"; assert(it.offset_in_bytes == 16, "SDL_TouchFingerEvent.touchID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TouchFingerEvent.touchID has unexpected size % instead of 8", it.type.runtime_size); case "fingerID"; assert(it.offset_in_bytes == 24, "SDL_TouchFingerEvent.fingerID has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_TouchFingerEvent.fingerID has unexpected size % instead of 8", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 32, "SDL_TouchFingerEvent.x has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TouchFingerEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 36, "SDL_TouchFingerEvent.y has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TouchFingerEvent.y has unexpected size % instead of 4", it.type.runtime_size); case "dx"; assert(it.offset_in_bytes == 40, "SDL_TouchFingerEvent.dx has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TouchFingerEvent.dx has unexpected size % instead of 4", it.type.runtime_size); case "dy"; assert(it.offset_in_bytes == 44, "SDL_TouchFingerEvent.dy has unexpected offset % instead of 44", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TouchFingerEvent.dy has unexpected size % instead of 4", it.type.runtime_size); case "pressure"; assert(it.offset_in_bytes == 48, "SDL_TouchFingerEvent.pressure has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TouchFingerEvent.pressure has unexpected size % instead of 4", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 52, "SDL_TouchFingerEvent.windowID has unexpected offset % instead of 52", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_TouchFingerEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_TouchFingerEvent) == 56, "SDL_TouchFingerEvent has size % instead of 56", size_of(SDL_TouchFingerEvent)); } { info := type_info(SDL_PenProximityEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_PenProximityEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenProximityEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_PenProximityEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenProximityEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_PenProximityEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PenProximityEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_PenProximityEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenProximityEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_PenProximityEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenProximityEvent.which has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_PenProximityEvent) == 24, "SDL_PenProximityEvent has size % instead of 24", size_of(SDL_PenProximityEvent)); } { info := type_info(SDL_PenMotionEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_PenMotionEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenMotionEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_PenMotionEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenMotionEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_PenMotionEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PenMotionEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_PenMotionEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenMotionEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_PenMotionEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenMotionEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "pen_state"; assert(it.offset_in_bytes == 24, "SDL_PenMotionEvent.pen_state has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenMotionEvent.pen_state has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 28, "SDL_PenMotionEvent.x has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenMotionEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 32, "SDL_PenMotionEvent.y has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenMotionEvent.y has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_PenMotionEvent) == 40, "SDL_PenMotionEvent has size % instead of 40", size_of(SDL_PenMotionEvent)); } { info := type_info(SDL_PenTouchEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_PenTouchEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenTouchEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_PenTouchEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenTouchEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_PenTouchEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PenTouchEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_PenTouchEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenTouchEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_PenTouchEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenTouchEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "pen_state"; assert(it.offset_in_bytes == 24, "SDL_PenTouchEvent.pen_state has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenTouchEvent.pen_state has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 28, "SDL_PenTouchEvent.x has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenTouchEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 32, "SDL_PenTouchEvent.y has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenTouchEvent.y has unexpected size % instead of 4", it.type.runtime_size); case "eraser"; assert(it.offset_in_bytes == 36, "SDL_PenTouchEvent.eraser has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PenTouchEvent.eraser has unexpected size % instead of 1", it.type.runtime_size); case "down"; assert(it.offset_in_bytes == 37, "SDL_PenTouchEvent.down has unexpected offset % instead of 37", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PenTouchEvent.down has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_PenTouchEvent) == 40, "SDL_PenTouchEvent has size % instead of 40", size_of(SDL_PenTouchEvent)); } { info := type_info(SDL_PenButtonEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_PenButtonEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenButtonEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_PenButtonEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenButtonEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_PenButtonEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PenButtonEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_PenButtonEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenButtonEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_PenButtonEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenButtonEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "pen_state"; assert(it.offset_in_bytes == 24, "SDL_PenButtonEvent.pen_state has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenButtonEvent.pen_state has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 28, "SDL_PenButtonEvent.x has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenButtonEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 32, "SDL_PenButtonEvent.y has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenButtonEvent.y has unexpected size % instead of 4", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 36, "SDL_PenButtonEvent.button has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PenButtonEvent.button has unexpected size % instead of 1", it.type.runtime_size); case "down"; assert(it.offset_in_bytes == 37, "SDL_PenButtonEvent.down has unexpected offset % instead of 37", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_PenButtonEvent.down has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_PenButtonEvent) == 40, "SDL_PenButtonEvent has size % instead of 40", size_of(SDL_PenButtonEvent)); } { info := type_info(SDL_PenAxisEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_PenAxisEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_PenAxisEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_PenAxisEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PenAxisEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_PenAxisEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 20, "SDL_PenAxisEvent.which has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "pen_state"; assert(it.offset_in_bytes == 24, "SDL_PenAxisEvent.pen_state has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.pen_state has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 28, "SDL_PenAxisEvent.x has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 32, "SDL_PenAxisEvent.y has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.y has unexpected size % instead of 4", it.type.runtime_size); case "axis"; assert(it.offset_in_bytes == 36, "SDL_PenAxisEvent.axis has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.axis has unexpected size % instead of 4", it.type.runtime_size); case "value"; assert(it.offset_in_bytes == 40, "SDL_PenAxisEvent.value has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PenAxisEvent.value has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_PenAxisEvent) == 48, "SDL_PenAxisEvent has size % instead of 48", size_of(SDL_PenAxisEvent)); } { info := type_info(SDL_DropEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_DropEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DropEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_DropEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DropEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_DropEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_DropEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_DropEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DropEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 20, "SDL_DropEvent.x has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DropEvent.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 24, "SDL_DropEvent.y has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DropEvent.y has unexpected size % instead of 4", it.type.runtime_size); case "source"; assert(it.offset_in_bytes == 32, "SDL_DropEvent.source has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_DropEvent.source has unexpected size % instead of 8", it.type.runtime_size); case "data"; assert(it.offset_in_bytes == 40, "SDL_DropEvent.data has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_DropEvent.data has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_DropEvent) == 48, "SDL_DropEvent has size % instead of 48", size_of(SDL_DropEvent)); } { info := type_info(SDL_ClipboardEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_ClipboardEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_ClipboardEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_ClipboardEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_ClipboardEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_ClipboardEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_ClipboardEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "owner"; assert(it.offset_in_bytes == 16, "SDL_ClipboardEvent.owner has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_ClipboardEvent.owner has unexpected size % instead of 1", it.type.runtime_size); case "num_mime_types"; assert(it.offset_in_bytes == 20, "SDL_ClipboardEvent.num_mime_types has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_ClipboardEvent.num_mime_types has unexpected size % instead of 4", it.type.runtime_size); case "mime_types"; assert(it.offset_in_bytes == 24, "SDL_ClipboardEvent.mime_types has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_ClipboardEvent.mime_types has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_ClipboardEvent) == 32, "SDL_ClipboardEvent has size % instead of 32", size_of(SDL_ClipboardEvent)); } { info := type_info(SDL_SensorEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_SensorEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_SensorEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_SensorEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_SensorEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_SensorEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_SensorEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "which"; assert(it.offset_in_bytes == 16, "SDL_SensorEvent.which has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_SensorEvent.which has unexpected size % instead of 4", it.type.runtime_size); case "data"; assert(it.offset_in_bytes == 20, "SDL_SensorEvent.data has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_SensorEvent.data has unexpected size % instead of 24", it.type.runtime_size); case "sensor_timestamp"; assert(it.offset_in_bytes == 48, "SDL_SensorEvent.sensor_timestamp has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_SensorEvent.sensor_timestamp has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_SensorEvent) == 56, "SDL_SensorEvent has size % instead of 56", size_of(SDL_SensorEvent)); } { info := type_info(SDL_QuitEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_QuitEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_QuitEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_QuitEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_QuitEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_QuitEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_QuitEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_QuitEvent) == 16, "SDL_QuitEvent has size % instead of 16", size_of(SDL_QuitEvent)); } { info := type_info(SDL_UserEvent); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_UserEvent.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_UserEvent.type has unexpected size % instead of 4", it.type.runtime_size); case "reserved"; assert(it.offset_in_bytes == 4, "SDL_UserEvent.reserved has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_UserEvent.reserved has unexpected size % instead of 4", it.type.runtime_size); case "timestamp"; assert(it.offset_in_bytes == 8, "SDL_UserEvent.timestamp has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_UserEvent.timestamp has unexpected size % instead of 8", it.type.runtime_size); case "windowID"; assert(it.offset_in_bytes == 16, "SDL_UserEvent.windowID has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_UserEvent.windowID has unexpected size % instead of 4", it.type.runtime_size); case "code"; assert(it.offset_in_bytes == 20, "SDL_UserEvent.code has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_UserEvent.code has unexpected size % instead of 4", it.type.runtime_size); case "data1"; assert(it.offset_in_bytes == 24, "SDL_UserEvent.data1 has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_UserEvent.data1 has unexpected size % instead of 8", it.type.runtime_size); case "data2"; assert(it.offset_in_bytes == 32, "SDL_UserEvent.data2 has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_UserEvent.data2 has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_UserEvent) == 40, "SDL_UserEvent has size % instead of 40", size_of(SDL_UserEvent)); } { info := type_info(SDL_Event); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_Event.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Event.type has unexpected size % instead of 4", it.type.runtime_size); case "common"; assert(it.offset_in_bytes == 0, "SDL_Event.common has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_Event.common has unexpected size % instead of 16", it.type.runtime_size); case "display"; assert(it.offset_in_bytes == 0, "SDL_Event.display has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_Event.display has unexpected size % instead of 32", it.type.runtime_size); case "window"; assert(it.offset_in_bytes == 0, "SDL_Event.window has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_Event.window has unexpected size % instead of 32", it.type.runtime_size); case "kdevice"; assert(it.offset_in_bytes == 0, "SDL_Event.kdevice has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.kdevice has unexpected size % instead of 24", it.type.runtime_size); case "key"; assert(it.offset_in_bytes == 0, "SDL_Event.key has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_Event.key has unexpected size % instead of 40", it.type.runtime_size); case "edit"; assert(it.offset_in_bytes == 0, "SDL_Event.edit has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_Event.edit has unexpected size % instead of 40", it.type.runtime_size); case "edit_candidates"; assert(it.offset_in_bytes == 0, "SDL_Event.edit_candidates has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 48, "SDL_Event.edit_candidates has unexpected size % instead of 48", it.type.runtime_size); case "text"; assert(it.offset_in_bytes == 0, "SDL_Event.text has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_Event.text has unexpected size % instead of 32", it.type.runtime_size); case "mdevice"; assert(it.offset_in_bytes == 0, "SDL_Event.mdevice has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.mdevice has unexpected size % instead of 24", it.type.runtime_size); case "motion"; assert(it.offset_in_bytes == 0, "SDL_Event.motion has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 48, "SDL_Event.motion has unexpected size % instead of 48", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 0, "SDL_Event.button has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_Event.button has unexpected size % instead of 40", it.type.runtime_size); case "wheel"; assert(it.offset_in_bytes == 0, "SDL_Event.wheel has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 48, "SDL_Event.wheel has unexpected size % instead of 48", it.type.runtime_size); case "jdevice"; assert(it.offset_in_bytes == 0, "SDL_Event.jdevice has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.jdevice has unexpected size % instead of 24", it.type.runtime_size); case "jaxis"; assert(it.offset_in_bytes == 0, "SDL_Event.jaxis has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_Event.jaxis has unexpected size % instead of 32", it.type.runtime_size); case "jball"; assert(it.offset_in_bytes == 0, "SDL_Event.jball has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_Event.jball has unexpected size % instead of 32", it.type.runtime_size); case "jhat"; assert(it.offset_in_bytes == 0, "SDL_Event.jhat has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.jhat has unexpected size % instead of 24", it.type.runtime_size); case "jbutton"; assert(it.offset_in_bytes == 0, "SDL_Event.jbutton has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.jbutton has unexpected size % instead of 24", it.type.runtime_size); case "jbattery"; assert(it.offset_in_bytes == 0, "SDL_Event.jbattery has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_Event.jbattery has unexpected size % instead of 32", it.type.runtime_size); case "gdevice"; assert(it.offset_in_bytes == 0, "SDL_Event.gdevice has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.gdevice has unexpected size % instead of 24", it.type.runtime_size); case "gaxis"; assert(it.offset_in_bytes == 0, "SDL_Event.gaxis has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_Event.gaxis has unexpected size % instead of 32", it.type.runtime_size); case "gbutton"; assert(it.offset_in_bytes == 0, "SDL_Event.gbutton has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.gbutton has unexpected size % instead of 24", it.type.runtime_size); case "gtouchpad"; assert(it.offset_in_bytes == 0, "SDL_Event.gtouchpad has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_Event.gtouchpad has unexpected size % instead of 40", it.type.runtime_size); case "gsensor"; assert(it.offset_in_bytes == 0, "SDL_Event.gsensor has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 48, "SDL_Event.gsensor has unexpected size % instead of 48", it.type.runtime_size); case "adevice"; assert(it.offset_in_bytes == 0, "SDL_Event.adevice has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.adevice has unexpected size % instead of 24", it.type.runtime_size); case "cdevice"; assert(it.offset_in_bytes == 0, "SDL_Event.cdevice has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.cdevice has unexpected size % instead of 24", it.type.runtime_size); case "sensor"; assert(it.offset_in_bytes == 0, "SDL_Event.sensor has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 56, "SDL_Event.sensor has unexpected size % instead of 56", it.type.runtime_size); case "quit"; assert(it.offset_in_bytes == 0, "SDL_Event.quit has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_Event.quit has unexpected size % instead of 16", it.type.runtime_size); case "user"; assert(it.offset_in_bytes == 0, "SDL_Event.user has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_Event.user has unexpected size % instead of 40", it.type.runtime_size); case "tfinger"; assert(it.offset_in_bytes == 0, "SDL_Event.tfinger has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 56, "SDL_Event.tfinger has unexpected size % instead of 56", it.type.runtime_size); case "pproximity"; assert(it.offset_in_bytes == 0, "SDL_Event.pproximity has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.pproximity has unexpected size % instead of 24", it.type.runtime_size); case "ptouch"; assert(it.offset_in_bytes == 0, "SDL_Event.ptouch has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_Event.ptouch has unexpected size % instead of 40", it.type.runtime_size); case "pmotion"; assert(it.offset_in_bytes == 0, "SDL_Event.pmotion has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_Event.pmotion has unexpected size % instead of 40", it.type.runtime_size); case "pbutton"; assert(it.offset_in_bytes == 0, "SDL_Event.pbutton has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_Event.pbutton has unexpected size % instead of 40", it.type.runtime_size); case "paxis"; assert(it.offset_in_bytes == 0, "SDL_Event.paxis has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 48, "SDL_Event.paxis has unexpected size % instead of 48", it.type.runtime_size); case "render"; assert(it.offset_in_bytes == 0, "SDL_Event.render has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_Event.render has unexpected size % instead of 24", it.type.runtime_size); case "drop"; assert(it.offset_in_bytes == 0, "SDL_Event.drop has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 48, "SDL_Event.drop has unexpected size % instead of 48", it.type.runtime_size); case "clipboard"; assert(it.offset_in_bytes == 0, "SDL_Event.clipboard has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_Event.clipboard has unexpected size % instead of 32", it.type.runtime_size); case "padding"; assert(it.offset_in_bytes == 0, "SDL_Event.padding has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 128, "SDL_Event.padding has unexpected size % instead of 128", it.type.runtime_size); } } assert(size_of(SDL_Event) == 128, "SDL_Event has size % instead of 128", size_of(SDL_Event)); } { info := type_info(SDL_PathInfo); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_PathInfo.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_PathInfo.type has unexpected size % instead of 4", it.type.runtime_size); case "size"; assert(it.offset_in_bytes == 8, "SDL_PathInfo.size has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PathInfo.size has unexpected size % instead of 8", it.type.runtime_size); case "create_time"; assert(it.offset_in_bytes == 16, "SDL_PathInfo.create_time has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PathInfo.create_time has unexpected size % instead of 8", it.type.runtime_size); case "modify_time"; assert(it.offset_in_bytes == 24, "SDL_PathInfo.modify_time has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PathInfo.modify_time has unexpected size % instead of 8", it.type.runtime_size); case "access_time"; assert(it.offset_in_bytes == 32, "SDL_PathInfo.access_time has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_PathInfo.access_time has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_PathInfo) == 40, "SDL_PathInfo has size % instead of 40", size_of(SDL_PathInfo)); } { info := type_info(SDL_GPUViewport); for info.members { if it.name == { case "x"; assert(it.offset_in_bytes == 0, "SDL_GPUViewport.x has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUViewport.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 4, "SDL_GPUViewport.y has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUViewport.y has unexpected size % instead of 4", it.type.runtime_size); case "w"; assert(it.offset_in_bytes == 8, "SDL_GPUViewport.w has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUViewport.w has unexpected size % instead of 4", it.type.runtime_size); case "h"; assert(it.offset_in_bytes == 12, "SDL_GPUViewport.h has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUViewport.h has unexpected size % instead of 4", it.type.runtime_size); case "min_depth"; assert(it.offset_in_bytes == 16, "SDL_GPUViewport.min_depth has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUViewport.min_depth has unexpected size % instead of 4", it.type.runtime_size); case "max_depth"; assert(it.offset_in_bytes == 20, "SDL_GPUViewport.max_depth has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUViewport.max_depth has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUViewport) == 24, "SDL_GPUViewport has size % instead of 24", size_of(SDL_GPUViewport)); } { info := type_info(SDL_GPUTextureTransferInfo); for info.members { if it.name == { case "transfer_buffer"; assert(it.offset_in_bytes == 0, "SDL_GPUTextureTransferInfo.transfer_buffer has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUTextureTransferInfo.transfer_buffer has unexpected size % instead of 8", it.type.runtime_size); case "offset"; assert(it.offset_in_bytes == 8, "SDL_GPUTextureTransferInfo.offset has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureTransferInfo.offset has unexpected size % instead of 4", it.type.runtime_size); case "pixels_per_row"; assert(it.offset_in_bytes == 12, "SDL_GPUTextureTransferInfo.pixels_per_row has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureTransferInfo.pixels_per_row has unexpected size % instead of 4", it.type.runtime_size); case "rows_per_layer"; assert(it.offset_in_bytes == 16, "SDL_GPUTextureTransferInfo.rows_per_layer has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureTransferInfo.rows_per_layer has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUTextureTransferInfo) == 24, "SDL_GPUTextureTransferInfo has size % instead of 24", size_of(SDL_GPUTextureTransferInfo)); } { info := type_info(SDL_GPUTransferBufferLocation); for info.members { if it.name == { case "transfer_buffer"; assert(it.offset_in_bytes == 0, "SDL_GPUTransferBufferLocation.transfer_buffer has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUTransferBufferLocation.transfer_buffer has unexpected size % instead of 8", it.type.runtime_size); case "offset"; assert(it.offset_in_bytes == 8, "SDL_GPUTransferBufferLocation.offset has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTransferBufferLocation.offset has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUTransferBufferLocation) == 16, "SDL_GPUTransferBufferLocation has size % instead of 16", size_of(SDL_GPUTransferBufferLocation)); } { info := type_info(SDL_GPUTextureLocation); for info.members { if it.name == { case "texture"; assert(it.offset_in_bytes == 0, "SDL_GPUTextureLocation.texture has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUTextureLocation.texture has unexpected size % instead of 8", it.type.runtime_size); case "mip_level"; assert(it.offset_in_bytes == 8, "SDL_GPUTextureLocation.mip_level has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureLocation.mip_level has unexpected size % instead of 4", it.type.runtime_size); case "layer"; assert(it.offset_in_bytes == 12, "SDL_GPUTextureLocation.layer has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureLocation.layer has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 16, "SDL_GPUTextureLocation.x has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureLocation.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 20, "SDL_GPUTextureLocation.y has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureLocation.y has unexpected size % instead of 4", it.type.runtime_size); case "z"; assert(it.offset_in_bytes == 24, "SDL_GPUTextureLocation.z has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureLocation.z has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUTextureLocation) == 32, "SDL_GPUTextureLocation has size % instead of 32", size_of(SDL_GPUTextureLocation)); } { info := type_info(SDL_GPUTextureRegion); for info.members { if it.name == { case "texture"; assert(it.offset_in_bytes == 0, "SDL_GPUTextureRegion.texture has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUTextureRegion.texture has unexpected size % instead of 8", it.type.runtime_size); case "mip_level"; assert(it.offset_in_bytes == 8, "SDL_GPUTextureRegion.mip_level has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureRegion.mip_level has unexpected size % instead of 4", it.type.runtime_size); case "layer"; assert(it.offset_in_bytes == 12, "SDL_GPUTextureRegion.layer has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureRegion.layer has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 16, "SDL_GPUTextureRegion.x has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureRegion.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 20, "SDL_GPUTextureRegion.y has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureRegion.y has unexpected size % instead of 4", it.type.runtime_size); case "z"; assert(it.offset_in_bytes == 24, "SDL_GPUTextureRegion.z has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureRegion.z has unexpected size % instead of 4", it.type.runtime_size); case "w"; assert(it.offset_in_bytes == 28, "SDL_GPUTextureRegion.w has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureRegion.w has unexpected size % instead of 4", it.type.runtime_size); case "h"; assert(it.offset_in_bytes == 32, "SDL_GPUTextureRegion.h has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureRegion.h has unexpected size % instead of 4", it.type.runtime_size); case "d"; assert(it.offset_in_bytes == 36, "SDL_GPUTextureRegion.d has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureRegion.d has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUTextureRegion) == 40, "SDL_GPUTextureRegion has size % instead of 40", size_of(SDL_GPUTextureRegion)); } { info := type_info(SDL_GPUBlitRegion); for info.members { if it.name == { case "texture"; assert(it.offset_in_bytes == 0, "SDL_GPUBlitRegion.texture has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUBlitRegion.texture has unexpected size % instead of 8", it.type.runtime_size); case "mip_level"; assert(it.offset_in_bytes == 8, "SDL_GPUBlitRegion.mip_level has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitRegion.mip_level has unexpected size % instead of 4", it.type.runtime_size); case "layer_or_depth_plane"; assert(it.offset_in_bytes == 12, "SDL_GPUBlitRegion.layer_or_depth_plane has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitRegion.layer_or_depth_plane has unexpected size % instead of 4", it.type.runtime_size); case "x"; assert(it.offset_in_bytes == 16, "SDL_GPUBlitRegion.x has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitRegion.x has unexpected size % instead of 4", it.type.runtime_size); case "y"; assert(it.offset_in_bytes == 20, "SDL_GPUBlitRegion.y has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitRegion.y has unexpected size % instead of 4", it.type.runtime_size); case "w"; assert(it.offset_in_bytes == 24, "SDL_GPUBlitRegion.w has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitRegion.w has unexpected size % instead of 4", it.type.runtime_size); case "h"; assert(it.offset_in_bytes == 28, "SDL_GPUBlitRegion.h has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitRegion.h has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUBlitRegion) == 32, "SDL_GPUBlitRegion has size % instead of 32", size_of(SDL_GPUBlitRegion)); } { info := type_info(SDL_GPUBufferLocation); for info.members { if it.name == { case "buffer"; assert(it.offset_in_bytes == 0, "SDL_GPUBufferLocation.buffer has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUBufferLocation.buffer has unexpected size % instead of 8", it.type.runtime_size); case "offset"; assert(it.offset_in_bytes == 8, "SDL_GPUBufferLocation.offset has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBufferLocation.offset has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUBufferLocation) == 16, "SDL_GPUBufferLocation has size % instead of 16", size_of(SDL_GPUBufferLocation)); } { info := type_info(SDL_GPUBufferRegion); for info.members { if it.name == { case "buffer"; assert(it.offset_in_bytes == 0, "SDL_GPUBufferRegion.buffer has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUBufferRegion.buffer has unexpected size % instead of 8", it.type.runtime_size); case "offset"; assert(it.offset_in_bytes == 8, "SDL_GPUBufferRegion.offset has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBufferRegion.offset has unexpected size % instead of 4", it.type.runtime_size); case "size"; assert(it.offset_in_bytes == 12, "SDL_GPUBufferRegion.size has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBufferRegion.size has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUBufferRegion) == 16, "SDL_GPUBufferRegion has size % instead of 16", size_of(SDL_GPUBufferRegion)); } { info := type_info(SDL_GPUIndirectDrawCommand); for info.members { if it.name == { case "num_vertices"; assert(it.offset_in_bytes == 0, "SDL_GPUIndirectDrawCommand.num_vertices has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndirectDrawCommand.num_vertices has unexpected size % instead of 4", it.type.runtime_size); case "num_instances"; assert(it.offset_in_bytes == 4, "SDL_GPUIndirectDrawCommand.num_instances has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndirectDrawCommand.num_instances has unexpected size % instead of 4", it.type.runtime_size); case "first_vertex"; assert(it.offset_in_bytes == 8, "SDL_GPUIndirectDrawCommand.first_vertex has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndirectDrawCommand.first_vertex has unexpected size % instead of 4", it.type.runtime_size); case "first_instance"; assert(it.offset_in_bytes == 12, "SDL_GPUIndirectDrawCommand.first_instance has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndirectDrawCommand.first_instance has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUIndirectDrawCommand) == 16, "SDL_GPUIndirectDrawCommand has size % instead of 16", size_of(SDL_GPUIndirectDrawCommand)); } { info := type_info(SDL_GPUIndexedIndirectDrawCommand); for info.members { if it.name == { case "num_indices"; assert(it.offset_in_bytes == 0, "SDL_GPUIndexedIndirectDrawCommand.num_indices has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndexedIndirectDrawCommand.num_indices has unexpected size % instead of 4", it.type.runtime_size); case "num_instances"; assert(it.offset_in_bytes == 4, "SDL_GPUIndexedIndirectDrawCommand.num_instances has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndexedIndirectDrawCommand.num_instances has unexpected size % instead of 4", it.type.runtime_size); case "first_index"; assert(it.offset_in_bytes == 8, "SDL_GPUIndexedIndirectDrawCommand.first_index has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndexedIndirectDrawCommand.first_index has unexpected size % instead of 4", it.type.runtime_size); case "vertex_offset"; assert(it.offset_in_bytes == 12, "SDL_GPUIndexedIndirectDrawCommand.vertex_offset has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndexedIndirectDrawCommand.vertex_offset has unexpected size % instead of 4", it.type.runtime_size); case "first_instance"; assert(it.offset_in_bytes == 16, "SDL_GPUIndexedIndirectDrawCommand.first_instance has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndexedIndirectDrawCommand.first_instance has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUIndexedIndirectDrawCommand) == 20, "SDL_GPUIndexedIndirectDrawCommand has size % instead of 20", size_of(SDL_GPUIndexedIndirectDrawCommand)); } { info := type_info(SDL_GPUIndirectDispatchCommand); for info.members { if it.name == { case "groupcount_x"; assert(it.offset_in_bytes == 0, "SDL_GPUIndirectDispatchCommand.groupcount_x has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndirectDispatchCommand.groupcount_x has unexpected size % instead of 4", it.type.runtime_size); case "groupcount_y"; assert(it.offset_in_bytes == 4, "SDL_GPUIndirectDispatchCommand.groupcount_y has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndirectDispatchCommand.groupcount_y has unexpected size % instead of 4", it.type.runtime_size); case "groupcount_z"; assert(it.offset_in_bytes == 8, "SDL_GPUIndirectDispatchCommand.groupcount_z has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUIndirectDispatchCommand.groupcount_z has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUIndirectDispatchCommand) == 12, "SDL_GPUIndirectDispatchCommand has size % instead of 12", size_of(SDL_GPUIndirectDispatchCommand)); } { info := type_info(SDL_GPUSamplerCreateInfo); for info.members { if it.name == { case "min_filter"; assert(it.offset_in_bytes == 0, "SDL_GPUSamplerCreateInfo.min_filter has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.min_filter has unexpected size % instead of 4", it.type.runtime_size); case "mag_filter"; assert(it.offset_in_bytes == 4, "SDL_GPUSamplerCreateInfo.mag_filter has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.mag_filter has unexpected size % instead of 4", it.type.runtime_size); case "mipmap_mode"; assert(it.offset_in_bytes == 8, "SDL_GPUSamplerCreateInfo.mipmap_mode has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.mipmap_mode has unexpected size % instead of 4", it.type.runtime_size); case "address_mode_u"; assert(it.offset_in_bytes == 12, "SDL_GPUSamplerCreateInfo.address_mode_u has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.address_mode_u has unexpected size % instead of 4", it.type.runtime_size); case "address_mode_v"; assert(it.offset_in_bytes == 16, "SDL_GPUSamplerCreateInfo.address_mode_v has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.address_mode_v has unexpected size % instead of 4", it.type.runtime_size); case "address_mode_w"; assert(it.offset_in_bytes == 20, "SDL_GPUSamplerCreateInfo.address_mode_w has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.address_mode_w has unexpected size % instead of 4", it.type.runtime_size); case "mip_lod_bias"; assert(it.offset_in_bytes == 24, "SDL_GPUSamplerCreateInfo.mip_lod_bias has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.mip_lod_bias has unexpected size % instead of 4", it.type.runtime_size); case "max_anisotropy"; assert(it.offset_in_bytes == 28, "SDL_GPUSamplerCreateInfo.max_anisotropy has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.max_anisotropy has unexpected size % instead of 4", it.type.runtime_size); case "compare_op"; assert(it.offset_in_bytes == 32, "SDL_GPUSamplerCreateInfo.compare_op has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.compare_op has unexpected size % instead of 4", it.type.runtime_size); case "min_lod"; assert(it.offset_in_bytes == 36, "SDL_GPUSamplerCreateInfo.min_lod has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.min_lod has unexpected size % instead of 4", it.type.runtime_size); case "max_lod"; assert(it.offset_in_bytes == 40, "SDL_GPUSamplerCreateInfo.max_lod has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.max_lod has unexpected size % instead of 4", it.type.runtime_size); case "enable_anisotropy"; assert(it.offset_in_bytes == 44, "SDL_GPUSamplerCreateInfo.enable_anisotropy has unexpected offset % instead of 44", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUSamplerCreateInfo.enable_anisotropy has unexpected size % instead of 1", it.type.runtime_size); case "enable_compare"; assert(it.offset_in_bytes == 45, "SDL_GPUSamplerCreateInfo.enable_compare has unexpected offset % instead of 45", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUSamplerCreateInfo.enable_compare has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 46, "SDL_GPUSamplerCreateInfo.padding1 has unexpected offset % instead of 46", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUSamplerCreateInfo.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 47, "SDL_GPUSamplerCreateInfo.padding2 has unexpected offset % instead of 47", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUSamplerCreateInfo.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "props"; assert(it.offset_in_bytes == 48, "SDL_GPUSamplerCreateInfo.props has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUSamplerCreateInfo.props has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUSamplerCreateInfo) == 52, "SDL_GPUSamplerCreateInfo has size % instead of 52", size_of(SDL_GPUSamplerCreateInfo)); } { info := type_info(SDL_GPUVertexBufferDescription); for info.members { if it.name == { case "slot"; assert(it.offset_in_bytes == 0, "SDL_GPUVertexBufferDescription.slot has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexBufferDescription.slot has unexpected size % instead of 4", it.type.runtime_size); case "pitch"; assert(it.offset_in_bytes == 4, "SDL_GPUVertexBufferDescription.pitch has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexBufferDescription.pitch has unexpected size % instead of 4", it.type.runtime_size); case "input_rate"; assert(it.offset_in_bytes == 8, "SDL_GPUVertexBufferDescription.input_rate has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexBufferDescription.input_rate has unexpected size % instead of 4", it.type.runtime_size); case "instance_step_rate"; assert(it.offset_in_bytes == 12, "SDL_GPUVertexBufferDescription.instance_step_rate has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexBufferDescription.instance_step_rate has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUVertexBufferDescription) == 16, "SDL_GPUVertexBufferDescription has size % instead of 16", size_of(SDL_GPUVertexBufferDescription)); } { info := type_info(SDL_GPUVertexAttribute); for info.members { if it.name == { case "location"; assert(it.offset_in_bytes == 0, "SDL_GPUVertexAttribute.location has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexAttribute.location has unexpected size % instead of 4", it.type.runtime_size); case "buffer_slot"; assert(it.offset_in_bytes == 4, "SDL_GPUVertexAttribute.buffer_slot has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexAttribute.buffer_slot has unexpected size % instead of 4", it.type.runtime_size); case "format"; assert(it.offset_in_bytes == 8, "SDL_GPUVertexAttribute.format has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexAttribute.format has unexpected size % instead of 4", it.type.runtime_size); case "offset"; assert(it.offset_in_bytes == 12, "SDL_GPUVertexAttribute.offset has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexAttribute.offset has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUVertexAttribute) == 16, "SDL_GPUVertexAttribute has size % instead of 16", size_of(SDL_GPUVertexAttribute)); } { info := type_info(SDL_GPUVertexInputState); for info.members { if it.name == { case "vertex_buffer_descriptions"; assert(it.offset_in_bytes == 0, "SDL_GPUVertexInputState.vertex_buffer_descriptions has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUVertexInputState.vertex_buffer_descriptions has unexpected size % instead of 8", it.type.runtime_size); case "num_vertex_buffers"; assert(it.offset_in_bytes == 8, "SDL_GPUVertexInputState.num_vertex_buffers has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexInputState.num_vertex_buffers has unexpected size % instead of 4", it.type.runtime_size); case "vertex_attributes"; assert(it.offset_in_bytes == 16, "SDL_GPUVertexInputState.vertex_attributes has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUVertexInputState.vertex_attributes has unexpected size % instead of 8", it.type.runtime_size); case "num_vertex_attributes"; assert(it.offset_in_bytes == 24, "SDL_GPUVertexInputState.num_vertex_attributes has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUVertexInputState.num_vertex_attributes has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUVertexInputState) == 32, "SDL_GPUVertexInputState has size % instead of 32", size_of(SDL_GPUVertexInputState)); } { info := type_info(SDL_GPUStencilOpState); for info.members { if it.name == { case "fail_op"; assert(it.offset_in_bytes == 0, "SDL_GPUStencilOpState.fail_op has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUStencilOpState.fail_op has unexpected size % instead of 4", it.type.runtime_size); case "pass_op"; assert(it.offset_in_bytes == 4, "SDL_GPUStencilOpState.pass_op has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUStencilOpState.pass_op has unexpected size % instead of 4", it.type.runtime_size); case "depth_fail_op"; assert(it.offset_in_bytes == 8, "SDL_GPUStencilOpState.depth_fail_op has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUStencilOpState.depth_fail_op has unexpected size % instead of 4", it.type.runtime_size); case "compare_op"; assert(it.offset_in_bytes == 12, "SDL_GPUStencilOpState.compare_op has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUStencilOpState.compare_op has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUStencilOpState) == 16, "SDL_GPUStencilOpState has size % instead of 16", size_of(SDL_GPUStencilOpState)); } { info := type_info(SDL_GPUColorTargetBlendState); for info.members { if it.name == { case "src_color_blendfactor"; assert(it.offset_in_bytes == 0, "SDL_GPUColorTargetBlendState.src_color_blendfactor has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetBlendState.src_color_blendfactor has unexpected size % instead of 4", it.type.runtime_size); case "dst_color_blendfactor"; assert(it.offset_in_bytes == 4, "SDL_GPUColorTargetBlendState.dst_color_blendfactor has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetBlendState.dst_color_blendfactor has unexpected size % instead of 4", it.type.runtime_size); case "color_blend_op"; assert(it.offset_in_bytes == 8, "SDL_GPUColorTargetBlendState.color_blend_op has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetBlendState.color_blend_op has unexpected size % instead of 4", it.type.runtime_size); case "src_alpha_blendfactor"; assert(it.offset_in_bytes == 12, "SDL_GPUColorTargetBlendState.src_alpha_blendfactor has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetBlendState.src_alpha_blendfactor has unexpected size % instead of 4", it.type.runtime_size); case "dst_alpha_blendfactor"; assert(it.offset_in_bytes == 16, "SDL_GPUColorTargetBlendState.dst_alpha_blendfactor has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetBlendState.dst_alpha_blendfactor has unexpected size % instead of 4", it.type.runtime_size); case "alpha_blend_op"; assert(it.offset_in_bytes == 20, "SDL_GPUColorTargetBlendState.alpha_blend_op has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetBlendState.alpha_blend_op has unexpected size % instead of 4", it.type.runtime_size); case "color_write_mask"; assert(it.offset_in_bytes == 24, "SDL_GPUColorTargetBlendState.color_write_mask has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetBlendState.color_write_mask has unexpected size % instead of 1", it.type.runtime_size); case "enable_blend"; assert(it.offset_in_bytes == 25, "SDL_GPUColorTargetBlendState.enable_blend has unexpected offset % instead of 25", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetBlendState.enable_blend has unexpected size % instead of 1", it.type.runtime_size); case "enable_color_write_mask"; assert(it.offset_in_bytes == 26, "SDL_GPUColorTargetBlendState.enable_color_write_mask has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetBlendState.enable_color_write_mask has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 27, "SDL_GPUColorTargetBlendState.padding1 has unexpected offset % instead of 27", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetBlendState.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 28, "SDL_GPUColorTargetBlendState.padding2 has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetBlendState.padding2 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUColorTargetBlendState) == 32, "SDL_GPUColorTargetBlendState has size % instead of 32", size_of(SDL_GPUColorTargetBlendState)); } { info := type_info(SDL_GPUShaderCreateInfo); for info.members { if it.name == { case "code_size"; assert(it.offset_in_bytes == 0, "SDL_GPUShaderCreateInfo.code_size has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUShaderCreateInfo.code_size has unexpected size % instead of 8", it.type.runtime_size); case "code"; assert(it.offset_in_bytes == 8, "SDL_GPUShaderCreateInfo.code has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUShaderCreateInfo.code has unexpected size % instead of 8", it.type.runtime_size); case "entrypoint"; assert(it.offset_in_bytes == 16, "SDL_GPUShaderCreateInfo.entrypoint has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUShaderCreateInfo.entrypoint has unexpected size % instead of 8", it.type.runtime_size); case "format"; assert(it.offset_in_bytes == 24, "SDL_GPUShaderCreateInfo.format has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUShaderCreateInfo.format has unexpected size % instead of 4", it.type.runtime_size); case "stage"; assert(it.offset_in_bytes == 28, "SDL_GPUShaderCreateInfo.stage has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUShaderCreateInfo.stage has unexpected size % instead of 4", it.type.runtime_size); case "num_samplers"; assert(it.offset_in_bytes == 32, "SDL_GPUShaderCreateInfo.num_samplers has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUShaderCreateInfo.num_samplers has unexpected size % instead of 4", it.type.runtime_size); case "num_storage_textures"; assert(it.offset_in_bytes == 36, "SDL_GPUShaderCreateInfo.num_storage_textures has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUShaderCreateInfo.num_storage_textures has unexpected size % instead of 4", it.type.runtime_size); case "num_storage_buffers"; assert(it.offset_in_bytes == 40, "SDL_GPUShaderCreateInfo.num_storage_buffers has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUShaderCreateInfo.num_storage_buffers has unexpected size % instead of 4", it.type.runtime_size); case "num_uniform_buffers"; assert(it.offset_in_bytes == 44, "SDL_GPUShaderCreateInfo.num_uniform_buffers has unexpected offset % instead of 44", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUShaderCreateInfo.num_uniform_buffers has unexpected size % instead of 4", it.type.runtime_size); case "props"; assert(it.offset_in_bytes == 48, "SDL_GPUShaderCreateInfo.props has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUShaderCreateInfo.props has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUShaderCreateInfo) == 56, "SDL_GPUShaderCreateInfo has size % instead of 56", size_of(SDL_GPUShaderCreateInfo)); } { info := type_info(SDL_GPUTextureCreateInfo); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_GPUTextureCreateInfo.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.type has unexpected size % instead of 4", it.type.runtime_size); case "format"; assert(it.offset_in_bytes == 4, "SDL_GPUTextureCreateInfo.format has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.format has unexpected size % instead of 4", it.type.runtime_size); case "usage"; assert(it.offset_in_bytes == 8, "SDL_GPUTextureCreateInfo.usage has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.usage has unexpected size % instead of 4", it.type.runtime_size); case "width"; assert(it.offset_in_bytes == 12, "SDL_GPUTextureCreateInfo.width has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.width has unexpected size % instead of 4", it.type.runtime_size); case "height"; assert(it.offset_in_bytes == 16, "SDL_GPUTextureCreateInfo.height has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.height has unexpected size % instead of 4", it.type.runtime_size); case "layer_count_or_depth"; assert(it.offset_in_bytes == 20, "SDL_GPUTextureCreateInfo.layer_count_or_depth has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.layer_count_or_depth has unexpected size % instead of 4", it.type.runtime_size); case "num_levels"; assert(it.offset_in_bytes == 24, "SDL_GPUTextureCreateInfo.num_levels has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.num_levels has unexpected size % instead of 4", it.type.runtime_size); case "sample_count"; assert(it.offset_in_bytes == 28, "SDL_GPUTextureCreateInfo.sample_count has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.sample_count has unexpected size % instead of 4", it.type.runtime_size); case "props"; assert(it.offset_in_bytes == 32, "SDL_GPUTextureCreateInfo.props has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTextureCreateInfo.props has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUTextureCreateInfo) == 36, "SDL_GPUTextureCreateInfo has size % instead of 36", size_of(SDL_GPUTextureCreateInfo)); } { info := type_info(SDL_GPUBufferCreateInfo); for info.members { if it.name == { case "usage"; assert(it.offset_in_bytes == 0, "SDL_GPUBufferCreateInfo.usage has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBufferCreateInfo.usage has unexpected size % instead of 4", it.type.runtime_size); case "size"; assert(it.offset_in_bytes == 4, "SDL_GPUBufferCreateInfo.size has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBufferCreateInfo.size has unexpected size % instead of 4", it.type.runtime_size); case "props"; assert(it.offset_in_bytes == 8, "SDL_GPUBufferCreateInfo.props has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBufferCreateInfo.props has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUBufferCreateInfo) == 12, "SDL_GPUBufferCreateInfo has size % instead of 12", size_of(SDL_GPUBufferCreateInfo)); } { info := type_info(SDL_GPUTransferBufferCreateInfo); for info.members { if it.name == { case "usage"; assert(it.offset_in_bytes == 0, "SDL_GPUTransferBufferCreateInfo.usage has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTransferBufferCreateInfo.usage has unexpected size % instead of 4", it.type.runtime_size); case "size"; assert(it.offset_in_bytes == 4, "SDL_GPUTransferBufferCreateInfo.size has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTransferBufferCreateInfo.size has unexpected size % instead of 4", it.type.runtime_size); case "props"; assert(it.offset_in_bytes == 8, "SDL_GPUTransferBufferCreateInfo.props has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUTransferBufferCreateInfo.props has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUTransferBufferCreateInfo) == 12, "SDL_GPUTransferBufferCreateInfo has size % instead of 12", size_of(SDL_GPUTransferBufferCreateInfo)); } { info := type_info(SDL_GPURasterizerState); for info.members { if it.name == { case "fill_mode"; assert(it.offset_in_bytes == 0, "SDL_GPURasterizerState.fill_mode has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPURasterizerState.fill_mode has unexpected size % instead of 4", it.type.runtime_size); case "cull_mode"; assert(it.offset_in_bytes == 4, "SDL_GPURasterizerState.cull_mode has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPURasterizerState.cull_mode has unexpected size % instead of 4", it.type.runtime_size); case "front_face"; assert(it.offset_in_bytes == 8, "SDL_GPURasterizerState.front_face has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPURasterizerState.front_face has unexpected size % instead of 4", it.type.runtime_size); case "depth_bias_constant_factor"; assert(it.offset_in_bytes == 12, "SDL_GPURasterizerState.depth_bias_constant_factor has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPURasterizerState.depth_bias_constant_factor has unexpected size % instead of 4", it.type.runtime_size); case "depth_bias_clamp"; assert(it.offset_in_bytes == 16, "SDL_GPURasterizerState.depth_bias_clamp has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPURasterizerState.depth_bias_clamp has unexpected size % instead of 4", it.type.runtime_size); case "depth_bias_slope_factor"; assert(it.offset_in_bytes == 20, "SDL_GPURasterizerState.depth_bias_slope_factor has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPURasterizerState.depth_bias_slope_factor has unexpected size % instead of 4", it.type.runtime_size); case "enable_depth_bias"; assert(it.offset_in_bytes == 24, "SDL_GPURasterizerState.enable_depth_bias has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPURasterizerState.enable_depth_bias has unexpected size % instead of 1", it.type.runtime_size); case "enable_depth_clip"; assert(it.offset_in_bytes == 25, "SDL_GPURasterizerState.enable_depth_clip has unexpected offset % instead of 25", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPURasterizerState.enable_depth_clip has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 26, "SDL_GPURasterizerState.padding1 has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPURasterizerState.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 27, "SDL_GPURasterizerState.padding2 has unexpected offset % instead of 27", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPURasterizerState.padding2 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPURasterizerState) == 28, "SDL_GPURasterizerState has size % instead of 28", size_of(SDL_GPURasterizerState)); } { info := type_info(SDL_GPUMultisampleState); for info.members { if it.name == { case "sample_count"; assert(it.offset_in_bytes == 0, "SDL_GPUMultisampleState.sample_count has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUMultisampleState.sample_count has unexpected size % instead of 4", it.type.runtime_size); case "sample_mask"; assert(it.offset_in_bytes == 4, "SDL_GPUMultisampleState.sample_mask has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUMultisampleState.sample_mask has unexpected size % instead of 4", it.type.runtime_size); case "enable_mask"; assert(it.offset_in_bytes == 8, "SDL_GPUMultisampleState.enable_mask has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUMultisampleState.enable_mask has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 9, "SDL_GPUMultisampleState.padding1 has unexpected offset % instead of 9", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUMultisampleState.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 10, "SDL_GPUMultisampleState.padding2 has unexpected offset % instead of 10", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUMultisampleState.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 11, "SDL_GPUMultisampleState.padding3 has unexpected offset % instead of 11", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUMultisampleState.padding3 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUMultisampleState) == 12, "SDL_GPUMultisampleState has size % instead of 12", size_of(SDL_GPUMultisampleState)); } { info := type_info(SDL_GPUDepthStencilState); for info.members { if it.name == { case "compare_op"; assert(it.offset_in_bytes == 0, "SDL_GPUDepthStencilState.compare_op has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUDepthStencilState.compare_op has unexpected size % instead of 4", it.type.runtime_size); case "back_stencil_state"; assert(it.offset_in_bytes == 4, "SDL_GPUDepthStencilState.back_stencil_state has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_GPUDepthStencilState.back_stencil_state has unexpected size % instead of 16", it.type.runtime_size); case "front_stencil_state"; assert(it.offset_in_bytes == 20, "SDL_GPUDepthStencilState.front_stencil_state has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_GPUDepthStencilState.front_stencil_state has unexpected size % instead of 16", it.type.runtime_size); case "compare_mask"; assert(it.offset_in_bytes == 36, "SDL_GPUDepthStencilState.compare_mask has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilState.compare_mask has unexpected size % instead of 1", it.type.runtime_size); case "write_mask"; assert(it.offset_in_bytes == 37, "SDL_GPUDepthStencilState.write_mask has unexpected offset % instead of 37", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilState.write_mask has unexpected size % instead of 1", it.type.runtime_size); case "enable_depth_test"; assert(it.offset_in_bytes == 38, "SDL_GPUDepthStencilState.enable_depth_test has unexpected offset % instead of 38", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilState.enable_depth_test has unexpected size % instead of 1", it.type.runtime_size); case "enable_depth_write"; assert(it.offset_in_bytes == 39, "SDL_GPUDepthStencilState.enable_depth_write has unexpected offset % instead of 39", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilState.enable_depth_write has unexpected size % instead of 1", it.type.runtime_size); case "enable_stencil_test"; assert(it.offset_in_bytes == 40, "SDL_GPUDepthStencilState.enable_stencil_test has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilState.enable_stencil_test has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 41, "SDL_GPUDepthStencilState.padding1 has unexpected offset % instead of 41", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilState.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 42, "SDL_GPUDepthStencilState.padding2 has unexpected offset % instead of 42", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilState.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 43, "SDL_GPUDepthStencilState.padding3 has unexpected offset % instead of 43", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilState.padding3 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUDepthStencilState) == 44, "SDL_GPUDepthStencilState has size % instead of 44", size_of(SDL_GPUDepthStencilState)); } { info := type_info(SDL_GPUColorTargetDescription); for info.members { if it.name == { case "format"; assert(it.offset_in_bytes == 0, "SDL_GPUColorTargetDescription.format has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetDescription.format has unexpected size % instead of 4", it.type.runtime_size); case "blend_state"; assert(it.offset_in_bytes == 4, "SDL_GPUColorTargetDescription.blend_state has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_GPUColorTargetDescription.blend_state has unexpected size % instead of 32", it.type.runtime_size); } } assert(size_of(SDL_GPUColorTargetDescription) == 36, "SDL_GPUColorTargetDescription has size % instead of 36", size_of(SDL_GPUColorTargetDescription)); } { info := type_info(SDL_GPUGraphicsPipelineTargetInfo); for info.members { if it.name == { case "color_target_descriptions"; assert(it.offset_in_bytes == 0, "SDL_GPUGraphicsPipelineTargetInfo.color_target_descriptions has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUGraphicsPipelineTargetInfo.color_target_descriptions has unexpected size % instead of 8", it.type.runtime_size); case "num_color_targets"; assert(it.offset_in_bytes == 8, "SDL_GPUGraphicsPipelineTargetInfo.num_color_targets has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUGraphicsPipelineTargetInfo.num_color_targets has unexpected size % instead of 4", it.type.runtime_size); case "depth_stencil_format"; assert(it.offset_in_bytes == 12, "SDL_GPUGraphicsPipelineTargetInfo.depth_stencil_format has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUGraphicsPipelineTargetInfo.depth_stencil_format has unexpected size % instead of 4", it.type.runtime_size); case "has_depth_stencil_target"; assert(it.offset_in_bytes == 16, "SDL_GPUGraphicsPipelineTargetInfo.has_depth_stencil_target has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUGraphicsPipelineTargetInfo.has_depth_stencil_target has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 17, "SDL_GPUGraphicsPipelineTargetInfo.padding1 has unexpected offset % instead of 17", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUGraphicsPipelineTargetInfo.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 18, "SDL_GPUGraphicsPipelineTargetInfo.padding2 has unexpected offset % instead of 18", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUGraphicsPipelineTargetInfo.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 19, "SDL_GPUGraphicsPipelineTargetInfo.padding3 has unexpected offset % instead of 19", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUGraphicsPipelineTargetInfo.padding3 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUGraphicsPipelineTargetInfo) == 24, "SDL_GPUGraphicsPipelineTargetInfo has size % instead of 24", size_of(SDL_GPUGraphicsPipelineTargetInfo)); } { info := type_info(SDL_GPUGraphicsPipelineCreateInfo); for info.members { if it.name == { case "vertex_shader"; assert(it.offset_in_bytes == 0, "SDL_GPUGraphicsPipelineCreateInfo.vertex_shader has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUGraphicsPipelineCreateInfo.vertex_shader has unexpected size % instead of 8", it.type.runtime_size); case "fragment_shader"; assert(it.offset_in_bytes == 8, "SDL_GPUGraphicsPipelineCreateInfo.fragment_shader has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUGraphicsPipelineCreateInfo.fragment_shader has unexpected size % instead of 8", it.type.runtime_size); case "vertex_input_state"; assert(it.offset_in_bytes == 16, "SDL_GPUGraphicsPipelineCreateInfo.vertex_input_state has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_GPUGraphicsPipelineCreateInfo.vertex_input_state has unexpected size % instead of 32", it.type.runtime_size); case "primitive_type"; assert(it.offset_in_bytes == 48, "SDL_GPUGraphicsPipelineCreateInfo.primitive_type has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUGraphicsPipelineCreateInfo.primitive_type has unexpected size % instead of 4", it.type.runtime_size); case "rasterizer_state"; assert(it.offset_in_bytes == 52, "SDL_GPUGraphicsPipelineCreateInfo.rasterizer_state has unexpected offset % instead of 52", it.offset_in_bytes); assert(it.type.runtime_size == 28, "SDL_GPUGraphicsPipelineCreateInfo.rasterizer_state has unexpected size % instead of 28", it.type.runtime_size); case "multisample_state"; assert(it.offset_in_bytes == 80, "SDL_GPUGraphicsPipelineCreateInfo.multisample_state has unexpected offset % instead of 80", it.offset_in_bytes); assert(it.type.runtime_size == 12, "SDL_GPUGraphicsPipelineCreateInfo.multisample_state has unexpected size % instead of 12", it.type.runtime_size); case "depth_stencil_state"; assert(it.offset_in_bytes == 92, "SDL_GPUGraphicsPipelineCreateInfo.depth_stencil_state has unexpected offset % instead of 92", it.offset_in_bytes); assert(it.type.runtime_size == 44, "SDL_GPUGraphicsPipelineCreateInfo.depth_stencil_state has unexpected size % instead of 44", it.type.runtime_size); case "target_info"; assert(it.offset_in_bytes == 136, "SDL_GPUGraphicsPipelineCreateInfo.target_info has unexpected offset % instead of 136", it.offset_in_bytes); assert(it.type.runtime_size == 24, "SDL_GPUGraphicsPipelineCreateInfo.target_info has unexpected size % instead of 24", it.type.runtime_size); case "props"; assert(it.offset_in_bytes == 160, "SDL_GPUGraphicsPipelineCreateInfo.props has unexpected offset % instead of 160", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUGraphicsPipelineCreateInfo.props has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUGraphicsPipelineCreateInfo) == 168, "SDL_GPUGraphicsPipelineCreateInfo has size % instead of 168", size_of(SDL_GPUGraphicsPipelineCreateInfo)); } { info := type_info(SDL_GPUComputePipelineCreateInfo); for info.members { if it.name == { case "code_size"; assert(it.offset_in_bytes == 0, "SDL_GPUComputePipelineCreateInfo.code_size has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUComputePipelineCreateInfo.code_size has unexpected size % instead of 8", it.type.runtime_size); case "code"; assert(it.offset_in_bytes == 8, "SDL_GPUComputePipelineCreateInfo.code has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUComputePipelineCreateInfo.code has unexpected size % instead of 8", it.type.runtime_size); case "entrypoint"; assert(it.offset_in_bytes == 16, "SDL_GPUComputePipelineCreateInfo.entrypoint has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUComputePipelineCreateInfo.entrypoint has unexpected size % instead of 8", it.type.runtime_size); case "format"; assert(it.offset_in_bytes == 24, "SDL_GPUComputePipelineCreateInfo.format has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.format has unexpected size % instead of 4", it.type.runtime_size); case "num_samplers"; assert(it.offset_in_bytes == 28, "SDL_GPUComputePipelineCreateInfo.num_samplers has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.num_samplers has unexpected size % instead of 4", it.type.runtime_size); case "num_readonly_storage_textures"; assert(it.offset_in_bytes == 32, "SDL_GPUComputePipelineCreateInfo.num_readonly_storage_textures has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.num_readonly_storage_textures has unexpected size % instead of 4", it.type.runtime_size); case "num_readonly_storage_buffers"; assert(it.offset_in_bytes == 36, "SDL_GPUComputePipelineCreateInfo.num_readonly_storage_buffers has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.num_readonly_storage_buffers has unexpected size % instead of 4", it.type.runtime_size); case "num_readwrite_storage_textures"; assert(it.offset_in_bytes == 40, "SDL_GPUComputePipelineCreateInfo.num_readwrite_storage_textures has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.num_readwrite_storage_textures has unexpected size % instead of 4", it.type.runtime_size); case "num_readwrite_storage_buffers"; assert(it.offset_in_bytes == 44, "SDL_GPUComputePipelineCreateInfo.num_readwrite_storage_buffers has unexpected offset % instead of 44", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.num_readwrite_storage_buffers has unexpected size % instead of 4", it.type.runtime_size); case "num_uniform_buffers"; assert(it.offset_in_bytes == 48, "SDL_GPUComputePipelineCreateInfo.num_uniform_buffers has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.num_uniform_buffers has unexpected size % instead of 4", it.type.runtime_size); case "threadcount_x"; assert(it.offset_in_bytes == 52, "SDL_GPUComputePipelineCreateInfo.threadcount_x has unexpected offset % instead of 52", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.threadcount_x has unexpected size % instead of 4", it.type.runtime_size); case "threadcount_y"; assert(it.offset_in_bytes == 56, "SDL_GPUComputePipelineCreateInfo.threadcount_y has unexpected offset % instead of 56", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.threadcount_y has unexpected size % instead of 4", it.type.runtime_size); case "threadcount_z"; assert(it.offset_in_bytes == 60, "SDL_GPUComputePipelineCreateInfo.threadcount_z has unexpected offset % instead of 60", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.threadcount_z has unexpected size % instead of 4", it.type.runtime_size); case "props"; assert(it.offset_in_bytes == 64, "SDL_GPUComputePipelineCreateInfo.props has unexpected offset % instead of 64", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUComputePipelineCreateInfo.props has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUComputePipelineCreateInfo) == 72, "SDL_GPUComputePipelineCreateInfo has size % instead of 72", size_of(SDL_GPUComputePipelineCreateInfo)); } { info := type_info(SDL_GPUColorTargetInfo); for info.members { if it.name == { case "texture"; assert(it.offset_in_bytes == 0, "SDL_GPUColorTargetInfo.texture has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUColorTargetInfo.texture has unexpected size % instead of 8", it.type.runtime_size); case "mip_level"; assert(it.offset_in_bytes == 8, "SDL_GPUColorTargetInfo.mip_level has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetInfo.mip_level has unexpected size % instead of 4", it.type.runtime_size); case "layer_or_depth_plane"; assert(it.offset_in_bytes == 12, "SDL_GPUColorTargetInfo.layer_or_depth_plane has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetInfo.layer_or_depth_plane has unexpected size % instead of 4", it.type.runtime_size); case "clear_color"; assert(it.offset_in_bytes == 16, "SDL_GPUColorTargetInfo.clear_color has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_GPUColorTargetInfo.clear_color has unexpected size % instead of 16", it.type.runtime_size); case "load_op"; assert(it.offset_in_bytes == 32, "SDL_GPUColorTargetInfo.load_op has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetInfo.load_op has unexpected size % instead of 4", it.type.runtime_size); case "store_op"; assert(it.offset_in_bytes == 36, "SDL_GPUColorTargetInfo.store_op has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetInfo.store_op has unexpected size % instead of 4", it.type.runtime_size); case "resolve_texture"; assert(it.offset_in_bytes == 40, "SDL_GPUColorTargetInfo.resolve_texture has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUColorTargetInfo.resolve_texture has unexpected size % instead of 8", it.type.runtime_size); case "resolve_mip_level"; assert(it.offset_in_bytes == 48, "SDL_GPUColorTargetInfo.resolve_mip_level has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetInfo.resolve_mip_level has unexpected size % instead of 4", it.type.runtime_size); case "resolve_layer"; assert(it.offset_in_bytes == 52, "SDL_GPUColorTargetInfo.resolve_layer has unexpected offset % instead of 52", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUColorTargetInfo.resolve_layer has unexpected size % instead of 4", it.type.runtime_size); case "cycle"; assert(it.offset_in_bytes == 56, "SDL_GPUColorTargetInfo.cycle has unexpected offset % instead of 56", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetInfo.cycle has unexpected size % instead of 1", it.type.runtime_size); case "cycle_resolve_texture"; assert(it.offset_in_bytes == 57, "SDL_GPUColorTargetInfo.cycle_resolve_texture has unexpected offset % instead of 57", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetInfo.cycle_resolve_texture has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 58, "SDL_GPUColorTargetInfo.padding1 has unexpected offset % instead of 58", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetInfo.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 59, "SDL_GPUColorTargetInfo.padding2 has unexpected offset % instead of 59", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUColorTargetInfo.padding2 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUColorTargetInfo) == 64, "SDL_GPUColorTargetInfo has size % instead of 64", size_of(SDL_GPUColorTargetInfo)); } { info := type_info(SDL_GPUDepthStencilTargetInfo); for info.members { if it.name == { case "texture"; assert(it.offset_in_bytes == 0, "SDL_GPUDepthStencilTargetInfo.texture has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUDepthStencilTargetInfo.texture has unexpected size % instead of 8", it.type.runtime_size); case "clear_depth"; assert(it.offset_in_bytes == 8, "SDL_GPUDepthStencilTargetInfo.clear_depth has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUDepthStencilTargetInfo.clear_depth has unexpected size % instead of 4", it.type.runtime_size); case "load_op"; assert(it.offset_in_bytes == 12, "SDL_GPUDepthStencilTargetInfo.load_op has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUDepthStencilTargetInfo.load_op has unexpected size % instead of 4", it.type.runtime_size); case "store_op"; assert(it.offset_in_bytes == 16, "SDL_GPUDepthStencilTargetInfo.store_op has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUDepthStencilTargetInfo.store_op has unexpected size % instead of 4", it.type.runtime_size); case "stencil_load_op"; assert(it.offset_in_bytes == 20, "SDL_GPUDepthStencilTargetInfo.stencil_load_op has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUDepthStencilTargetInfo.stencil_load_op has unexpected size % instead of 4", it.type.runtime_size); case "stencil_store_op"; assert(it.offset_in_bytes == 24, "SDL_GPUDepthStencilTargetInfo.stencil_store_op has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUDepthStencilTargetInfo.stencil_store_op has unexpected size % instead of 4", it.type.runtime_size); case "cycle"; assert(it.offset_in_bytes == 28, "SDL_GPUDepthStencilTargetInfo.cycle has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilTargetInfo.cycle has unexpected size % instead of 1", it.type.runtime_size); case "clear_stencil"; assert(it.offset_in_bytes == 29, "SDL_GPUDepthStencilTargetInfo.clear_stencil has unexpected offset % instead of 29", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilTargetInfo.clear_stencil has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 30, "SDL_GPUDepthStencilTargetInfo.padding1 has unexpected offset % instead of 30", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilTargetInfo.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 31, "SDL_GPUDepthStencilTargetInfo.padding2 has unexpected offset % instead of 31", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUDepthStencilTargetInfo.padding2 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUDepthStencilTargetInfo) == 32, "SDL_GPUDepthStencilTargetInfo has size % instead of 32", size_of(SDL_GPUDepthStencilTargetInfo)); } { info := type_info(SDL_GPUBlitInfo); for info.members { if it.name == { case "source"; assert(it.offset_in_bytes == 0, "SDL_GPUBlitInfo.source has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_GPUBlitInfo.source has unexpected size % instead of 32", it.type.runtime_size); case "destination"; assert(it.offset_in_bytes == 32, "SDL_GPUBlitInfo.destination has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 32, "SDL_GPUBlitInfo.destination has unexpected size % instead of 32", it.type.runtime_size); case "load_op"; assert(it.offset_in_bytes == 64, "SDL_GPUBlitInfo.load_op has unexpected offset % instead of 64", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitInfo.load_op has unexpected size % instead of 4", it.type.runtime_size); case "clear_color"; assert(it.offset_in_bytes == 68, "SDL_GPUBlitInfo.clear_color has unexpected offset % instead of 68", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_GPUBlitInfo.clear_color has unexpected size % instead of 16", it.type.runtime_size); case "flip_mode"; assert(it.offset_in_bytes == 84, "SDL_GPUBlitInfo.flip_mode has unexpected offset % instead of 84", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitInfo.flip_mode has unexpected size % instead of 4", it.type.runtime_size); case "filter"; assert(it.offset_in_bytes == 88, "SDL_GPUBlitInfo.filter has unexpected offset % instead of 88", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBlitInfo.filter has unexpected size % instead of 4", it.type.runtime_size); case "cycle"; assert(it.offset_in_bytes == 92, "SDL_GPUBlitInfo.cycle has unexpected offset % instead of 92", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUBlitInfo.cycle has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 93, "SDL_GPUBlitInfo.padding1 has unexpected offset % instead of 93", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUBlitInfo.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 94, "SDL_GPUBlitInfo.padding2 has unexpected offset % instead of 94", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUBlitInfo.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 95, "SDL_GPUBlitInfo.padding3 has unexpected offset % instead of 95", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUBlitInfo.padding3 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUBlitInfo) == 96, "SDL_GPUBlitInfo has size % instead of 96", size_of(SDL_GPUBlitInfo)); } { info := type_info(SDL_GPUBufferBinding); for info.members { if it.name == { case "buffer"; assert(it.offset_in_bytes == 0, "SDL_GPUBufferBinding.buffer has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUBufferBinding.buffer has unexpected size % instead of 8", it.type.runtime_size); case "offset"; assert(it.offset_in_bytes == 8, "SDL_GPUBufferBinding.offset has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUBufferBinding.offset has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_GPUBufferBinding) == 16, "SDL_GPUBufferBinding has size % instead of 16", size_of(SDL_GPUBufferBinding)); } { info := type_info(SDL_GPUTextureSamplerBinding); for info.members { if it.name == { case "texture"; assert(it.offset_in_bytes == 0, "SDL_GPUTextureSamplerBinding.texture has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUTextureSamplerBinding.texture has unexpected size % instead of 8", it.type.runtime_size); case "sampler"; assert(it.offset_in_bytes == 8, "SDL_GPUTextureSamplerBinding.sampler has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUTextureSamplerBinding.sampler has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_GPUTextureSamplerBinding) == 16, "SDL_GPUTextureSamplerBinding has size % instead of 16", size_of(SDL_GPUTextureSamplerBinding)); } { info := type_info(SDL_GPUStorageBufferReadWriteBinding); for info.members { if it.name == { case "buffer"; assert(it.offset_in_bytes == 0, "SDL_GPUStorageBufferReadWriteBinding.buffer has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUStorageBufferReadWriteBinding.buffer has unexpected size % instead of 8", it.type.runtime_size); case "cycle"; assert(it.offset_in_bytes == 8, "SDL_GPUStorageBufferReadWriteBinding.cycle has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUStorageBufferReadWriteBinding.cycle has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 9, "SDL_GPUStorageBufferReadWriteBinding.padding1 has unexpected offset % instead of 9", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUStorageBufferReadWriteBinding.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 10, "SDL_GPUStorageBufferReadWriteBinding.padding2 has unexpected offset % instead of 10", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUStorageBufferReadWriteBinding.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 11, "SDL_GPUStorageBufferReadWriteBinding.padding3 has unexpected offset % instead of 11", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUStorageBufferReadWriteBinding.padding3 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUStorageBufferReadWriteBinding) == 16, "SDL_GPUStorageBufferReadWriteBinding has size % instead of 16", size_of(SDL_GPUStorageBufferReadWriteBinding)); } { info := type_info(SDL_GPUStorageTextureReadWriteBinding); for info.members { if it.name == { case "texture"; assert(it.offset_in_bytes == 0, "SDL_GPUStorageTextureReadWriteBinding.texture has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_GPUStorageTextureReadWriteBinding.texture has unexpected size % instead of 8", it.type.runtime_size); case "mip_level"; assert(it.offset_in_bytes == 8, "SDL_GPUStorageTextureReadWriteBinding.mip_level has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUStorageTextureReadWriteBinding.mip_level has unexpected size % instead of 4", it.type.runtime_size); case "layer"; assert(it.offset_in_bytes == 12, "SDL_GPUStorageTextureReadWriteBinding.layer has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_GPUStorageTextureReadWriteBinding.layer has unexpected size % instead of 4", it.type.runtime_size); case "cycle"; assert(it.offset_in_bytes == 16, "SDL_GPUStorageTextureReadWriteBinding.cycle has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUStorageTextureReadWriteBinding.cycle has unexpected size % instead of 1", it.type.runtime_size); case "padding1"; assert(it.offset_in_bytes == 17, "SDL_GPUStorageTextureReadWriteBinding.padding1 has unexpected offset % instead of 17", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUStorageTextureReadWriteBinding.padding1 has unexpected size % instead of 1", it.type.runtime_size); case "padding2"; assert(it.offset_in_bytes == 18, "SDL_GPUStorageTextureReadWriteBinding.padding2 has unexpected offset % instead of 18", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUStorageTextureReadWriteBinding.padding2 has unexpected size % instead of 1", it.type.runtime_size); case "padding3"; assert(it.offset_in_bytes == 19, "SDL_GPUStorageTextureReadWriteBinding.padding3 has unexpected offset % instead of 19", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_GPUStorageTextureReadWriteBinding.padding3 has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_GPUStorageTextureReadWriteBinding) == 24, "SDL_GPUStorageTextureReadWriteBinding has size % instead of 24", size_of(SDL_GPUStorageTextureReadWriteBinding)); } { info := type_info(SDL_HapticDirection); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_HapticDirection.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_HapticDirection.type has unexpected size % instead of 1", it.type.runtime_size); case "dir"; assert(it.offset_in_bytes == 4, "SDL_HapticDirection.dir has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 12, "SDL_HapticDirection.dir has unexpected size % instead of 12", it.type.runtime_size); } } assert(size_of(SDL_HapticDirection) == 16, "SDL_HapticDirection has size % instead of 16", size_of(SDL_HapticDirection)); } { info := type_info(SDL_HapticConstant); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_HapticConstant.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.type has unexpected size % instead of 2", it.type.runtime_size); case "direction"; assert(it.offset_in_bytes == 4, "SDL_HapticConstant.direction has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_HapticConstant.direction has unexpected size % instead of 16", it.type.runtime_size); case "length"; assert(it.offset_in_bytes == 20, "SDL_HapticConstant.length has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_HapticConstant.length has unexpected size % instead of 4", it.type.runtime_size); case "delay"; assert(it.offset_in_bytes == 24, "SDL_HapticConstant.delay has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.delay has unexpected size % instead of 2", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 26, "SDL_HapticConstant.button has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.button has unexpected size % instead of 2", it.type.runtime_size); case "interval"; assert(it.offset_in_bytes == 28, "SDL_HapticConstant.interval has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.interval has unexpected size % instead of 2", it.type.runtime_size); case "level"; assert(it.offset_in_bytes == 30, "SDL_HapticConstant.level has unexpected offset % instead of 30", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.level has unexpected size % instead of 2", it.type.runtime_size); case "attack_length"; assert(it.offset_in_bytes == 32, "SDL_HapticConstant.attack_length has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.attack_length has unexpected size % instead of 2", it.type.runtime_size); case "attack_level"; assert(it.offset_in_bytes == 34, "SDL_HapticConstant.attack_level has unexpected offset % instead of 34", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.attack_level has unexpected size % instead of 2", it.type.runtime_size); case "fade_length"; assert(it.offset_in_bytes == 36, "SDL_HapticConstant.fade_length has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.fade_length has unexpected size % instead of 2", it.type.runtime_size); case "fade_level"; assert(it.offset_in_bytes == 38, "SDL_HapticConstant.fade_level has unexpected offset % instead of 38", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticConstant.fade_level has unexpected size % instead of 2", it.type.runtime_size); } } assert(size_of(SDL_HapticConstant) == 40, "SDL_HapticConstant has size % instead of 40", size_of(SDL_HapticConstant)); } { info := type_info(SDL_HapticPeriodic); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_HapticPeriodic.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.type has unexpected size % instead of 2", it.type.runtime_size); case "direction"; assert(it.offset_in_bytes == 4, "SDL_HapticPeriodic.direction has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_HapticPeriodic.direction has unexpected size % instead of 16", it.type.runtime_size); case "length"; assert(it.offset_in_bytes == 20, "SDL_HapticPeriodic.length has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_HapticPeriodic.length has unexpected size % instead of 4", it.type.runtime_size); case "delay"; assert(it.offset_in_bytes == 24, "SDL_HapticPeriodic.delay has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.delay has unexpected size % instead of 2", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 26, "SDL_HapticPeriodic.button has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.button has unexpected size % instead of 2", it.type.runtime_size); case "interval"; assert(it.offset_in_bytes == 28, "SDL_HapticPeriodic.interval has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.interval has unexpected size % instead of 2", it.type.runtime_size); case "period"; assert(it.offset_in_bytes == 30, "SDL_HapticPeriodic.period has unexpected offset % instead of 30", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.period has unexpected size % instead of 2", it.type.runtime_size); case "magnitude"; assert(it.offset_in_bytes == 32, "SDL_HapticPeriodic.magnitude has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.magnitude has unexpected size % instead of 2", it.type.runtime_size); case "offset"; assert(it.offset_in_bytes == 34, "SDL_HapticPeriodic.offset has unexpected offset % instead of 34", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.offset has unexpected size % instead of 2", it.type.runtime_size); case "phase"; assert(it.offset_in_bytes == 36, "SDL_HapticPeriodic.phase has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.phase has unexpected size % instead of 2", it.type.runtime_size); case "attack_length"; assert(it.offset_in_bytes == 38, "SDL_HapticPeriodic.attack_length has unexpected offset % instead of 38", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.attack_length has unexpected size % instead of 2", it.type.runtime_size); case "attack_level"; assert(it.offset_in_bytes == 40, "SDL_HapticPeriodic.attack_level has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.attack_level has unexpected size % instead of 2", it.type.runtime_size); case "fade_length"; assert(it.offset_in_bytes == 42, "SDL_HapticPeriodic.fade_length has unexpected offset % instead of 42", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.fade_length has unexpected size % instead of 2", it.type.runtime_size); case "fade_level"; assert(it.offset_in_bytes == 44, "SDL_HapticPeriodic.fade_level has unexpected offset % instead of 44", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticPeriodic.fade_level has unexpected size % instead of 2", it.type.runtime_size); } } assert(size_of(SDL_HapticPeriodic) == 48, "SDL_HapticPeriodic has size % instead of 48", size_of(SDL_HapticPeriodic)); } { info := type_info(SDL_HapticCondition); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_HapticCondition.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCondition.type has unexpected size % instead of 2", it.type.runtime_size); case "direction"; assert(it.offset_in_bytes == 4, "SDL_HapticCondition.direction has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_HapticCondition.direction has unexpected size % instead of 16", it.type.runtime_size); case "length"; assert(it.offset_in_bytes == 20, "SDL_HapticCondition.length has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_HapticCondition.length has unexpected size % instead of 4", it.type.runtime_size); case "delay"; assert(it.offset_in_bytes == 24, "SDL_HapticCondition.delay has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCondition.delay has unexpected size % instead of 2", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 26, "SDL_HapticCondition.button has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCondition.button has unexpected size % instead of 2", it.type.runtime_size); case "interval"; assert(it.offset_in_bytes == 28, "SDL_HapticCondition.interval has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCondition.interval has unexpected size % instead of 2", it.type.runtime_size); case "right_sat"; assert(it.offset_in_bytes == 30, "SDL_HapticCondition.right_sat has unexpected offset % instead of 30", it.offset_in_bytes); assert(it.type.runtime_size == 6, "SDL_HapticCondition.right_sat has unexpected size % instead of 6", it.type.runtime_size); case "left_sat"; assert(it.offset_in_bytes == 36, "SDL_HapticCondition.left_sat has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 6, "SDL_HapticCondition.left_sat has unexpected size % instead of 6", it.type.runtime_size); case "right_coeff"; assert(it.offset_in_bytes == 42, "SDL_HapticCondition.right_coeff has unexpected offset % instead of 42", it.offset_in_bytes); assert(it.type.runtime_size == 6, "SDL_HapticCondition.right_coeff has unexpected size % instead of 6", it.type.runtime_size); case "left_coeff"; assert(it.offset_in_bytes == 48, "SDL_HapticCondition.left_coeff has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 6, "SDL_HapticCondition.left_coeff has unexpected size % instead of 6", it.type.runtime_size); case "deadband"; assert(it.offset_in_bytes == 54, "SDL_HapticCondition.deadband has unexpected offset % instead of 54", it.offset_in_bytes); assert(it.type.runtime_size == 6, "SDL_HapticCondition.deadband has unexpected size % instead of 6", it.type.runtime_size); case "center"; assert(it.offset_in_bytes == 60, "SDL_HapticCondition.center has unexpected offset % instead of 60", it.offset_in_bytes); assert(it.type.runtime_size == 6, "SDL_HapticCondition.center has unexpected size % instead of 6", it.type.runtime_size); } } assert(size_of(SDL_HapticCondition) == 68, "SDL_HapticCondition has size % instead of 68", size_of(SDL_HapticCondition)); } { info := type_info(SDL_HapticRamp); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_HapticRamp.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.type has unexpected size % instead of 2", it.type.runtime_size); case "direction"; assert(it.offset_in_bytes == 4, "SDL_HapticRamp.direction has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_HapticRamp.direction has unexpected size % instead of 16", it.type.runtime_size); case "length"; assert(it.offset_in_bytes == 20, "SDL_HapticRamp.length has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_HapticRamp.length has unexpected size % instead of 4", it.type.runtime_size); case "delay"; assert(it.offset_in_bytes == 24, "SDL_HapticRamp.delay has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.delay has unexpected size % instead of 2", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 26, "SDL_HapticRamp.button has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.button has unexpected size % instead of 2", it.type.runtime_size); case "interval"; assert(it.offset_in_bytes == 28, "SDL_HapticRamp.interval has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.interval has unexpected size % instead of 2", it.type.runtime_size); case "start"; assert(it.offset_in_bytes == 30, "SDL_HapticRamp.start has unexpected offset % instead of 30", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.start has unexpected size % instead of 2", it.type.runtime_size); case "end"; assert(it.offset_in_bytes == 32, "SDL_HapticRamp.end has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.end has unexpected size % instead of 2", it.type.runtime_size); case "attack_length"; assert(it.offset_in_bytes == 34, "SDL_HapticRamp.attack_length has unexpected offset % instead of 34", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.attack_length has unexpected size % instead of 2", it.type.runtime_size); case "attack_level"; assert(it.offset_in_bytes == 36, "SDL_HapticRamp.attack_level has unexpected offset % instead of 36", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.attack_level has unexpected size % instead of 2", it.type.runtime_size); case "fade_length"; assert(it.offset_in_bytes == 38, "SDL_HapticRamp.fade_length has unexpected offset % instead of 38", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.fade_length has unexpected size % instead of 2", it.type.runtime_size); case "fade_level"; assert(it.offset_in_bytes == 40, "SDL_HapticRamp.fade_level has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticRamp.fade_level has unexpected size % instead of 2", it.type.runtime_size); } } assert(size_of(SDL_HapticRamp) == 44, "SDL_HapticRamp has size % instead of 44", size_of(SDL_HapticRamp)); } { info := type_info(SDL_HapticLeftRight); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_HapticLeftRight.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticLeftRight.type has unexpected size % instead of 2", it.type.runtime_size); case "length"; assert(it.offset_in_bytes == 4, "SDL_HapticLeftRight.length has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_HapticLeftRight.length has unexpected size % instead of 4", it.type.runtime_size); case "large_magnitude"; assert(it.offset_in_bytes == 8, "SDL_HapticLeftRight.large_magnitude has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticLeftRight.large_magnitude has unexpected size % instead of 2", it.type.runtime_size); case "small_magnitude"; assert(it.offset_in_bytes == 10, "SDL_HapticLeftRight.small_magnitude has unexpected offset % instead of 10", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticLeftRight.small_magnitude has unexpected size % instead of 2", it.type.runtime_size); } } assert(size_of(SDL_HapticLeftRight) == 12, "SDL_HapticLeftRight has size % instead of 12", size_of(SDL_HapticLeftRight)); } { info := type_info(SDL_HapticCustom); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_HapticCustom.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.type has unexpected size % instead of 2", it.type.runtime_size); case "direction"; assert(it.offset_in_bytes == 4, "SDL_HapticCustom.direction has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_HapticCustom.direction has unexpected size % instead of 16", it.type.runtime_size); case "length"; assert(it.offset_in_bytes == 20, "SDL_HapticCustom.length has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_HapticCustom.length has unexpected size % instead of 4", it.type.runtime_size); case "delay"; assert(it.offset_in_bytes == 24, "SDL_HapticCustom.delay has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.delay has unexpected size % instead of 2", it.type.runtime_size); case "button"; assert(it.offset_in_bytes == 26, "SDL_HapticCustom.button has unexpected offset % instead of 26", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.button has unexpected size % instead of 2", it.type.runtime_size); case "interval"; assert(it.offset_in_bytes == 28, "SDL_HapticCustom.interval has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.interval has unexpected size % instead of 2", it.type.runtime_size); case "channels"; assert(it.offset_in_bytes == 30, "SDL_HapticCustom.channels has unexpected offset % instead of 30", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_HapticCustom.channels has unexpected size % instead of 1", it.type.runtime_size); case "period"; assert(it.offset_in_bytes == 32, "SDL_HapticCustom.period has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.period has unexpected size % instead of 2", it.type.runtime_size); case "samples"; assert(it.offset_in_bytes == 34, "SDL_HapticCustom.samples has unexpected offset % instead of 34", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.samples has unexpected size % instead of 2", it.type.runtime_size); case "data"; assert(it.offset_in_bytes == 40, "SDL_HapticCustom.data has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_HapticCustom.data has unexpected size % instead of 8", it.type.runtime_size); case "attack_length"; assert(it.offset_in_bytes == 48, "SDL_HapticCustom.attack_length has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.attack_length has unexpected size % instead of 2", it.type.runtime_size); case "attack_level"; assert(it.offset_in_bytes == 50, "SDL_HapticCustom.attack_level has unexpected offset % instead of 50", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.attack_level has unexpected size % instead of 2", it.type.runtime_size); case "fade_length"; assert(it.offset_in_bytes == 52, "SDL_HapticCustom.fade_length has unexpected offset % instead of 52", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.fade_length has unexpected size % instead of 2", it.type.runtime_size); case "fade_level"; assert(it.offset_in_bytes == 54, "SDL_HapticCustom.fade_level has unexpected offset % instead of 54", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticCustom.fade_level has unexpected size % instead of 2", it.type.runtime_size); } } assert(size_of(SDL_HapticCustom) == 56, "SDL_HapticCustom has size % instead of 56", size_of(SDL_HapticCustom)); } { info := type_info(SDL_HapticEffect); for info.members { if it.name == { case "type"; assert(it.offset_in_bytes == 0, "SDL_HapticEffect.type has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_HapticEffect.type has unexpected size % instead of 2", it.type.runtime_size); case "constant"; assert(it.offset_in_bytes == 0, "SDL_HapticEffect.constant has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 40, "SDL_HapticEffect.constant has unexpected size % instead of 40", it.type.runtime_size); case "periodic"; assert(it.offset_in_bytes == 0, "SDL_HapticEffect.periodic has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 48, "SDL_HapticEffect.periodic has unexpected size % instead of 48", it.type.runtime_size); case "condition"; assert(it.offset_in_bytes == 0, "SDL_HapticEffect.condition has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 68, "SDL_HapticEffect.condition has unexpected size % instead of 68", it.type.runtime_size); case "ramp"; assert(it.offset_in_bytes == 0, "SDL_HapticEffect.ramp has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 44, "SDL_HapticEffect.ramp has unexpected size % instead of 44", it.type.runtime_size); case "leftright"; assert(it.offset_in_bytes == 0, "SDL_HapticEffect.leftright has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 12, "SDL_HapticEffect.leftright has unexpected size % instead of 12", it.type.runtime_size); case "custom"; assert(it.offset_in_bytes == 0, "SDL_HapticEffect.custom has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 56, "SDL_HapticEffect.custom has unexpected size % instead of 56", it.type.runtime_size); } } assert(size_of(SDL_HapticEffect) == 72, "SDL_HapticEffect has size % instead of 72", size_of(SDL_HapticEffect)); } { info := type_info(SDL_hid_device_info); for info.members { if it.name == { case "path"; assert(it.offset_in_bytes == 0, "SDL_hid_device_info.path has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_hid_device_info.path has unexpected size % instead of 8", it.type.runtime_size); case "vendor_id"; assert(it.offset_in_bytes == 8, "SDL_hid_device_info.vendor_id has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_hid_device_info.vendor_id has unexpected size % instead of 2", it.type.runtime_size); case "product_id"; assert(it.offset_in_bytes == 10, "SDL_hid_device_info.product_id has unexpected offset % instead of 10", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_hid_device_info.product_id has unexpected size % instead of 2", it.type.runtime_size); case "serial_number"; assert(it.offset_in_bytes == 16, "SDL_hid_device_info.serial_number has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_hid_device_info.serial_number has unexpected size % instead of 8", it.type.runtime_size); case "release_number"; assert(it.offset_in_bytes == 24, "SDL_hid_device_info.release_number has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_hid_device_info.release_number has unexpected size % instead of 2", it.type.runtime_size); case "manufacturer_string"; assert(it.offset_in_bytes == 32, "SDL_hid_device_info.manufacturer_string has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_hid_device_info.manufacturer_string has unexpected size % instead of 8", it.type.runtime_size); case "product_string"; assert(it.offset_in_bytes == 40, "SDL_hid_device_info.product_string has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_hid_device_info.product_string has unexpected size % instead of 8", it.type.runtime_size); case "usage_page"; assert(it.offset_in_bytes == 48, "SDL_hid_device_info.usage_page has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_hid_device_info.usage_page has unexpected size % instead of 2", it.type.runtime_size); case "usage"; assert(it.offset_in_bytes == 50, "SDL_hid_device_info.usage has unexpected offset % instead of 50", it.offset_in_bytes); assert(it.type.runtime_size == 2, "SDL_hid_device_info.usage has unexpected size % instead of 2", it.type.runtime_size); case "interface_number"; assert(it.offset_in_bytes == 52, "SDL_hid_device_info.interface_number has unexpected offset % instead of 52", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_hid_device_info.interface_number has unexpected size % instead of 4", it.type.runtime_size); case "interface_class"; assert(it.offset_in_bytes == 56, "SDL_hid_device_info.interface_class has unexpected offset % instead of 56", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_hid_device_info.interface_class has unexpected size % instead of 4", it.type.runtime_size); case "interface_subclass"; assert(it.offset_in_bytes == 60, "SDL_hid_device_info.interface_subclass has unexpected offset % instead of 60", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_hid_device_info.interface_subclass has unexpected size % instead of 4", it.type.runtime_size); case "interface_protocol"; assert(it.offset_in_bytes == 64, "SDL_hid_device_info.interface_protocol has unexpected offset % instead of 64", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_hid_device_info.interface_protocol has unexpected size % instead of 4", it.type.runtime_size); case "bus_type"; assert(it.offset_in_bytes == 68, "SDL_hid_device_info.bus_type has unexpected offset % instead of 68", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_hid_device_info.bus_type has unexpected size % instead of 4", it.type.runtime_size); case "next"; assert(it.offset_in_bytes == 72, "SDL_hid_device_info.next has unexpected offset % instead of 72", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_hid_device_info.next has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_hid_device_info) == 80, "SDL_hid_device_info has size % instead of 80", size_of(SDL_hid_device_info)); } { info := type_info(SDL_Locale); for info.members { if it.name == { case "language"; assert(it.offset_in_bytes == 0, "SDL_Locale.language has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_Locale.language has unexpected size % instead of 8", it.type.runtime_size); case "country"; assert(it.offset_in_bytes == 8, "SDL_Locale.country has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_Locale.country has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_Locale) == 16, "SDL_Locale has size % instead of 16", size_of(SDL_Locale)); } { info := type_info(SDL_MessageBoxButtonData); for info.members { if it.name == { case "flags"; assert(it.offset_in_bytes == 0, "SDL_MessageBoxButtonData.flags has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MessageBoxButtonData.flags has unexpected size % instead of 4", it.type.runtime_size); case "buttonID"; assert(it.offset_in_bytes == 4, "SDL_MessageBoxButtonData.buttonID has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MessageBoxButtonData.buttonID has unexpected size % instead of 4", it.type.runtime_size); case "text"; assert(it.offset_in_bytes == 8, "SDL_MessageBoxButtonData.text has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MessageBoxButtonData.text has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_MessageBoxButtonData) == 16, "SDL_MessageBoxButtonData has size % instead of 16", size_of(SDL_MessageBoxButtonData)); } { info := type_info(SDL_MessageBoxColor); for info.members { if it.name == { case "r"; assert(it.offset_in_bytes == 0, "SDL_MessageBoxColor.r has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_MessageBoxColor.r has unexpected size % instead of 1", it.type.runtime_size); case "g"; assert(it.offset_in_bytes == 1, "SDL_MessageBoxColor.g has unexpected offset % instead of 1", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_MessageBoxColor.g has unexpected size % instead of 1", it.type.runtime_size); case "b"; assert(it.offset_in_bytes == 2, "SDL_MessageBoxColor.b has unexpected offset % instead of 2", it.offset_in_bytes); assert(it.type.runtime_size == 1, "SDL_MessageBoxColor.b has unexpected size % instead of 1", it.type.runtime_size); } } assert(size_of(SDL_MessageBoxColor) == 3, "SDL_MessageBoxColor has size % instead of 3", size_of(SDL_MessageBoxColor)); } { info := type_info(SDL_MessageBoxColorScheme); for info.members { if it.name == { case "colors"; assert(it.offset_in_bytes == 0, "SDL_MessageBoxColorScheme.colors has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 15, "SDL_MessageBoxColorScheme.colors has unexpected size % instead of 15", it.type.runtime_size); } } assert(size_of(SDL_MessageBoxColorScheme) == 15, "SDL_MessageBoxColorScheme has size % instead of 15", size_of(SDL_MessageBoxColorScheme)); } { info := type_info(SDL_MessageBoxData); for info.members { if it.name == { case "flags"; assert(it.offset_in_bytes == 0, "SDL_MessageBoxData.flags has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MessageBoxData.flags has unexpected size % instead of 4", it.type.runtime_size); case "window"; assert(it.offset_in_bytes == 8, "SDL_MessageBoxData.window has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MessageBoxData.window has unexpected size % instead of 8", it.type.runtime_size); case "title"; assert(it.offset_in_bytes == 16, "SDL_MessageBoxData.title has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MessageBoxData.title has unexpected size % instead of 8", it.type.runtime_size); case "message"; assert(it.offset_in_bytes == 24, "SDL_MessageBoxData.message has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MessageBoxData.message has unexpected size % instead of 8", it.type.runtime_size); case "numbuttons"; assert(it.offset_in_bytes == 32, "SDL_MessageBoxData.numbuttons has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_MessageBoxData.numbuttons has unexpected size % instead of 4", it.type.runtime_size); case "buttons"; assert(it.offset_in_bytes == 40, "SDL_MessageBoxData.buttons has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MessageBoxData.buttons has unexpected size % instead of 8", it.type.runtime_size); case "colorScheme"; assert(it.offset_in_bytes == 48, "SDL_MessageBoxData.colorScheme has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_MessageBoxData.colorScheme has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_MessageBoxData) == 56, "SDL_MessageBoxData has size % instead of 56", size_of(SDL_MessageBoxData)); } { info := type_info(SDL_Vertex); for info.members { if it.name == { case "position"; assert(it.offset_in_bytes == 0, "SDL_Vertex.position has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_Vertex.position has unexpected size % instead of 8", it.type.runtime_size); case "color"; assert(it.offset_in_bytes == 8, "SDL_Vertex.color has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 16, "SDL_Vertex.color has unexpected size % instead of 16", it.type.runtime_size); case "tex_coord"; assert(it.offset_in_bytes == 24, "SDL_Vertex.tex_coord has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_Vertex.tex_coord has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_Vertex) == 32, "SDL_Vertex has size % instead of 32", size_of(SDL_Vertex)); } { info := type_info(SDL_Texture); for info.members { if it.name == { case "format"; assert(it.offset_in_bytes == 0, "SDL_Texture.format has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Texture.format has unexpected size % instead of 4", it.type.runtime_size); case "w"; assert(it.offset_in_bytes == 4, "SDL_Texture.w has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Texture.w has unexpected size % instead of 4", it.type.runtime_size); case "h"; assert(it.offset_in_bytes == 8, "SDL_Texture.h has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Texture.h has unexpected size % instead of 4", it.type.runtime_size); case "refcount"; assert(it.offset_in_bytes == 12, "SDL_Texture.refcount has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_Texture.refcount has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_Texture) == 16, "SDL_Texture has size % instead of 16", size_of(SDL_Texture)); } { info := type_info(SDL_StorageInterface); for info.members { if it.name == { case "version"; assert(it.offset_in_bytes == 0, "SDL_StorageInterface.version has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_StorageInterface.version has unexpected size % instead of 4", it.type.runtime_size); case "close"; assert(it.offset_in_bytes == 8, "SDL_StorageInterface.close has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.close has unexpected size % instead of 8", it.type.runtime_size); case "ready"; assert(it.offset_in_bytes == 16, "SDL_StorageInterface.ready has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.ready has unexpected size % instead of 8", it.type.runtime_size); case "enumerate"; assert(it.offset_in_bytes == 24, "SDL_StorageInterface.enumerate has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.enumerate has unexpected size % instead of 8", it.type.runtime_size); case "info"; assert(it.offset_in_bytes == 32, "SDL_StorageInterface.info has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.info has unexpected size % instead of 8", it.type.runtime_size); case "read_file"; assert(it.offset_in_bytes == 40, "SDL_StorageInterface.read_file has unexpected offset % instead of 40", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.read_file has unexpected size % instead of 8", it.type.runtime_size); case "write_file"; assert(it.offset_in_bytes == 48, "SDL_StorageInterface.write_file has unexpected offset % instead of 48", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.write_file has unexpected size % instead of 8", it.type.runtime_size); case "mkdir"; assert(it.offset_in_bytes == 56, "SDL_StorageInterface.mkdir has unexpected offset % instead of 56", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.mkdir has unexpected size % instead of 8", it.type.runtime_size); case "_remove"; assert(it.offset_in_bytes == 64, "SDL_StorageInterface._remove has unexpected offset % instead of 64", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface._remove has unexpected size % instead of 8", it.type.runtime_size); case "rename"; assert(it.offset_in_bytes == 72, "SDL_StorageInterface.rename has unexpected offset % instead of 72", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.rename has unexpected size % instead of 8", it.type.runtime_size); case "copy"; assert(it.offset_in_bytes == 80, "SDL_StorageInterface.copy has unexpected offset % instead of 80", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.copy has unexpected size % instead of 8", it.type.runtime_size); case "space_remaining"; assert(it.offset_in_bytes == 88, "SDL_StorageInterface.space_remaining has unexpected offset % instead of 88", it.offset_in_bytes); assert(it.type.runtime_size == 8, "SDL_StorageInterface.space_remaining has unexpected size % instead of 8", it.type.runtime_size); } } assert(size_of(SDL_StorageInterface) == 96, "SDL_StorageInterface has size % instead of 96", size_of(SDL_StorageInterface)); } { info := type_info(SDL_DateTime); for info.members { if it.name == { case "year"; assert(it.offset_in_bytes == 0, "SDL_DateTime.year has unexpected offset % instead of 0", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.year has unexpected size % instead of 4", it.type.runtime_size); case "month"; assert(it.offset_in_bytes == 4, "SDL_DateTime.month has unexpected offset % instead of 4", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.month has unexpected size % instead of 4", it.type.runtime_size); case "day"; assert(it.offset_in_bytes == 8, "SDL_DateTime.day has unexpected offset % instead of 8", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.day has unexpected size % instead of 4", it.type.runtime_size); case "hour"; assert(it.offset_in_bytes == 12, "SDL_DateTime.hour has unexpected offset % instead of 12", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.hour has unexpected size % instead of 4", it.type.runtime_size); case "minute"; assert(it.offset_in_bytes == 16, "SDL_DateTime.minute has unexpected offset % instead of 16", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.minute has unexpected size % instead of 4", it.type.runtime_size); case "second"; assert(it.offset_in_bytes == 20, "SDL_DateTime.second has unexpected offset % instead of 20", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.second has unexpected size % instead of 4", it.type.runtime_size); case "nanosecond"; assert(it.offset_in_bytes == 24, "SDL_DateTime.nanosecond has unexpected offset % instead of 24", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.nanosecond has unexpected size % instead of 4", it.type.runtime_size); case "day_of_week"; assert(it.offset_in_bytes == 28, "SDL_DateTime.day_of_week has unexpected offset % instead of 28", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.day_of_week has unexpected size % instead of 4", it.type.runtime_size); case "utc_offset"; assert(it.offset_in_bytes == 32, "SDL_DateTime.utc_offset has unexpected offset % instead of 32", it.offset_in_bytes); assert(it.type.runtime_size == 4, "SDL_DateTime.utc_offset has unexpected size % instead of 4", it.type.runtime_size); } } assert(size_of(SDL_DateTime) == 36, "SDL_DateTime has size % instead of 36", size_of(SDL_DateTime)); } }