From 4502fee2542cf3a2523d6bb615faa5009cfd00aa Mon Sep 17 00:00:00 2001 From: pommicket Date: Sat, 25 Sep 2021 22:15:59 -0400 Subject: an object --- vlib.h | 715 +---------------------------------------------------------------- 1 file changed, 9 insertions(+), 706 deletions(-) (limited to 'vlib.h') diff --git a/vlib.h b/vlib.h index aecace3..7750a71 100644 --- a/vlib.h +++ b/vlib.h @@ -10925,705 +10925,7 @@ V_DECL vec4 gen_rand_unit_vec4(Generator *g) { } #if V_GL -#if V_FORCE_INCLUDE_SDL #include -#else -/* --*- BEGIN (modified) BORROWED CODE -*- -LICENSE: - -Simple DirectMedia Layer -Copyright (C) 1997-2020 Sam Lantinga - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -typedef enum -{ - 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_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; - -typedef int32_t SDL_Keycode; -#define SDLK_SCANCODE_MASK (1<<30) -#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) -typedef enum -{ - SDLK_UNKNOWN = 0, SDLK_RETURN = '\r', SDLK_ESCAPE = '\033', SDLK_BACKSPACE = '\b', SDLK_TAB = '\t', - SDLK_SPACE = ' ', SDLK_EXCLAIM = '!', SDLK_QUOTEDBL = '"', SDLK_HASH = '#', SDLK_PERCENT = '%', - SDLK_DOLLAR = '$', SDLK_AMPERSAND = '&', SDLK_QUOTE = '\'', SDLK_LEFTPAREN = '(', SDLK_RIGHTPAREN = ')', - SDLK_ASTERISK = '*', SDLK_PLUS = '+', SDLK_COMMA = ',', SDLK_MINUS = '-', SDLK_PERIOD = '.', SDLK_SLASH = '/', - SDLK_0 = '0', SDLK_1 = '1', SDLK_2 = '2', SDLK_3 = '3', SDLK_4 = '4', SDLK_5 = '5', SDLK_6 = '6', SDLK_7 = '7', - SDLK_8 = '8', SDLK_9 = '9', SDLK_COLON = ':', SDLK_SEMICOLON = ';', SDLK_LESS = '<', SDLK_EQUALS = '=', - SDLK_GREATER = '>', SDLK_QUESTION = '?', SDLK_AT = 64, - - SDLK_LEFTBRACKET = '[', SDLK_BACKSLASH = '\\', SDLK_RIGHTBRACKET = ']', SDLK_CARET = '^', SDLK_UNDERSCORE = '_', - SDLK_BACKQUOTE = '`', SDLK_a = 'a', SDLK_b = 'b', SDLK_c = 'c', SDLK_d = 'd', SDLK_e = 'e', SDLK_f = 'f', - SDLK_g = 'g', SDLK_h = 'h', SDLK_i = 'i', SDLK_j = 'j', SDLK_k = 'k', SDLK_l = 'l', SDLK_m = 'm', SDLK_n = 'n', - SDLK_o = 'o', SDLK_p = 'p', SDLK_q = 'q', SDLK_r = 'r', SDLK_s = 's', SDLK_t = 't', SDLK_u = 'u', SDLK_v = 'v', - SDLK_w = 'w', SDLK_x = 'x', SDLK_y = 'y', SDLK_z = 'z', - - SDLK_CAPSLOCK = (1<<30) | (SDL_SCANCODE_CAPSLOCK), - SDLK_F1 = (1<<30) | (SDL_SCANCODE_F1), SDLK_F2 = (1<<30) | (SDL_SCANCODE_F2), - SDLK_F3 = (1<<30) | (SDL_SCANCODE_F3), SDLK_F4 = (1<<30) | (SDL_SCANCODE_F4), - SDLK_F5 = (1<<30) | (SDL_SCANCODE_F5), SDLK_F6 = (1<<30) | (SDL_SCANCODE_F6), - SDLK_F7 = (1<<30) | (SDL_SCANCODE_F7), SDLK_F8 = (1<<30) | (SDL_SCANCODE_F8), - SDLK_F9 = (1<<30) | (SDL_SCANCODE_F9), SDLK_F10 = (1<<30) | (SDL_SCANCODE_F10), - SDLK_F11 = (1<<30) | (SDL_SCANCODE_F11), SDLK_F12 = (1<<30) | (SDL_SCANCODE_F12), - - SDLK_PRINTSCREEN = (1<<30) | (SDL_SCANCODE_PRINTSCREEN), SDLK_SCROLLLOCK = (1<<30) | (SDL_SCANCODE_SCROLLLOCK), - SDLK_PAUSE = (1<<30) | (SDL_SCANCODE_PAUSE), SDLK_INSERT = (1<<30) | (SDL_SCANCODE_INSERT), - SDLK_HOME = (1<<30) | (SDL_SCANCODE_HOME), SDLK_PAGEUP = (1<<30) | (SDL_SCANCODE_PAGEUP), - SDLK_DELETE = '\177', SDLK_END = (1<<30) | (SDL_SCANCODE_END), - SDLK_PAGEDOWN = (1<<30) | (SDL_SCANCODE_PAGEDOWN), SDLK_RIGHT = (1<<30) | (SDL_SCANCODE_RIGHT), - SDLK_LEFT = (1<<30) | (SDL_SCANCODE_LEFT), SDLK_DOWN = (1<<30) | (SDL_SCANCODE_DOWN), - SDLK_UP = (1<<30) | (SDL_SCANCODE_UP), - - SDLK_NUMLOCKCLEAR = (1<<30) | (SDL_SCANCODE_NUMLOCKCLEAR), - SDLK_KP_DIVIDE = (1<<30) | (SDL_SCANCODE_KP_DIVIDE), - SDLK_KP_MULTIPLY = (1<<30) | (SDL_SCANCODE_KP_MULTIPLY), - SDLK_KP_MINUS = (1<<30) | (SDL_SCANCODE_KP_MINUS), - SDLK_KP_PLUS = (1<<30) | (SDL_SCANCODE_KP_PLUS), - SDLK_KP_ENTER = (1<<30) | (SDL_SCANCODE_KP_ENTER), - SDLK_KP_1 = (1<<30) | (SDL_SCANCODE_KP_1), SDLK_KP_2 = (1<<30) | (SDL_SCANCODE_KP_2), - SDLK_KP_3 = (1<<30) | (SDL_SCANCODE_KP_3), SDLK_KP_4 = (1<<30) | (SDL_SCANCODE_KP_4), - SDLK_KP_5 = (1<<30) | (SDL_SCANCODE_KP_5), SDLK_KP_6 = (1<<30) | (SDL_SCANCODE_KP_6), - SDLK_KP_7 = (1<<30) | (SDL_SCANCODE_KP_7), SDLK_KP_8 = (1<<30) | (SDL_SCANCODE_KP_8), - SDLK_KP_9 = (1<<30) | (SDL_SCANCODE_KP_9), SDLK_KP_0 = (1<<30) | (SDL_SCANCODE_KP_0), - SDLK_KP_PERIOD = (1<<30) | (SDL_SCANCODE_KP_PERIOD), - - SDLK_LCTRL = (1<<30) | (SDL_SCANCODE_LCTRL), - SDLK_LSHIFT = (1<<30) | (SDL_SCANCODE_LSHIFT), - SDLK_LALT = (1<<30) | (SDL_SCANCODE_LALT), - SDLK_LGUI = (1<<30) | (SDL_SCANCODE_LGUI), - SDLK_RCTRL = (1<<30) | (SDL_SCANCODE_RCTRL), - SDLK_RSHIFT = (1<<30) | (SDL_SCANCODE_RSHIFT), - SDLK_RALT = (1<<30) | (SDL_SCANCODE_RALT), - SDLK_RGUI = (1<<30) | (SDL_SCANCODE_RGUI), -} SDL_KeyCode; - -typedef enum -{ - SDL_KMODNONE = 0x0000, SDL_KMODLSHIFT = 0x0001, SDL_KMODRSHIFT = 0x0002, - SDL_KMODLCTRL = 0x0040, SDL_KMODRCTRL = 0x0080, SDL_KMODLALT = 0x0100, - SDL_KMODRALT = 0x0200, SDL_KMODLGUI = 0x0400, SDL_KMODRGUI = 0x0800, - SDL_KMODNUM = 0x1000, SDL_KMODCAPS = 0x2000, SDL_KMODMODE = 0x4000, - SDL_KMODRESERVED = 0x8000, - SDL_KMODCTRL = SDL_KMODLCTRL | SDL_KMODRCTRL, - SDL_KMODSHIFT = SDL_KMODLSHIFT | SDL_KMODRSHIFT, - SDL_KMODALT = SDL_KMODLALT | SDL_KMODRALT, - SDL_KMODGUI = SDL_KMODLGUI | SDL_KMODRGUI -} SDL_Keymod; - -#define SDL_INIT_TIMER 0x00000001u -#define SDL_INIT_AUDIO 0x00000010u -#define SDL_INIT_VIDEO 0x00000020u /* SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ -#define SDL_INIT_JOYSTICK 0x00000200u /* SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ -#define SDL_INIT_HAPTIC 0x00001000u -#define SDL_INIT_GAMECONTROLLER 0x00002000u /* SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ -#define SDL_INIT_EVENTS 0x00004000u -#define SDL_INIT_SENSOR 0x00008000u - -enum -{ - SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ - SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ - SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ - SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */ - SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */ - SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */ - SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */ - SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */ - SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ - SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ - SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ - SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), - SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ - SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported. - On macOS NSHighResolutionCapable must be set true in the - application's Info.plist for this to have any effect. */ - SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ - SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ - SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ - SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */ - SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */ - SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */ - SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */ - SDL_WINDOW_METAL = 0x20000000 /**< window usable for Metal view */ -}; - -typedef enum -{ - SDL_GL_RED_SIZE, - SDL_GL_GREEN_SIZE, - SDL_GL_BLUE_SIZE, - SDL_GL_ALPHA_SIZE, - SDL_GL_BUFFER_SIZE, - SDL_GL_DOUBLEBUFFER, - SDL_GL_DEPTH_SIZE, - SDL_GL_STENCIL_SIZE, - SDL_GL_ACCUM_RED_SIZE, - SDL_GL_ACCUM_GREEN_SIZE, - SDL_GL_ACCUM_BLUE_SIZE, - SDL_GL_ACCUM_ALPHA_SIZE, - SDL_GL_STEREO, - SDL_GL_MULTISAMPLEBUFFERS, - SDL_GL_MULTISAMPLESAMPLES, - SDL_GL_ACCELERATED_VISUAL, - SDL_GL_RETAINED_BACKING, - SDL_GL_CONTEXT_MAJOR_VERSION, - SDL_GL_CONTEXT_MINOR_VERSION, - SDL_GL_CONTEXT_EGL, - SDL_GL_CONTEXT_FLAGS, - SDL_GL_CONTEXT_PROFILE_MASK, - SDL_GL_SHARE_WITH_CURRENT_CONTEXT, - SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, - SDL_GL_CONTEXT_RELEASE_BEHAVIOR, - SDL_GL_CONTEXT_RESET_NOTIFICATION, - SDL_GL_CONTEXT_NO_ERROR -} SDL_GLattr; - -typedef enum -{ - 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_GLcontextFlag; - -#define SDL_RELEASED 0 -#define SDL_PRESSED 1 - -typedef int32_t SDL_JoystickID; -typedef int64_t SDL_TouchID; -typedef int64_t SDL_FingerID; -typedef int64_t SDL_GestureID; - -typedef enum -{ - SDL_FIRSTEVENT = 0, - SDL_QUIT = 0x100, - SDL_APP_TERMINATING, - SDL_APP_LOWMEMORY, - SDL_APP_WILLENTERBACKGROUND, - SDL_APP_DIDENTERBACKGROUND, - SDL_APP_WILLENTERFOREGROUND, - SDL_APP_DIDENTERFOREGROUND, - SDL_LOCALECHANGED, - SDL_DISPLAYEVENT = 0x150, - SDL_WINDOWEVENT = 0x200, - SDL_SYSWMEVENT, - SDL_KEYDOWN = 0x300, - SDL_KEYUP, - SDL_TEXTEDITING, - SDL_TEXTINPUT, - SDL_KEYMAPCHANGED, - SDL_MOUSEMOTION = 0x400, - SDL_MOUSEBUTTONDOWN, - SDL_MOUSEBUTTONUP, - SDL_MOUSEWHEEL, - SDL_JOYAXISMOTION = 0x600, - SDL_JOYBALLMOTION, - SDL_JOYHATMOTION, - SDL_JOYBUTTONDOWN, - SDL_JOYBUTTONUP, - SDL_JOYDEVICEADDED, - SDL_JOYDEVICEREMOVED, - SDL_CONTROLLERAXISMOTION = 0x650, - SDL_CONTROLLERBUTTONDOWN, - SDL_CONTROLLERBUTTONUP, - SDL_CONTROLLERDEVICEADDED, - SDL_CONTROLLERDEVICEREMOVED, - SDL_CONTROLLERDEVICEREMAPPED, - SDL_CONTROLLERTOUCHPADDOWN, - SDL_CONTROLLERTOUCHPADMOTION, - SDL_CONTROLLERTOUCHPADUP, - SDL_CONTROLLERSENSORUPDATE, - SDL_FINGERDOWN = 0x700, - SDL_FINGERUP, - SDL_FINGERMOTION, - SDL_DOLLARGESTURE = 0x800, - SDL_DOLLARRECORD, - SDL_MULTIGESTURE, - SDL_CLIPBOARDUPDATE = 0x900, - SDL_DROPFILE = 0x1000, - SDL_DROPTEXT, - SDL_DROPBEGIN, - SDL_DROPCOMPLETE, - SDL_AUDIODEVICEADDED = 0x1100, - SDL_AUDIODEVICEREMOVED, - SDL_SENSORUPDATE = 0x1200, - SDL_RENDER_TARGETS_RESET = 0x2000, - SDL_RENDER_DEVICE_RESET, - SDL_USEREVENT = 0x8000, - SDL_LASTEVENT = 0xFFFF -} SDL_EventType; -typedef struct SDL_CommonEvent -{ - uint32_t type; - uint32_t timestamp; -} SDL_CommonEvent; -typedef struct SDL_DisplayEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t display; - uint8_t event; - uint8_t padding1; - uint8_t padding2; - uint8_t padding3; - int32_t data1; -} SDL_DisplayEvent; -typedef struct SDL_WindowEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t windowID; - uint8_t event; - uint8_t padding1; - uint8_t padding2; - uint8_t padding3; - int32_t data1; - int32_t data2; -} SDL_WindowEvent; -typedef struct SDL_Keysym -{ - SDL_Scancode scancode; - SDL_Keycode sym; - uint16_t mod; - uint32_t unused; -} SDL_Keysym; -typedef struct SDL_KeyboardEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t windowID; - uint8_t state; - uint8_t repeat; - uint8_t padding2; - uint8_t padding3; - SDL_Keysym keysym; -} SDL_KeyboardEvent; - -#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32) -typedef struct SDL_TextEditingEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t windowID; - char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; - int32_t start; - int32_t length; -} SDL_TextEditingEvent; -#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) -typedef struct SDL_TextInputEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t windowID; - char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; -} SDL_TextInputEvent; -typedef struct SDL_MouseMotionEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t windowID; - uint32_t which; - uint32_t state; - int32_t x; - int32_t y; - int32_t xrel; - int32_t yrel; -} SDL_MouseMotionEvent; -typedef struct SDL_MouseButtonEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t windowID; - uint32_t which; - uint8_t button; - uint8_t state; - uint8_t clicks; - uint8_t padding1; - int32_t x; - int32_t y; -} SDL_MouseButtonEvent; -typedef struct SDL_MouseWheelEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t windowID; - uint32_t which; - int32_t x; - int32_t y; - uint32_t direction; -} SDL_MouseWheelEvent; -typedef struct SDL_JoyAxisEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_JoystickID which; - uint8_t axis; - uint8_t padding1; - uint8_t padding2; - uint8_t padding3; - int16_t value; - uint16_t padding4; -} SDL_JoyAxisEvent; -typedef struct SDL_JoyBallEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_JoystickID which; - uint8_t ball; - uint8_t padding1; - uint8_t padding2; - uint8_t padding3; - int16_t xrel; - int16_t yrel; -} SDL_JoyBallEvent; -typedef struct SDL_JoyHatEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_JoystickID which; - uint8_t hat; - uint8_t value; - uint8_t padding1; - uint8_t padding2; -} SDL_JoyHatEvent; -typedef struct SDL_JoyButtonEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_JoystickID which; - uint8_t button; - uint8_t state; - uint8_t padding1; - uint8_t padding2; -} SDL_JoyButtonEvent; -typedef struct SDL_JoyDeviceEvent -{ - uint32_t type; - uint32_t timestamp; - int32_t which; -} SDL_JoyDeviceEvent; -typedef struct SDL_ControllerAxisEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_JoystickID which; - uint8_t axis; - uint8_t padding1; - uint8_t padding2; - uint8_t padding3; - int16_t value; - uint16_t padding4; -} SDL_ControllerAxisEvent; -typedef struct SDL_ControllerButtonEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_JoystickID which; - uint8_t button; - uint8_t state; - uint8_t padding1; - uint8_t padding2; -} SDL_ControllerButtonEvent; -typedef struct SDL_ControllerDeviceEvent -{ - uint32_t type; - uint32_t timestamp; - int32_t which; -} SDL_ControllerDeviceEvent; -typedef struct SDL_ControllerTouchpadEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_JoystickID which; - int32_t touchpad; - int32_t finger; - float x; - float y; - float pressure; -} SDL_ControllerTouchpadEvent; -typedef struct SDL_ControllerSensorEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_JoystickID which; - int32_t sensor; - float data[3]; -} SDL_ControllerSensorEvent; -typedef struct SDL_AudioDeviceEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t which; - uint8_t iscapture; - uint8_t padding1; - uint8_t padding2; - uint8_t padding3; -} SDL_AudioDeviceEvent; -typedef struct SDL_TouchFingerEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_TouchID touchId; - SDL_FingerID fingerId; - float x; - float y; - float dx; - float dy; - float pressure; - uint32_t windowID; -} SDL_TouchFingerEvent; -typedef struct SDL_MultiGestureEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_TouchID touchId; - float dTheta; - float dDist; - float x; - float y; - uint16_t numFingers; - uint16_t padding; -} SDL_MultiGestureEvent; -typedef struct SDL_DollarGestureEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_TouchID touchId; - SDL_GestureID gestureId; - uint32_t numFingers; - float error; - float x; - float y; -} SDL_DollarGestureEvent; -typedef struct SDL_DropEvent -{ - uint32_t type; - uint32_t timestamp; - char *file; - uint32_t windowID; -} SDL_DropEvent; -typedef struct SDL_SensorEvent -{ - uint32_t type; - uint32_t timestamp; - int32_t which; - float data[6]; -} SDL_SensorEvent; -typedef struct SDL_QuitEvent -{ - uint32_t type; - uint32_t timestamp; -} SDL_QuitEvent; -typedef struct SDL_OSEvent -{ - uint32_t type; - uint32_t timestamp; -} SDL_OSEvent; -typedef struct SDL_UserEvent -{ - uint32_t type; - uint32_t timestamp; - uint32_t windowID; - int32_t code; - void *data1; - void *data2; -} SDL_UserEvent; -struct SDL_SysWMmsg; -typedef struct SDL_SysWMmsg SDL_SysWMmsg; -typedef struct SDL_SysWMEvent -{ - uint32_t type; - uint32_t timestamp; - SDL_SysWMmsg *msg; -} SDL_SysWMEvent; -typedef union SDL_Event -{ - uint32_t type; - SDL_CommonEvent common; - SDL_DisplayEvent display; - SDL_WindowEvent window; - SDL_KeyboardEvent key; - SDL_TextEditingEvent edit; - SDL_TextInputEvent text; - SDL_MouseMotionEvent motion; - SDL_MouseButtonEvent button; - SDL_MouseWheelEvent wheel; - SDL_JoyAxisEvent jaxis; - SDL_JoyBallEvent jball; - SDL_JoyHatEvent jhat; - SDL_JoyButtonEvent jbutton; - SDL_JoyDeviceEvent jdevice; - SDL_ControllerAxisEvent caxis; - SDL_ControllerButtonEvent cbutton; - SDL_ControllerDeviceEvent cdevice; - SDL_ControllerTouchpadEvent ctouchpad; - SDL_ControllerSensorEvent csensor; - SDL_AudioDeviceEvent adevice; - SDL_SensorEvent sensor; - SDL_QuitEvent quit; - SDL_UserEvent user; - SDL_SysWMEvent syswm; - SDL_TouchFingerEvent tfinger; - SDL_MultiGestureEvent mgesture; - SDL_DollarGestureEvent dgesture; - SDL_DropEvent drop; - uint8_t padding[56]; -} SDL_Event; -// -*- END BORROWED CODE -*- -#endif // V_FORCE_INCLUDE_SDL - -#define SDL_WINDOWPOS_UNDEFINED 0x1FFF0000u -#define SDL_MESSAGEBOX_ERROR 0x00000010 -#define SDL_BUTTON_LEFT 1 -#define SDL_BUTTON_MIDDLE 2 -#define SDL_BUTTON_RIGHT 3 -#define SDL_BUTTON_X1 4 -#define SDL_BUTTON_X2 5 -#define SDL_BUTTON_LMASK 1 -#define SDL_BUTTON_MMASK 2 -#define SDL_BUTTON_RMASK 4 -#define SDL_BUTTON_X1MASK 8 -#define SDL_BUTTON_X2MASK 16 -#define SDL_MOUSEWHEEL_FLIPPED 1 - -typedef struct SDL_Window SDL_Window; -typedef void *SDL_GLContext; - -#define SDLCALL - -typedef uint16_t SDL_AudioFormat; -typedef uint32_t SDL_AudioDeviceID; -typedef void (SDLCALL *SDL_AudioCallback)(void *userdata, uint8_t *stream, int len); -typedef struct SDL_AudioSpec -{ - int freq; - SDL_AudioFormat format; - uint8_t channels; - uint8_t silence; - uint16_t samples; - uint16_t padding; - uint32_t size; - SDL_AudioCallback callback; - void *userdata; -} SDL_AudioSpec; -#define AUDIO_U8 0x0008 -#define AUDIO_S8 0x8008 -#define AUDIO_U16LSB 0x0010 -#define AUDIO_S16LSB 0x8010 -#define AUDIO_U16MSB 0x1010 -#define AUDIO_S16MSB 0x9010 -#define AUDIO_U16 AUDIO_U16LSB -#define AUDIO_S16 AUDIO_S16LSB -#define AUDIO_S32LSB 0x8020 -#define AUDIO_S32MSB 0x9020 -#define AUDIO_S32 AUDIO_S32LSB -#define AUDIO_F32LSB 0x8120 -#define AUDIO_F32MSB 0x9120 -#define AUDIO_F32 AUDIO_F32LSB -#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 -#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 -#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 -#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008 -#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE) - -typedef struct SDL_mutex SDL_mutex; - -SDLCALL int SDL_Init(uint32_t); -SDLCALL SDL_Window *SDL_CreateWindow(const char *, int, int, int, int, uint32_t); -SDLCALL void SDL_Quit(void); -SDLCALL char const *SDL_GetError(void); -SDLCALL int SDL_SetWindowFullscreen(SDL_Window *, uint32_t); -SDLCALL void SDL_ShowWindow(SDL_Window *); -SDLCALL void SDL_HideWindow(SDL_Window *); -SDLCALL void SDL_DestroyWindow(SDL_Window *); -SDLCALL bool SDL_SetHint(const char *, const char *); -SDLCALL void SDL_GL_SetAttribute(SDL_GLattr, int); -SDLCALL SDL_GLContext SDL_GL_CreateContext(SDL_Window *); -SDLCALL void SDL_GL_DeleteContext(SDL_GLContext); -SDLCALL void *SDL_GL_GetProcAddress(const char *); -SDLCALL int SDL_GL_GetAttribute(SDL_GLattr, int *); -SDLCALL void SDL_GL_SwapWindow(SDL_Window *); -SDLCALL int SDL_PollEvent(SDL_Event *); -SDLCALL int SDL_GL_SetSwapInterval(int); -SDLCALL int SDL_ShowSimpleMessageBox(uint32_t, const char *, const char *, SDL_Window *); -SDLCALL int SDL_SetRelativeMouseMode(bool); -SDLCALL void SDL_GetWindowSize(SDL_Window *, int *, int *); -SDLCALL void SDL_SetWindowResizable(SDL_Window *, bool); -SDLCALL uint32_t SDL_GetWindowFlags(SDL_Window *); -SDLCALL void SDL_SetWindowSize(SDL_Window *, int, int); -SDLCALL uint32_t SDL_GetMouseState(int *, int *); -SDLCALL const uint8_t *SDL_GetKeyboardState(int *); -SDLCALL bool SDL_HasClipboardText(void); -SDLCALL char *SDL_GetClipboardText(void); -SDLCALL int SDL_SetClipboardText(const char *); -SDLCALL void SDL_MinimizeWindow(SDL_Window *); -SDLCALL void SDL_MaximizeWindow(SDL_Window *); -SDLCALL void SDL_RestoreWindow(SDL_Window *); -SDLCALL SDL_AudioDeviceID SDL_OpenAudioDevice(const char *, int, const SDL_AudioSpec *, SDL_AudioSpec *, int); -SDLCALL void SDL_LockAudioDevice(SDL_AudioDeviceID); -SDLCALL void SDL_UnlockAudioDevice(SDL_AudioDeviceID); -SDLCALL void SDL_PauseAudioDevice(SDL_AudioDeviceID, int); -SDLCALL void SDL_CloseAudioDevice(SDL_AudioDeviceID); -SDLCALL SDL_mutex *SDL_CreateMutex(void); -SDLCALL int SDL_LockMutex(SDL_mutex *); -SDLCALL int SDL_TryLockMutex(SDL_mutex *); -SDLCALL int SDL_UnlockMutex(SDL_mutex *); -SDLCALL void SDL_DestroyMutex(SDL_mutex *); - static SDL_Window *V_sdl_window; static char V_window_error[2048]; @@ -12019,14 +11321,14 @@ top: unsigned key = V_sdl_keycode_to_key(sdl.key.keysym.sym); unsigned sdlmod = sdl.key.keysym.mod; EventKeyboard *kbd = &event->key; - if (sdlmod & SDL_KMODLCTRL) modifiers |= KEY_MODIFIER_LCTRL; - if (sdlmod & SDL_KMODRCTRL) modifiers |= KEY_MODIFIER_RCTRL; - if (sdlmod & SDL_KMODLSHIFT) modifiers |= KEY_MODIFIER_LSHIFT; - if (sdlmod & SDL_KMODRSHIFT) modifiers |= KEY_MODIFIER_RSHIFT; - if (sdlmod & SDL_KMODLALT) modifiers |= KEY_MODIFIER_LALT; - if (sdlmod & SDL_KMODRALT) modifiers |= KEY_MODIFIER_RALT; - if (sdlmod & SDL_KMODLGUI) modifiers |= KEY_MODIFIER_LGUI; - if (sdlmod & SDL_KMODRGUI) modifiers |= KEY_MODIFIER_RGUI; + if (sdlmod & KMOD_LCTRL) modifiers |= KEY_MODIFIER_LCTRL; + if (sdlmod & KMOD_RCTRL) modifiers |= KEY_MODIFIER_RCTRL; + if (sdlmod & KMOD_LSHIFT) modifiers |= KEY_MODIFIER_LSHIFT; + if (sdlmod & KMOD_RSHIFT) modifiers |= KEY_MODIFIER_RSHIFT; + if (sdlmod & KMOD_LALT) modifiers |= KEY_MODIFIER_LALT; + if (sdlmod & KMOD_RALT) modifiers |= KEY_MODIFIER_RALT; + if (sdlmod & KMOD_LGUI) modifiers |= KEY_MODIFIER_LGUI; + if (sdlmod & KMOD_RGUI) modifiers |= KEY_MODIFIER_RGUI; #if DEBUG if (key == KEY_ESCAPE && event->type == EVENT_KEYDOWN && V_gl_uniform_editor_shown) { V_gl_uniform_editor_shown = false; @@ -12100,6 +11402,7 @@ top: V_DECL void window_set_relative_mouse(bool on) { SDL_SetRelativeMouseMode(on); + SDL_CaptureMouse(on); } V_DECL vec2i window_get_size(void) { -- cgit v1.2.3