mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 14:18:47 +00:00
Add sdl3_events.odin
This commit is contained in:
Vendored
+608
@@ -0,0 +1,608 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
|
EventType :: enum Uint32 {
|
||||||
|
FIRST = 0, /**< Unused (do not remove) */
|
||||||
|
|
||||||
|
/* Application events */
|
||||||
|
QUIT = 0x100, /**< User-requested quit */
|
||||||
|
|
||||||
|
/* These application events have special meaning on iOS and Android, see README-ios.md and README-android.md for details */
|
||||||
|
TERMINATING, /**< The application is being terminated by the OS. This event must be handled in a callback set with SDL_AddEventWatch().
|
||||||
|
Called on iOS in applicationWillTerminate()
|
||||||
|
Called on Android in onDestroy()
|
||||||
|
*/
|
||||||
|
LOW_MEMORY, /**< The application is low on memory, free memory if possible. This event must be handled in a callback set with SDL_AddEventWatch().
|
||||||
|
Called on iOS in applicationDidReceiveMemoryWarning()
|
||||||
|
Called on Android in onTrimMemory()
|
||||||
|
*/
|
||||||
|
WILL_ENTER_BACKGROUND, /**< The application is about to enter the background. This event must be handled in a callback set with SDL_AddEventWatch().
|
||||||
|
Called on iOS in applicationWillResignActive()
|
||||||
|
Called on Android in onPause()
|
||||||
|
*/
|
||||||
|
DID_ENTER_BACKGROUND, /**< The application did enter the background and may not get CPU for some time. This event must be handled in a callback set with SDL_AddEventWatch().
|
||||||
|
Called on iOS in applicationDidEnterBackground()
|
||||||
|
Called on Android in onPause()
|
||||||
|
*/
|
||||||
|
WILL_ENTER_FOREGROUND, /**< The application is about to enter the foreground. This event must be handled in a callback set with SDL_AddEventWatch().
|
||||||
|
Called on iOS in applicationWillEnterForeground()
|
||||||
|
Called on Android in onResume()
|
||||||
|
*/
|
||||||
|
DID_ENTER_FOREGROUND, /**< The application is now interactive. This event must be handled in a callback set with SDL_AddEventWatch().
|
||||||
|
Called on iOS in applicationDidBecomeActive()
|
||||||
|
Called on Android in onResume()
|
||||||
|
*/
|
||||||
|
|
||||||
|
LOCALE_CHANGED, /**< The user's locale preferences have changed. */
|
||||||
|
|
||||||
|
SYSTEM_THEME_CHANGED, /**< The system theme changed */
|
||||||
|
|
||||||
|
/* Display events */
|
||||||
|
/* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
|
||||||
|
DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
|
||||||
|
DISPLAY_ADDED, /**< Display has been added to the system */
|
||||||
|
DISPLAY_REMOVED, /**< Display has been removed from the system */
|
||||||
|
DISPLAY_MOVED, /**< Display has changed position */
|
||||||
|
DISPLAY_DESKTOP_MODE_CHANGED, /**< Display has changed desktop mode */
|
||||||
|
DISPLAY_CURRENT_MODE_CHANGED, /**< Display has changed current mode */
|
||||||
|
DISPLAY_CONTENT_SCALE_CHANGED, /**< Display has changed content scale */
|
||||||
|
DISPLAY_FIRST = DISPLAY_ORIENTATION,
|
||||||
|
DISPLAY_LAST = DISPLAY_CONTENT_SCALE_CHANGED,
|
||||||
|
|
||||||
|
/* Window events */
|
||||||
|
/* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
|
||||||
|
/* 0x201 was SYSWM, reserve the number for sdl2-compat */
|
||||||
|
WINDOW_SHOWN = 0x202, /**< Window has been shown */
|
||||||
|
WINDOW_HIDDEN, /**< Window has been hidden */
|
||||||
|
WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event */
|
||||||
|
WINDOW_MOVED, /**< Window has been moved to data1, data2 */
|
||||||
|
WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
|
||||||
|
WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */
|
||||||
|
WINDOW_METAL_VIEW_RESIZED,/**< The pixel size of a Metal view associated with the window has changed */
|
||||||
|
WINDOW_MINIMIZED, /**< Window has been minimized */
|
||||||
|
WINDOW_MAXIMIZED, /**< Window has been maximized */
|
||||||
|
WINDOW_RESTORED, /**< Window has been restored to normal size and position */
|
||||||
|
WINDOW_MOUSE_ENTER, /**< Window has gained mouse focus */
|
||||||
|
WINDOW_MOUSE_LEAVE, /**< Window has lost mouse focus */
|
||||||
|
WINDOW_FOCUS_GAINED, /**< Window has gained keyboard focus */
|
||||||
|
WINDOW_FOCUS_LOST, /**< Window has lost keyboard focus */
|
||||||
|
WINDOW_CLOSE_REQUESTED, /**< The window manager requests that the window be closed */
|
||||||
|
WINDOW_HIT_TEST, /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL */
|
||||||
|
WINDOW_ICCPROF_CHANGED, /**< The ICC profile of the window's display has changed */
|
||||||
|
WINDOW_DISPLAY_CHANGED, /**< Window has been moved to display data1 */
|
||||||
|
WINDOW_DISPLAY_SCALE_CHANGED, /**< Window display scale has been changed */
|
||||||
|
WINDOW_SAFE_AREA_CHANGED, /**< The window safe area has been changed */
|
||||||
|
WINDOW_OCCLUDED, /**< The window has been occluded */
|
||||||
|
WINDOW_ENTER_FULLSCREEN, /**< The window has entered fullscreen mode */
|
||||||
|
WINDOW_LEAVE_FULLSCREEN, /**< The window has left fullscreen mode */
|
||||||
|
WINDOW_DESTROYED, /**< The window with the associated ID is being or has been destroyed. If this message is being handled
|
||||||
|
in an event watcher, the window handle is still valid and can still be used to retrieve any properties
|
||||||
|
associated with the window. Otherwise, the handle has already been destroyed and all resources
|
||||||
|
associated with it are invalid */
|
||||||
|
WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */
|
||||||
|
WINDOW_FIRST = WINDOW_SHOWN,
|
||||||
|
WINDOW_LAST = WINDOW_HDR_STATE_CHANGED,
|
||||||
|
|
||||||
|
/* Keyboard events */
|
||||||
|
KEY_DOWN = 0x300, /**< Key pressed */
|
||||||
|
KEY_UP, /**< Key released */
|
||||||
|
TEXT_EDITING, /**< Keyboard text editing (composition) */
|
||||||
|
TEXT_INPUT, /**< Keyboard text input */
|
||||||
|
KEYMAP_CHANGED, /**< Keymap changed due to a system event such as an
|
||||||
|
input language or keyboard layout change. */
|
||||||
|
KEYBOARD_ADDED, /**< A new keyboard has been inserted into the system */
|
||||||
|
KEYBOARD_REMOVED, /**< A keyboard has been removed */
|
||||||
|
TEXT_EDITING_CANDIDATES, /**< Keyboard text editing candidates */
|
||||||
|
|
||||||
|
/* Mouse events */
|
||||||
|
MOUSE_MOTION = 0x400, /**< Mouse moved */
|
||||||
|
MOUSE_BUTTON_DOWN, /**< Mouse button pressed */
|
||||||
|
MOUSE_BUTTON_UP, /**< Mouse button released */
|
||||||
|
MOUSE_WHEEL, /**< Mouse wheel motion */
|
||||||
|
MOUSE_ADDED, /**< A new mouse has been inserted into the system */
|
||||||
|
MOUSE_REMOVED, /**< A mouse has been removed */
|
||||||
|
|
||||||
|
/* Joystick events */
|
||||||
|
JOYSTICK_AXIS_MOTION = 0x600, /**< Joystick axis motion */
|
||||||
|
JOYSTICK_BALL_MOTION, /**< Joystick trackball motion */
|
||||||
|
JOYSTICK_HAT_MOTION, /**< Joystick hat position change */
|
||||||
|
JOYSTICK_BUTTON_DOWN, /**< Joystick button pressed */
|
||||||
|
JOYSTICK_BUTTON_UP, /**< Joystick button released */
|
||||||
|
JOYSTICK_ADDED, /**< A new joystick has been inserted into the system */
|
||||||
|
JOYSTICK_REMOVED, /**< An opened joystick has been removed */
|
||||||
|
JOYSTICK_BATTERY_UPDATED, /**< Joystick battery level change */
|
||||||
|
JOYSTICK_UPDATE_COMPLETE, /**< Joystick update is complete */
|
||||||
|
|
||||||
|
/* Gamepad events */
|
||||||
|
GAMEPAD_AXIS_MOTION = 0x650, /**< Gamepad axis motion */
|
||||||
|
GAMEPAD_BUTTON_DOWN, /**< Gamepad button pressed */
|
||||||
|
GAMEPAD_BUTTON_UP, /**< Gamepad button released */
|
||||||
|
GAMEPAD_ADDED, /**< A new gamepad has been inserted into the system */
|
||||||
|
GAMEPAD_REMOVED, /**< A gamepad has been removed */
|
||||||
|
GAMEPAD_REMAPPED, /**< The gamepad mapping was updated */
|
||||||
|
GAMEPAD_TOUCHPAD_DOWN, /**< Gamepad touchpad was touched */
|
||||||
|
GAMEPAD_TOUCHPAD_MOTION, /**< Gamepad touchpad finger was moved */
|
||||||
|
GAMEPAD_TOUCHPAD_UP, /**< Gamepad touchpad finger was lifted */
|
||||||
|
GAMEPAD_SENSOR_UPDATE, /**< Gamepad sensor was updated */
|
||||||
|
GAMEPAD_UPDATE_COMPLETE, /**< Gamepad update is complete */
|
||||||
|
GAMEPAD_STEAM_HANDLE_UPDATED, /**< Gamepad Steam handle has changed */
|
||||||
|
|
||||||
|
/* Touch events */
|
||||||
|
FINGER_DOWN = 0x700,
|
||||||
|
FINGER_UP,
|
||||||
|
FINGER_MOTION,
|
||||||
|
FINGER_CANCELED,
|
||||||
|
|
||||||
|
/* 0x800, 0x801, and 0x802 were the Gesture events from SDL2. Do not reuse these values! sdl2-compat needs them! */
|
||||||
|
|
||||||
|
/* Clipboard events */
|
||||||
|
CLIPBOARD_UPDATE = 0x900, /**< The clipboard or primary selection changed */
|
||||||
|
|
||||||
|
/* Drag and drop events */
|
||||||
|
DROP_FILE = 0x1000, /**< The system requests a file open */
|
||||||
|
DROP_TEXT, /**< text/plain drag-and-drop event */
|
||||||
|
DROP_BEGIN, /**< A new set of drops is beginning (NULL filename) */
|
||||||
|
DROP_COMPLETE, /**< Current set of drops is now complete (NULL filename) */
|
||||||
|
DROP_POSITION, /**< Position while moving over the window */
|
||||||
|
|
||||||
|
/* Audio hotplug events */
|
||||||
|
AUDIO_DEVICE_ADDED = 0x1100, /**< A new audio device is available */
|
||||||
|
AUDIO_DEVICE_REMOVED, /**< An audio device has been removed. */
|
||||||
|
AUDIO_DEVICE_FORMAT_CHANGED, /**< An audio device's format has been changed by the system. */
|
||||||
|
|
||||||
|
/* Sensor events */
|
||||||
|
SENSOR_UPDATE = 0x1200, /**< A sensor was updated */
|
||||||
|
|
||||||
|
/* Pressure-sensitive pen events */
|
||||||
|
PEN_PROXIMITY_IN = 0x1300, /**< Pressure-sensitive pen has become available */
|
||||||
|
PEN_PROXIMITY_OUT, /**< Pressure-sensitive pen has become unavailable */
|
||||||
|
PEN_DOWN, /**< Pressure-sensitive pen touched drawing surface */
|
||||||
|
PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */
|
||||||
|
PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */
|
||||||
|
PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */
|
||||||
|
PEN_MOTION, /**< Pressure-sensitive pen is moving on the tablet */
|
||||||
|
PEN_AXIS, /**< Pressure-sensitive pen angle/pressure/etc changed */
|
||||||
|
|
||||||
|
/* Camera hotplug events */
|
||||||
|
CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */
|
||||||
|
CAMERA_DEVICE_REMOVED, /**< A camera device has been removed. */
|
||||||
|
CAMERA_DEVICE_APPROVED, /**< A camera device has been approved for use by the user. */
|
||||||
|
CAMERA_DEVICE_DENIED, /**< A camera device has been denied for use by the user. */
|
||||||
|
|
||||||
|
/* Render events */
|
||||||
|
RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
|
||||||
|
RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
|
||||||
|
RENDER_DEVICE_LOST, /**< The device has been lost and can't be recovered. */
|
||||||
|
|
||||||
|
/* Reserved events for private platforms */
|
||||||
|
PRIVATE0 = 0x4000,
|
||||||
|
PRIVATE1,
|
||||||
|
PRIVATE2,
|
||||||
|
PRIVATE3,
|
||||||
|
|
||||||
|
/* Internal events */
|
||||||
|
POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
|
||||||
|
|
||||||
|
/** Events USER through LAST are for your use,
|
||||||
|
* and should be allocated with SDL_RegisterEvents()
|
||||||
|
*/
|
||||||
|
USER = 0x8000,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This last event is only for bounding internal arrays
|
||||||
|
*/
|
||||||
|
LAST = 0xFFFF,
|
||||||
|
}
|
||||||
|
|
||||||
|
CommonEvent :: struct {
|
||||||
|
type: EventType, /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
|
||||||
|
_: Uint32,
|
||||||
|
timestamp: Uint64, /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_DISPLAYEVENT_* */
|
||||||
|
displayID: DisplayID, /**< The associated display */
|
||||||
|
data1: Sint32, /**< event dependent data */
|
||||||
|
data2: Sint32, /**< event dependent data */
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_WINDOW_* */
|
||||||
|
windowID: WindowID, /**< The associated window */
|
||||||
|
data1: Sint32, /**< event dependent data */
|
||||||
|
data2: Sint32, /**< event dependent data */
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyboardDeviceEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED */
|
||||||
|
which: KeyboardID, /**< The keyboard instance id */
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyboardEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP */
|
||||||
|
windowID: WindowID, /**< The window with keyboard focus, if any */
|
||||||
|
which: KeyboardID, /**< The keyboard instance id, or 0 if unknown or virtual */
|
||||||
|
scancode: Scancode, /**< SDL physical key code */
|
||||||
|
key: Keycode, /**< SDL virtual key code */
|
||||||
|
mod: 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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditingEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_TEXT_EDITING */
|
||||||
|
windowID: WindowID, /**< The window with keyboard focus, if any */
|
||||||
|
text: cstring, /**< 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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditingCandidatesEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_TEXT_EDITING_CANDIDATES */
|
||||||
|
windowID: WindowID, /**< The window with keyboard focus, if any */
|
||||||
|
candidates: [^]cstring `fmt:"v,num_candidates"`, /**< 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 */
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
}
|
||||||
|
|
||||||
|
TextInputEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_TEXT_INPUT */
|
||||||
|
windowID: WindowID, /**< The window with keyboard focus, if any */
|
||||||
|
text: cstring, /**< The input text, UTF-8 encoded */
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseDeviceEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_MOUSE_ADDED or SDL_EVENT_MOUSE_REMOVED */
|
||||||
|
which: MouseID, /**< The mouse instance id */
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseMotionEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_MOUSE_MOTION */
|
||||||
|
windowID: WindowID, /**< The window with mouse focus, if any */
|
||||||
|
which: MouseID, /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0 */
|
||||||
|
state: MouseButtonFlags, /**< The current button state */
|
||||||
|
x: f32, /**< X coordinate, relative to window */
|
||||||
|
y: f32, /**< Y coordinate, relative to window */
|
||||||
|
xrel: f32, /**< The relative motion in the X direction */
|
||||||
|
yrel: f32, /**< The relative motion in the Y direction */
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseButtonEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_MOUSE_BUTTON_DOWN or SDL_EVENT_MOUSE_BUTTON_UP */
|
||||||
|
windowID: WindowID, /**< The window with mouse focus, if any */
|
||||||
|
which: 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. */
|
||||||
|
_: Uint8,
|
||||||
|
x: f32, /**< X coordinate, relative to window */
|
||||||
|
y: f32, /**< Y coordinate, relative to window */
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseWheelEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_MOUSE_WHEEL */
|
||||||
|
windowID: WindowID, /**< The window with mouse focus, if any */
|
||||||
|
which: MouseID, /**< The mouse instance id in relative mode or 0 */
|
||||||
|
x: f32, /**< The amount scrolled horizontally, positive to the right and negative to the left */
|
||||||
|
y: f32, /**< The amount scrolled vertically, positive away from the user and negative toward the user */
|
||||||
|
direction: 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: f32, /**< X coordinate, relative to window */
|
||||||
|
mouse_y: f32, /**< Y coordinate, relative to window */
|
||||||
|
}
|
||||||
|
|
||||||
|
JoyAxisEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_JOYSTICK_AXIS_MOTION */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
axis: Uint8, /**< The joystick axis index */
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
value: Sint16, /**< The axis value (range: -32768 to 32767) */
|
||||||
|
_: Uint16,
|
||||||
|
}
|
||||||
|
|
||||||
|
JoyBallEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_JOYSTICK_BALL_MOTION */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
ball: Uint8, /**< The joystick trackball index */
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
xrel: Sint16, /**< The relative motion in the X direction */
|
||||||
|
yrel: Sint16, /**< The relative motion in the Y direction */
|
||||||
|
}
|
||||||
|
|
||||||
|
JoyHatEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_JOYSTICK_HAT_MOTION */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
hat: Uint8, /**< The joystick hat index */
|
||||||
|
value: Uint8, /**< 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.
|
||||||
|
*/
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
}
|
||||||
|
|
||||||
|
JoyButtonEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_JOYSTICK_BUTTON_DOWN or SDL_EVENT_JOYSTICK_BUTTON_UP */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
button: Uint8, /**< The joystick button index */
|
||||||
|
down: bool, /**< true if the button is pressed */
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
}
|
||||||
|
|
||||||
|
JoyDeviceEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_JOYSTICK_ADDED or SDL_EVENT_JOYSTICK_REMOVED or SDL_EVENT_JOYSTICK_UPDATE_COMPLETE */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
}
|
||||||
|
|
||||||
|
JoyBatteryEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_JOYSTICK_BATTERY_UPDATED */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
state: PowerState, /**< The joystick battery state */
|
||||||
|
percent: c.int, /**< The joystick battery percent charge remaining */
|
||||||
|
}
|
||||||
|
|
||||||
|
GamepadAxisEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_GAMEPAD_AXIS_MOTION */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
axis: Uint8, /**< The gamepad axis (SDL_GamepadAxis) */
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
value: Sint16, /**< The axis value (range: -32768 to 32767) */
|
||||||
|
_: Uint16,
|
||||||
|
}
|
||||||
|
|
||||||
|
GamepadButtonEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_GAMEPAD_BUTTON_DOWN or SDL_EVENT_GAMEPAD_BUTTON_UP */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
button: Uint8, /**< The gamepad button (SDL_GamepadButton) */
|
||||||
|
down: bool, /**< true if the button is pressed */
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
}
|
||||||
|
|
||||||
|
GamepadDeviceEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< 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 */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
}
|
||||||
|
|
||||||
|
GamepadTouchpadEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or SDL_EVENT_GAMEPAD_TOUCHPAD_UP */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
touchpad: Sint32, /**< The index of the touchpad */
|
||||||
|
finger: Sint32, /**< The index of the finger on the touchpad */
|
||||||
|
x: f32, /**< Normalized in the range 0...1 with 0 being on the left */
|
||||||
|
y: f32, /**< Normalized in the range 0...1 with 0 being at the top */
|
||||||
|
pressure: f32, /**< Normalized in the range 0...1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
GamepadSensorEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_GAMEPAD_SENSOR_UPDATE */
|
||||||
|
which: JoystickID, /**< The joystick instance id */
|
||||||
|
sensor: Sint32, /**< The type of the sensor, one of the values of SDL_SensorType */
|
||||||
|
data: [3]f32, /**< 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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioDeviceEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_AUDIO_DEVICE_ADDED, or SDL_EVENT_AUDIO_DEVICE_REMOVED, or SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED */
|
||||||
|
which: AudioDeviceID, /**< SDL_AudioDeviceID for the device being added or removed or changing */
|
||||||
|
recording: bool, /**< false if a playback device, true if a recording device. */
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
_: Uint8,
|
||||||
|
}
|
||||||
|
|
||||||
|
CameraDeviceEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, SDL_EVENT_CAMERA_DEVICE_DENIED */
|
||||||
|
which: CameraID, /**< SDL_CameraID for the device being added or removed or changing */
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_RENDER_TARGETS_RESET, SDL_EVENT_RENDER_DEVICE_RESET, SDL_EVENT_RENDER_DEVICE_LOST */
|
||||||
|
windowID: WindowID, /**< The window containing the renderer in question. */
|
||||||
|
}
|
||||||
|
|
||||||
|
TouchFingerEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_MOTION, or SDL_EVENT_FINGER_CANCELED */
|
||||||
|
touchID: TouchID, /**< The touch device id */
|
||||||
|
fingerID: FingerID,
|
||||||
|
x: f32, /**< Normalized in the range 0...1 */
|
||||||
|
y: f32, /**< Normalized in the range 0...1 */
|
||||||
|
dx: f32, /**< Normalized in the range -1...1 */
|
||||||
|
dy: f32, /**< Normalized in the range -1...1 */
|
||||||
|
pressure: f32, /**< Normalized in the range 0...1 */
|
||||||
|
windowID: WindowID, /**< The window underneath the finger, if any */
|
||||||
|
}
|
||||||
|
|
||||||
|
PenProximityEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */
|
||||||
|
windowID: WindowID, /**< The window with pen focus, if any */
|
||||||
|
which: PenID, /**< The pen instance id */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PenMotionEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_PEN_MOTION */
|
||||||
|
windowID: WindowID, /**< The window with pen focus, if any */
|
||||||
|
which: PenID, /**< The pen instance id */
|
||||||
|
pen_state: PenInputFlags, /**< Complete pen input state at time of event */
|
||||||
|
x: f32, /**< X coordinate, relative to window */
|
||||||
|
y: f32, /**< Y coordinate, relative to window */
|
||||||
|
}
|
||||||
|
|
||||||
|
PenTouchEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */
|
||||||
|
windowID: WindowID, /**< The window with pen focus, if any */
|
||||||
|
which: PenID, /**< The pen instance id */
|
||||||
|
pen_state: PenInputFlags, /**< Complete pen input state at time of event */
|
||||||
|
x: f32, /**< X coordinate, relative to window */
|
||||||
|
y: f32, /**< 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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
PenButtonEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */
|
||||||
|
windowID: WindowID, /**< The window with mouse focus, if any */
|
||||||
|
which: PenID, /**< The pen instance id */
|
||||||
|
pen_state: PenInputFlags, /**< Complete pen input state at time of event */
|
||||||
|
x: f32, /**< X coordinate, relative to window */
|
||||||
|
y: f32, /**< Y coordinate, relative to window */
|
||||||
|
button: Uint8, /**< The pen button index (first button is 1). */
|
||||||
|
down: bool, /**< true if the button is pressed */
|
||||||
|
}
|
||||||
|
|
||||||
|
PenAxisEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_PEN_AXIS */
|
||||||
|
windowID: WindowID, /**< The window with pen focus, if any */
|
||||||
|
which: PenID, /**< The pen instance id */
|
||||||
|
pen_state: PenInputFlags, /**< Complete pen input state at time of event */
|
||||||
|
x: f32, /**< X coordinate, relative to window */
|
||||||
|
y: f32, /**< Y coordinate, relative to window */
|
||||||
|
axis: PenAxis, /**< Axis that has changed */
|
||||||
|
value: f32, /**< New value of axis */
|
||||||
|
}
|
||||||
|
|
||||||
|
DropEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_DROP_BEGIN or SDL_EVENT_DROP_FILE or SDL_EVENT_DROP_TEXT or SDL_EVENT_DROP_COMPLETE or SDL_EVENT_DROP_POSITION */
|
||||||
|
windowID: WindowID, /**< The window that was dropped on, if any */
|
||||||
|
x: f32, /**< X coordinate, relative to window (not on begin) */
|
||||||
|
y: f32, /**< Y coordinate, relative to window (not on begin) */
|
||||||
|
source: cstring, /**< The source app that sent this drop event, or NULL if that isn't available */
|
||||||
|
data: cstring, /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
|
||||||
|
}
|
||||||
|
|
||||||
|
ClipboardEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_CLIPBOARD_UPDATE */
|
||||||
|
owner: bool, /**< are we owning the clipboard (internal update) */
|
||||||
|
num_mime_types: Sint32, /**< number of mime types */
|
||||||
|
mime_types: [^]cstring `fmt:"v,num_mime_types"`, /**< current mime types */
|
||||||
|
}
|
||||||
|
|
||||||
|
SensorEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_SENSOR_UPDATE */
|
||||||
|
which: SensorID, /**< The instance ID of the sensor */
|
||||||
|
data: [6]f32, /**< 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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
QuitEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_QUIT */
|
||||||
|
}
|
||||||
|
|
||||||
|
UserEvent :: struct {
|
||||||
|
using commonEvent: CommonEvent, /**< SDL_EVENT_USER through SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration */
|
||||||
|
windowID: WindowID, /**< The associated window if any */
|
||||||
|
code: Sint32, /**< User defined event code */
|
||||||
|
data1: rawptr, /**< User defined data pointer */
|
||||||
|
data2: rawptr, /**< User defined data pointer */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Event :: struct #raw_union {
|
||||||
|
type: EventType, /**< Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration */
|
||||||
|
common: CommonEvent, /**< Common event data */
|
||||||
|
display: DisplayEvent, /**< Display event data */
|
||||||
|
window: WindowEvent, /**< Window event data */
|
||||||
|
kdevice: KeyboardDeviceEvent, /**< Keyboard device change event data */
|
||||||
|
key: KeyboardEvent, /**< Keyboard event data */
|
||||||
|
edit: TextEditingEvent, /**< Text editing event data */
|
||||||
|
edit_candidates: TextEditingCandidatesEvent, /**< Text editing candidates event data */
|
||||||
|
text: TextInputEvent, /**< Text input event data */
|
||||||
|
mdevice: MouseDeviceEvent, /**< Mouse device change event data */
|
||||||
|
motion: MouseMotionEvent, /**< Mouse motion event data */
|
||||||
|
button: MouseButtonEvent, /**< Mouse button event data */
|
||||||
|
wheel: MouseWheelEvent, /**< Mouse wheel event data */
|
||||||
|
jdevice: JoyDeviceEvent, /**< Joystick device change event data */
|
||||||
|
jaxis: JoyAxisEvent, /**< Joystick axis event data */
|
||||||
|
jball: JoyBallEvent, /**< Joystick ball event data */
|
||||||
|
jhat: JoyHatEvent, /**< Joystick hat event data */
|
||||||
|
jbutton: JoyButtonEvent, /**< Joystick button event data */
|
||||||
|
jbattery: JoyBatteryEvent, /**< Joystick battery event data */
|
||||||
|
gdevice: GamepadDeviceEvent, /**< Gamepad device event data */
|
||||||
|
gaxis: GamepadAxisEvent, /**< Gamepad axis event data */
|
||||||
|
gbutton: GamepadButtonEvent, /**< Gamepad button event data */
|
||||||
|
gtouchpad: GamepadTouchpadEvent, /**< Gamepad touchpad event data */
|
||||||
|
gsensor: GamepadSensorEvent, /**< Gamepad sensor event data */
|
||||||
|
adevice: AudioDeviceEvent, /**< Audio device event data */
|
||||||
|
cdevice: CameraDeviceEvent, /**< Camera device event data */
|
||||||
|
sensor: SensorEvent, /**< Sensor event data */
|
||||||
|
quit: QuitEvent, /**< Quit request event data */
|
||||||
|
user: UserEvent, /**< Custom event data */
|
||||||
|
tfinger: TouchFingerEvent, /**< Touch finger event data */
|
||||||
|
pproximity: PenProximityEvent, /**< Pen proximity event data */
|
||||||
|
ptouch: PenTouchEvent, /**< Pen tip touching event data */
|
||||||
|
pmotion: PenMotionEvent, /**< Pen motion event data */
|
||||||
|
pbutton: PenButtonEvent, /**< Pen button event data */
|
||||||
|
paxis: PenAxisEvent, /**< Pen axis event data */
|
||||||
|
render: RenderEvent, /**< Render event data */
|
||||||
|
drop: DropEvent, /**< Drag and drop event data */
|
||||||
|
clipboard: 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 _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,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#assert(size_of(Event) == size_of(Event{}.padding))
|
||||||
|
|
||||||
|
EventAction :: enum c.int {
|
||||||
|
ADDEVENT, /**< Add events to the back of the queue. */
|
||||||
|
PEEKEVENT, /**< Check but don't remove events from the queue front. */
|
||||||
|
GETEVENT, /**< Retrieve/remove events from the front of the queue. */
|
||||||
|
}
|
||||||
|
|
||||||
|
EventFilter :: proc "c" (userdata: rawptr, event: ^Event) -> bool
|
||||||
|
|
||||||
|
|
||||||
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
|
foreign lib {
|
||||||
|
PumpEvents :: proc() ---
|
||||||
|
PeepEvents :: proc(events: [^]Event, numevents: c.int, action: EventAction, minType, maxType: EventType) -> int ---
|
||||||
|
HasEvent :: proc(type: EventType) -> bool ---
|
||||||
|
HasEvents :: proc(minType, maxType: EventType) -> bool ---
|
||||||
|
FlushEvent :: proc(type: EventType) ---
|
||||||
|
FlushEvents :: proc(minType, maxType: EventType) ---
|
||||||
|
PollEvent :: proc(event: ^Event) -> bool ---
|
||||||
|
WaitEvent :: proc(event: ^Event) -> bool ---
|
||||||
|
WaitEventTimeout :: proc(event: ^Event, timeoutMS: Sint32) -> bool ---
|
||||||
|
PushEvent :: proc(event: ^Event) -> bool ---
|
||||||
|
SetEventFilter :: proc(filter: EventFilter, userdata: rawptr) ---
|
||||||
|
GetEventFilter :: proc(filter: ^EventFilter, userdata: ^rawptr) -> bool ---
|
||||||
|
AddEventWatch :: proc(filter: EventFilter, userdata: rawptr) -> bool ---
|
||||||
|
RemoveEventWatch :: proc(filter: EventFilter, userdata: rawptr) ---
|
||||||
|
FilterEvents :: proc(filter: EventFilter, userdata: rawptr) ---
|
||||||
|
SetEventEnabled :: proc(type: EventType, enabled: bool) ---
|
||||||
|
EventEnabled :: proc(type: EventType) -> bool ---
|
||||||
|
RegisterEvents :: proc(numevents: c.int) -> Uint32 ---
|
||||||
|
GetWindowFromEvent :: proc(#by_ptr event: Event) -> ^Window ---
|
||||||
|
}
|
||||||
Vendored
+2
-2
@@ -776,7 +776,7 @@ PROP_GPU_TEXTURE_CREATE_NAME_STRING :: "SDL.gpu.texture.create.nam
|
|||||||
PROP_GPU_BUFFER_CREATE_NAME_STRING :: "SDL.gpu.buffer.create.name"
|
PROP_GPU_BUFFER_CREATE_NAME_STRING :: "SDL.gpu.buffer.create.name"
|
||||||
PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING :: "SDL.gpu.transferbuffer.create.name"
|
PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING :: "SDL.gpu.transferbuffer.create.name"
|
||||||
|
|
||||||
@(default_calling_convention="c", link_prefix="", require_results)
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
foreign lib {
|
foreign lib {
|
||||||
GPUSupportsShaderFormats :: proc(format_flags: GPUShaderFormat, name: cstring) -> bool ---
|
GPUSupportsShaderFormats :: proc(format_flags: GPUShaderFormat, name: cstring) -> bool ---
|
||||||
GPUSupportsProperties :: proc(props: PropertiesID) -> bool ---
|
GPUSupportsProperties :: proc(props: PropertiesID) -> bool ---
|
||||||
@@ -876,7 +876,7 @@ foreign lib {
|
|||||||
|
|
||||||
|
|
||||||
// GDK
|
// GDK
|
||||||
@(default_calling_convention="c", link_prefix="")
|
@(default_calling_convention="c", link_prefix="SDL_")
|
||||||
foreign lib {
|
foreign lib {
|
||||||
GDKSuspendGPU :: proc(device: ^GPUDevice) ---
|
GDKSuspendGPU :: proc(device: ^GPUDevice) ---
|
||||||
GDKResumeGPU :: proc(device: ^GPUDevice) ---
|
GDKResumeGPU :: proc(device: ^GPUDevice) ---
|
||||||
|
|||||||
Vendored
+1
-1
@@ -197,7 +197,7 @@ HapticEffect :: struct #raw_union {
|
|||||||
HapticID :: distinct Uint32
|
HapticID :: distinct Uint32
|
||||||
|
|
||||||
|
|
||||||
@(default_calling_convention="c", link_prefix="", require_results)
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
foreign lib {
|
foreign lib {
|
||||||
GetHaptics :: proc(count: ^c.int) -> ^HapticID ---
|
GetHaptics :: proc(count: ^c.int) -> ^HapticID ---
|
||||||
GetHapticNameForID :: proc(instance_id: HapticID) -> cstring ---
|
GetHapticNameForID :: proc(instance_id: HapticID) -> cstring ---
|
||||||
|
|||||||
Vendored
+1
-1
@@ -76,7 +76,7 @@ hid_device_info :: struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@(default_calling_convention="c", link_prefix="", require_results)
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
foreign lib {
|
foreign lib {
|
||||||
hid_init :: proc() -> c.int ---
|
hid_init :: proc() -> c.int ---
|
||||||
hid_exit :: proc() -> c.int ---
|
hid_exit :: proc() -> c.int ---
|
||||||
|
|||||||
Vendored
+59
@@ -0,0 +1,59 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
|
KeyboardID :: distinct Uint32
|
||||||
|
|
||||||
|
TextInputType :: enum c.int {
|
||||||
|
TEXT, /**< The input is text */
|
||||||
|
TEXT_NAME, /**< The input is a person's name */
|
||||||
|
TEXT_EMAIL, /**< The input is an e-mail address */
|
||||||
|
TEXT_USERNAME, /**< The input is a username */
|
||||||
|
TEXT_PASSWORD_HIDDEN, /**< The input is a secure password that is hidden */
|
||||||
|
TEXT_PASSWORD_VISIBLE, /**< The input is a secure password that is visible */
|
||||||
|
NUMBER, /**< The input is a number */
|
||||||
|
NUMBER_PASSWORD_HIDDEN, /**< The input is a secure PIN that is hidden */
|
||||||
|
NUMBER_PASSWORD_VISIBLE, /**< The input is a secure PIN that is visible */
|
||||||
|
}
|
||||||
|
|
||||||
|
Capitalization :: enum c.int {
|
||||||
|
NONE, /**< No auto-capitalization will be done */
|
||||||
|
SENTENCES, /**< The first letter of sentences will be capitalized */
|
||||||
|
WORDS, /**< The first letter of words will be capitalized */
|
||||||
|
LETTERS, /**< All letters will be capitalized */
|
||||||
|
}
|
||||||
|
|
||||||
|
PROP_TEXTINPUT_TYPE_NUMBER :: "SDL.textinput.type"
|
||||||
|
PROP_TEXTINPUT_CAPITALIZATION_NUMBER :: "SDL.textinput.capitalization"
|
||||||
|
PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN :: "SDL.textinput.autocorrect"
|
||||||
|
PROP_TEXTINPUT_MULTILINE_BOOLEAN :: "SDL.textinput.multiline"
|
||||||
|
PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER :: "SDL.textinput.android.inputtype"
|
||||||
|
|
||||||
|
|
||||||
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
|
foreign lib {
|
||||||
|
HasKeyboard :: proc() -> bool ---
|
||||||
|
GetKeyboards :: proc(count: ^c.int) -> [^]KeyboardID ---
|
||||||
|
GetKeyboardNameForID :: proc(instance_id: KeyboardID) -> cstring ---
|
||||||
|
GetKeyboardFocus :: proc() -> ^Window ---
|
||||||
|
GetKeyboardState :: proc(numkeys: ^c.int) -> [^]bool ---
|
||||||
|
ResetKeyboard :: proc() ---
|
||||||
|
GetModState :: proc() -> Keymod ---
|
||||||
|
SetModState :: proc(modstate: Keymod) ---
|
||||||
|
GetKeyFromScancode :: proc(scancode: Scancode, modstate: Keymod, key_event: bool) -> Keycode ---
|
||||||
|
GetScancodeFromKey :: proc(key: Keycode, modstate: ^Keymod) -> Scancode ---
|
||||||
|
SetScancodeName :: proc(scancode: Scancode, name: cstring) -> bool ---
|
||||||
|
GetScancodeName :: proc(scancode: Scancode) -> cstring ---
|
||||||
|
GetScancodeFromName :: proc(name: cstring) -> Scancode ---
|
||||||
|
GetKeyName :: proc(key: Keycode) -> cstring ---
|
||||||
|
GetKeyFromName :: proc(name: cstring) -> Keycode ---
|
||||||
|
StartTextInput :: proc(window: ^Window) -> bool ---
|
||||||
|
StartTextInputWithProperties :: proc(window: ^Window, props: PropertiesID) -> bool ---
|
||||||
|
TextInputActive :: proc(window: ^Window) -> bool ---
|
||||||
|
StopTextInput :: proc(window: ^Window) -> bool ---
|
||||||
|
ClearComposition :: proc(window: ^Window) -> bool ---
|
||||||
|
SetTextInputArea :: proc(window: ^Window, #by_ptr rect: Rect, cursor: c.int) -> bool ---
|
||||||
|
GetTextInputArea :: proc(window: ^Window, rect: ^Rect, cursor: ^c.int) -> bool ---
|
||||||
|
HasScreenKeyboardSupport :: proc() -> bool ---
|
||||||
|
ScreenKeyboardShown :: proc(window: ^Window) -> bool ---
|
||||||
|
}
|
||||||
Vendored
+306
@@ -0,0 +1,306 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
Keycode :: distinct Uint32
|
||||||
|
|
||||||
|
@(require_results)
|
||||||
|
SCANCODE_TO_KEYCODE :: #force_inline proc "c" (X: Scancode) -> Keycode {
|
||||||
|
return Keycode(X) | K_SCANCODE_MASK
|
||||||
|
}
|
||||||
|
|
||||||
|
K_EXTENDED_MASK :: 1 << 29
|
||||||
|
K_SCANCODE_MASK :: 1 << 30
|
||||||
|
K_UNKNOWN :: 0x00000000 /**< 0 */
|
||||||
|
K_RETURN :: 0x0000000d /**< '\r' */
|
||||||
|
K_ESCAPE :: 0x0000001b /**< '\x1B' */
|
||||||
|
K_BACKSPACE :: 0x00000008 /**< '\b' */
|
||||||
|
K_TAB :: 0x00000009 /**< '\t' */
|
||||||
|
K_SPACE :: 0x00000020 /**< ' ' */
|
||||||
|
K_EXCLAIM :: 0x00000021 /**< '!' */
|
||||||
|
K_DBLAPOSTROPHE :: 0x00000022 /**< '"' */
|
||||||
|
K_HASH :: 0x00000023 /**< '#' */
|
||||||
|
K_DOLLAR :: 0x00000024 /**< '$' */
|
||||||
|
K_PERCENT :: 0x00000025 /**< '%' */
|
||||||
|
K_AMPERSAND :: 0x00000026 /**< '&' */
|
||||||
|
K_APOSTROPHE :: 0x00000027 /**< '\'' */
|
||||||
|
K_LEFTPAREN :: 0x00000028 /**< '(' */
|
||||||
|
K_RIGHTPAREN :: 0x00000029 /**< ')' */
|
||||||
|
K_ASTERISK :: 0x0000002a /**< '*' */
|
||||||
|
K_PLUS :: 0x0000002b /**< '+' */
|
||||||
|
K_COMMA :: 0x0000002c /**< ',' */
|
||||||
|
K_MINUS :: 0x0000002d /**< '-' */
|
||||||
|
K_PERIOD :: 0x0000002e /**< '.' */
|
||||||
|
K_SLASH :: 0x0000002f /**< '/' */
|
||||||
|
K_0 :: 0x00000030 /**< '0' */
|
||||||
|
K_1 :: 0x00000031 /**< '1' */
|
||||||
|
K_2 :: 0x00000032 /**< '2' */
|
||||||
|
K_3 :: 0x00000033 /**< '3' */
|
||||||
|
K_4 :: 0x00000034 /**< '4' */
|
||||||
|
K_5 :: 0x00000035 /**< '5' */
|
||||||
|
K_6 :: 0x00000036 /**< '6' */
|
||||||
|
K_7 :: 0x00000037 /**< '7' */
|
||||||
|
K_8 :: 0x00000038 /**< '8' */
|
||||||
|
K_9 :: 0x00000039 /**< '9' */
|
||||||
|
K_COLON :: 0x0000003a /**< ':' */
|
||||||
|
K_SEMICOLON :: 0x0000003b /**< ';' */
|
||||||
|
K_LESS :: 0x0000003c /**< '<' */
|
||||||
|
K_EQUALS :: 0x0000003d /**< '=' */
|
||||||
|
K_GREATER :: 0x0000003e /**< '>' */
|
||||||
|
K_QUESTION :: 0x0000003f /**< '?' */
|
||||||
|
K_AT :: 0x00000040 /**< '@' */
|
||||||
|
K_LEFTBRACKET :: 0x0000005b /**< '[' */
|
||||||
|
K_BACKSLASH :: 0x0000005c /**< '\\' */
|
||||||
|
K_RIGHTBRACKET :: 0x0000005d /**< ']' */
|
||||||
|
K_CARET :: 0x0000005e /**< '^' */
|
||||||
|
K_UNDERSCORE :: 0x0000005f /**< '_' */
|
||||||
|
K_GRAVE :: 0x00000060 /**< '`' */
|
||||||
|
K_A :: 0x00000061 /**< 'a' */
|
||||||
|
K_B :: 0x00000062 /**< 'b' */
|
||||||
|
K_C :: 0x00000063 /**< 'c' */
|
||||||
|
K_D :: 0x00000064 /**< 'd' */
|
||||||
|
K_E :: 0x00000065 /**< 'e' */
|
||||||
|
K_F :: 0x00000066 /**< 'f' */
|
||||||
|
K_G :: 0x00000067 /**< 'g' */
|
||||||
|
K_H :: 0x00000068 /**< 'h' */
|
||||||
|
K_I :: 0x00000069 /**< 'i' */
|
||||||
|
K_J :: 0x0000006a /**< 'j' */
|
||||||
|
K_K :: 0x0000006b /**< 'k' */
|
||||||
|
K_L :: 0x0000006c /**< 'l' */
|
||||||
|
K_M :: 0x0000006d /**< 'm' */
|
||||||
|
K_N :: 0x0000006e /**< 'n' */
|
||||||
|
K_O :: 0x0000006f /**< 'o' */
|
||||||
|
K_P :: 0x00000070 /**< 'p' */
|
||||||
|
K_Q :: 0x00000071 /**< 'q' */
|
||||||
|
K_R :: 0x00000072 /**< 'r' */
|
||||||
|
K_S :: 0x00000073 /**< 's' */
|
||||||
|
K_T :: 0x00000074 /**< 't' */
|
||||||
|
K_U :: 0x00000075 /**< 'u' */
|
||||||
|
K_V :: 0x00000076 /**< 'v' */
|
||||||
|
K_W :: 0x00000077 /**< 'w' */
|
||||||
|
K_X :: 0x00000078 /**< 'x' */
|
||||||
|
K_Y :: 0x00000079 /**< 'y' */
|
||||||
|
K_Z :: 0x0000007a /**< 'z' */
|
||||||
|
K_LEFTBRACE :: 0x0000007b /**< '{' */
|
||||||
|
K_PIPE :: 0x0000007c /**< '|' */
|
||||||
|
K_RIGHTBRACE :: 0x0000007d /**< '}' */
|
||||||
|
K_TILDE :: 0x0000007e /**< '~' */
|
||||||
|
K_DELETE :: 0x0000007f /**< '\x7F' */
|
||||||
|
K_PLUSMINUS :: 0x000000b1 /**< '\xB1' */
|
||||||
|
K_CAPSLOCK :: 0x40000039 /**< SCANCODE_TO_KEYCODE(.CAPSLOCK) */
|
||||||
|
K_F1 :: 0x4000003a /**< SCANCODE_TO_KEYCODE(.F1) */
|
||||||
|
K_F2 :: 0x4000003b /**< SCANCODE_TO_KEYCODE(.F2) */
|
||||||
|
K_F3 :: 0x4000003c /**< SCANCODE_TO_KEYCODE(.F3) */
|
||||||
|
K_F4 :: 0x4000003d /**< SCANCODE_TO_KEYCODE(.F4) */
|
||||||
|
K_F5 :: 0x4000003e /**< SCANCODE_TO_KEYCODE(.F5) */
|
||||||
|
K_F6 :: 0x4000003f /**< SCANCODE_TO_KEYCODE(.F6) */
|
||||||
|
K_F7 :: 0x40000040 /**< SCANCODE_TO_KEYCODE(.F7) */
|
||||||
|
K_F8 :: 0x40000041 /**< SCANCODE_TO_KEYCODE(.F8) */
|
||||||
|
K_F9 :: 0x40000042 /**< SCANCODE_TO_KEYCODE(.F9) */
|
||||||
|
K_F10 :: 0x40000043 /**< SCANCODE_TO_KEYCODE(.F10) */
|
||||||
|
K_F11 :: 0x40000044 /**< SCANCODE_TO_KEYCODE(.F11) */
|
||||||
|
K_F12 :: 0x40000045 /**< SCANCODE_TO_KEYCODE(.F12) */
|
||||||
|
K_PRINTSCREEN :: 0x40000046 /**< SCANCODE_TO_KEYCODE(.PRINTSCREEN) */
|
||||||
|
K_SCROLLLOCK :: 0x40000047 /**< SCANCODE_TO_KEYCODE(.SCROLLLOCK) */
|
||||||
|
K_PAUSE :: 0x40000048 /**< SCANCODE_TO_KEYCODE(.PAUSE) */
|
||||||
|
K_INSERT :: 0x40000049 /**< SCANCODE_TO_KEYCODE(.INSERT) */
|
||||||
|
K_HOME :: 0x4000004a /**< SCANCODE_TO_KEYCODE(.HOME) */
|
||||||
|
K_PAGEUP :: 0x4000004b /**< SCANCODE_TO_KEYCODE(.PAGEUP) */
|
||||||
|
K_END :: 0x4000004d /**< SCANCODE_TO_KEYCODE(.END) */
|
||||||
|
K_PAGEDOWN :: 0x4000004e /**< SCANCODE_TO_KEYCODE(.PAGEDOWN) */
|
||||||
|
K_RIGHT :: 0x4000004f /**< SCANCODE_TO_KEYCODE(.RIGHT) */
|
||||||
|
K_LEFT :: 0x40000050 /**< SCANCODE_TO_KEYCODE(.LEFT) */
|
||||||
|
K_DOWN :: 0x40000051 /**< SCANCODE_TO_KEYCODE(.DOWN) */
|
||||||
|
K_UP :: 0x40000052 /**< SCANCODE_TO_KEYCODE(.UP) */
|
||||||
|
K_NUMLOCKCLEAR :: 0x40000053 /**< SCANCODE_TO_KEYCODE(.NUMLOCKCLEAR) */
|
||||||
|
K_KP_DIVIDE :: 0x40000054 /**< SCANCODE_TO_KEYCODE(.KP_DIVIDE) */
|
||||||
|
K_KP_MULTIPLY :: 0x40000055 /**< SCANCODE_TO_KEYCODE(.KP_MULTIPLY) */
|
||||||
|
K_KP_MINUS :: 0x40000056 /**< SCANCODE_TO_KEYCODE(.KP_MINUS) */
|
||||||
|
K_KP_PLUS :: 0x40000057 /**< SCANCODE_TO_KEYCODE(.KP_PLUS) */
|
||||||
|
K_KP_ENTER :: 0x40000058 /**< SCANCODE_TO_KEYCODE(.KP_ENTER) */
|
||||||
|
K_KP_1 :: 0x40000059 /**< SCANCODE_TO_KEYCODE(.KP_1) */
|
||||||
|
K_KP_2 :: 0x4000005a /**< SCANCODE_TO_KEYCODE(.KP_2) */
|
||||||
|
K_KP_3 :: 0x4000005b /**< SCANCODE_TO_KEYCODE(.KP_3) */
|
||||||
|
K_KP_4 :: 0x4000005c /**< SCANCODE_TO_KEYCODE(.KP_4) */
|
||||||
|
K_KP_5 :: 0x4000005d /**< SCANCODE_TO_KEYCODE(.KP_5) */
|
||||||
|
K_KP_6 :: 0x4000005e /**< SCANCODE_TO_KEYCODE(.KP_6) */
|
||||||
|
K_KP_7 :: 0x4000005f /**< SCANCODE_TO_KEYCODE(.KP_7) */
|
||||||
|
K_KP_8 :: 0x40000060 /**< SCANCODE_TO_KEYCODE(.KP_8) */
|
||||||
|
K_KP_9 :: 0x40000061 /**< SCANCODE_TO_KEYCODE(.KP_9) */
|
||||||
|
K_KP_0 :: 0x40000062 /**< SCANCODE_TO_KEYCODE(.KP_0) */
|
||||||
|
K_KP_PERIOD :: 0x40000063 /**< SCANCODE_TO_KEYCODE(.KP_PERIOD) */
|
||||||
|
K_APPLICATION :: 0x40000065 /**< SCANCODE_TO_KEYCODE(.APPLICATION) */
|
||||||
|
K_POWER :: 0x40000066 /**< SCANCODE_TO_KEYCODE(.POWER) */
|
||||||
|
K_KP_EQUALS :: 0x40000067 /**< SCANCODE_TO_KEYCODE(.KP_EQUALS) */
|
||||||
|
K_F13 :: 0x40000068 /**< SCANCODE_TO_KEYCODE(.F13) */
|
||||||
|
K_F14 :: 0x40000069 /**< SCANCODE_TO_KEYCODE(.F14) */
|
||||||
|
K_F15 :: 0x4000006a /**< SCANCODE_TO_KEYCODE(.F15) */
|
||||||
|
K_F16 :: 0x4000006b /**< SCANCODE_TO_KEYCODE(.F16) */
|
||||||
|
K_F17 :: 0x4000006c /**< SCANCODE_TO_KEYCODE(.F17) */
|
||||||
|
K_F18 :: 0x4000006d /**< SCANCODE_TO_KEYCODE(.F18) */
|
||||||
|
K_F19 :: 0x4000006e /**< SCANCODE_TO_KEYCODE(.F19) */
|
||||||
|
K_F20 :: 0x4000006f /**< SCANCODE_TO_KEYCODE(.F20) */
|
||||||
|
K_F21 :: 0x40000070 /**< SCANCODE_TO_KEYCODE(.F21) */
|
||||||
|
K_F22 :: 0x40000071 /**< SCANCODE_TO_KEYCODE(.F22) */
|
||||||
|
K_F23 :: 0x40000072 /**< SCANCODE_TO_KEYCODE(.F23) */
|
||||||
|
K_F24 :: 0x40000073 /**< SCANCODE_TO_KEYCODE(.F24) */
|
||||||
|
K_EXECUTE :: 0x40000074 /**< SCANCODE_TO_KEYCODE(.EXECUTE) */
|
||||||
|
K_HELP :: 0x40000075 /**< SCANCODE_TO_KEYCODE(.HELP) */
|
||||||
|
K_MENU :: 0x40000076 /**< SCANCODE_TO_KEYCODE(.MENU) */
|
||||||
|
K_SELECT :: 0x40000077 /**< SCANCODE_TO_KEYCODE(.SELECT) */
|
||||||
|
K_STOP :: 0x40000078 /**< SCANCODE_TO_KEYCODE(.STOP) */
|
||||||
|
K_AGAIN :: 0x40000079 /**< SCANCODE_TO_KEYCODE(.AGAIN) */
|
||||||
|
K_UNDO :: 0x4000007a /**< SCANCODE_TO_KEYCODE(.UNDO) */
|
||||||
|
K_CUT :: 0x4000007b /**< SCANCODE_TO_KEYCODE(.CUT) */
|
||||||
|
K_COPY :: 0x4000007c /**< SCANCODE_TO_KEYCODE(.COPY) */
|
||||||
|
K_PASTE :: 0x4000007d /**< SCANCODE_TO_KEYCODE(.PASTE) */
|
||||||
|
K_FIND :: 0x4000007e /**< SCANCODE_TO_KEYCODE(.FIND) */
|
||||||
|
K_MUTE :: 0x4000007f /**< SCANCODE_TO_KEYCODE(.MUTE) */
|
||||||
|
K_VOLUMEUP :: 0x40000080 /**< SCANCODE_TO_KEYCODE(.VOLUMEUP) */
|
||||||
|
K_VOLUMEDOWN :: 0x40000081 /**< SCANCODE_TO_KEYCODE(.VOLUMEDOWN) */
|
||||||
|
K_KP_COMMA :: 0x40000085 /**< SCANCODE_TO_KEYCODE(.KP_COMMA) */
|
||||||
|
K_KP_EQUALSAS400 :: 0x40000086 /**< SCANCODE_TO_KEYCODE(.KP_EQUALSAS400) */
|
||||||
|
K_ALTERASE :: 0x40000099 /**< SCANCODE_TO_KEYCODE(.ALTERASE) */
|
||||||
|
K_SYSREQ :: 0x4000009a /**< SCANCODE_TO_KEYCODE(.SYSREQ) */
|
||||||
|
K_CANCEL :: 0x4000009b /**< SCANCODE_TO_KEYCODE(.CANCEL) */
|
||||||
|
K_CLEAR :: 0x4000009c /**< SCANCODE_TO_KEYCODE(.CLEAR) */
|
||||||
|
K_PRIOR :: 0x4000009d /**< SCANCODE_TO_KEYCODE(.PRIOR) */
|
||||||
|
K_RETURN2 :: 0x4000009e /**< SCANCODE_TO_KEYCODE(.RETURN2) */
|
||||||
|
K_SEPARATOR :: 0x4000009f /**< SCANCODE_TO_KEYCODE(.SEPARATOR) */
|
||||||
|
K_OUT :: 0x400000a0 /**< SCANCODE_TO_KEYCODE(.OUT) */
|
||||||
|
K_OPER :: 0x400000a1 /**< SCANCODE_TO_KEYCODE(.OPER) */
|
||||||
|
K_CLEARAGAIN :: 0x400000a2 /**< SCANCODE_TO_KEYCODE(.CLEARAGAIN) */
|
||||||
|
K_CRSEL :: 0x400000a3 /**< SCANCODE_TO_KEYCODE(.CRSEL) */
|
||||||
|
K_EXSEL :: 0x400000a4 /**< SCANCODE_TO_KEYCODE(.EXSEL) */
|
||||||
|
K_KP_00 :: 0x400000b0 /**< SCANCODE_TO_KEYCODE(.KP_00) */
|
||||||
|
K_KP_000 :: 0x400000b1 /**< SCANCODE_TO_KEYCODE(.KP_000) */
|
||||||
|
K_THOUSANDSSEPARATOR :: 0x400000b2 /**< SCANCODE_TO_KEYCODE(.THOUSANDSSEPARATOR) */
|
||||||
|
K_DECIMALSEPARATOR :: 0x400000b3 /**< SCANCODE_TO_KEYCODE(.DECIMALSEPARATOR) */
|
||||||
|
K_CURRENCYUNIT :: 0x400000b4 /**< SCANCODE_TO_KEYCODE(.CURRENCYUNIT) */
|
||||||
|
K_CURRENCYSUBUNIT :: 0x400000b5 /**< SCANCODE_TO_KEYCODE(.CURRENCYSUBUNIT) */
|
||||||
|
K_KP_LEFTPAREN :: 0x400000b6 /**< SCANCODE_TO_KEYCODE(.KP_LEFTPAREN) */
|
||||||
|
K_KP_RIGHTPAREN :: 0x400000b7 /**< SCANCODE_TO_KEYCODE(.KP_RIGHTPAREN) */
|
||||||
|
K_KP_LEFTBRACE :: 0x400000b8 /**< SCANCODE_TO_KEYCODE(.KP_LEFTBRACE) */
|
||||||
|
K_KP_RIGHTBRACE :: 0x400000b9 /**< SCANCODE_TO_KEYCODE(.KP_RIGHTBRACE) */
|
||||||
|
K_KP_TAB :: 0x400000ba /**< SCANCODE_TO_KEYCODE(.KP_TAB) */
|
||||||
|
K_KP_BACKSPACE :: 0x400000bb /**< SCANCODE_TO_KEYCODE(.KP_BACKSPACE) */
|
||||||
|
K_KP_A :: 0x400000bc /**< SCANCODE_TO_KEYCODE(.KP_A) */
|
||||||
|
K_KP_B :: 0x400000bd /**< SCANCODE_TO_KEYCODE(.KP_B) */
|
||||||
|
K_KP_C :: 0x400000be /**< SCANCODE_TO_KEYCODE(.KP_C) */
|
||||||
|
K_KP_D :: 0x400000bf /**< SCANCODE_TO_KEYCODE(.KP_D) */
|
||||||
|
K_KP_E :: 0x400000c0 /**< SCANCODE_TO_KEYCODE(.KP_E) */
|
||||||
|
K_KP_F :: 0x400000c1 /**< SCANCODE_TO_KEYCODE(.KP_F) */
|
||||||
|
K_KP_XOR :: 0x400000c2 /**< SCANCODE_TO_KEYCODE(.KP_XOR) */
|
||||||
|
K_KP_POWER :: 0x400000c3 /**< SCANCODE_TO_KEYCODE(.KP_POWER) */
|
||||||
|
K_KP_PERCENT :: 0x400000c4 /**< SCANCODE_TO_KEYCODE(.KP_PERCENT) */
|
||||||
|
K_KP_LESS :: 0x400000c5 /**< SCANCODE_TO_KEYCODE(.KP_LESS) */
|
||||||
|
K_KP_GREATER :: 0x400000c6 /**< SCANCODE_TO_KEYCODE(.KP_GREATER) */
|
||||||
|
K_KP_AMPERSAND :: 0x400000c7 /**< SCANCODE_TO_KEYCODE(.KP_AMPERSAND) */
|
||||||
|
K_KP_DBLAMPERSAND :: 0x400000c8 /**< SCANCODE_TO_KEYCODE(.KP_DBLAMPERSAND) */
|
||||||
|
K_KP_VERTICALBAR :: 0x400000c9 /**< SCANCODE_TO_KEYCODE(.KP_VERTICALBAR) */
|
||||||
|
K_KP_DBLVERTICALBAR :: 0x400000ca /**< SCANCODE_TO_KEYCODE(.KP_DBLVERTICALBAR) */
|
||||||
|
K_KP_COLON :: 0x400000cb /**< SCANCODE_TO_KEYCODE(.KP_COLON) */
|
||||||
|
K_KP_HASH :: 0x400000cc /**< SCANCODE_TO_KEYCODE(.KP_HASH) */
|
||||||
|
K_KP_SPACE :: 0x400000cd /**< SCANCODE_TO_KEYCODE(.KP_SPACE) */
|
||||||
|
K_KP_AT :: 0x400000ce /**< SCANCODE_TO_KEYCODE(.KP_AT) */
|
||||||
|
K_KP_EXCLAM :: 0x400000cf /**< SCANCODE_TO_KEYCODE(.KP_EXCLAM) */
|
||||||
|
K_KP_MEMSTORE :: 0x400000d0 /**< SCANCODE_TO_KEYCODE(.KP_MEMSTORE) */
|
||||||
|
K_KP_MEMRECALL :: 0x400000d1 /**< SCANCODE_TO_KEYCODE(.KP_MEMRECALL) */
|
||||||
|
K_KP_MEMCLEAR :: 0x400000d2 /**< SCANCODE_TO_KEYCODE(.KP_MEMCLEAR) */
|
||||||
|
K_KP_MEMADD :: 0x400000d3 /**< SCANCODE_TO_KEYCODE(.KP_MEMADD) */
|
||||||
|
K_KP_MEMSUBTRACT :: 0x400000d4 /**< SCANCODE_TO_KEYCODE(.KP_MEMSUBTRACT) */
|
||||||
|
K_KP_MEMMULTIPLY :: 0x400000d5 /**< SCANCODE_TO_KEYCODE(.KP_MEMMULTIPLY) */
|
||||||
|
K_KP_MEMDIVIDE :: 0x400000d6 /**< SCANCODE_TO_KEYCODE(.KP_MEMDIVIDE) */
|
||||||
|
K_KP_PLUSMINUS :: 0x400000d7 /**< SCANCODE_TO_KEYCODE(.KP_PLUSMINUS) */
|
||||||
|
K_KP_CLEAR :: 0x400000d8 /**< SCANCODE_TO_KEYCODE(.KP_CLEAR) */
|
||||||
|
K_KP_CLEARENTRY :: 0x400000d9 /**< SCANCODE_TO_KEYCODE(.KP_CLEARENTRY) */
|
||||||
|
K_KP_BINARY :: 0x400000da /**< SCANCODE_TO_KEYCODE(.KP_BINARY) */
|
||||||
|
K_KP_OCTAL :: 0x400000db /**< SCANCODE_TO_KEYCODE(.KP_OCTAL) */
|
||||||
|
K_KP_DECIMAL :: 0x400000dc /**< SCANCODE_TO_KEYCODE(.KP_DECIMAL) */
|
||||||
|
K_KP_HEXADECIMAL :: 0x400000dd /**< SCANCODE_TO_KEYCODE(.KP_HEXADECIMAL) */
|
||||||
|
K_LCTRL :: 0x400000e0 /**< SCANCODE_TO_KEYCODE(.LCTRL) */
|
||||||
|
K_LSHIFT :: 0x400000e1 /**< SCANCODE_TO_KEYCODE(.LSHIFT) */
|
||||||
|
K_LALT :: 0x400000e2 /**< SCANCODE_TO_KEYCODE(.LALT) */
|
||||||
|
K_LGUI :: 0x400000e3 /**< SCANCODE_TO_KEYCODE(.LGUI) */
|
||||||
|
K_RCTRL :: 0x400000e4 /**< SCANCODE_TO_KEYCODE(.RCTRL) */
|
||||||
|
K_RSHIFT :: 0x400000e5 /**< SCANCODE_TO_KEYCODE(.RSHIFT) */
|
||||||
|
K_RALT :: 0x400000e6 /**< SCANCODE_TO_KEYCODE(.RALT) */
|
||||||
|
K_RGUI :: 0x400000e7 /**< SCANCODE_TO_KEYCODE(.RGUI) */
|
||||||
|
K_MODE :: 0x40000101 /**< SCANCODE_TO_KEYCODE(.MODE) */
|
||||||
|
K_SLEEP :: 0x40000102 /**< SCANCODE_TO_KEYCODE(.SLEEP) */
|
||||||
|
K_WAKE :: 0x40000103 /**< SCANCODE_TO_KEYCODE(.WAKE) */
|
||||||
|
K_CHANNEL_INCREMENT :: 0x40000104 /**< SCANCODE_TO_KEYCODE(.CHANNEL_INCREMENT) */
|
||||||
|
K_CHANNEL_DECREMENT :: 0x40000105 /**< SCANCODE_TO_KEYCODE(.CHANNEL_DECREMENT) */
|
||||||
|
K_MEDIA_PLAY :: 0x40000106 /**< SCANCODE_TO_KEYCODE(.MEDIA_PLAY) */
|
||||||
|
K_MEDIA_PAUSE :: 0x40000107 /**< SCANCODE_TO_KEYCODE(.MEDIA_PAUSE) */
|
||||||
|
K_MEDIA_RECORD :: 0x40000108 /**< SCANCODE_TO_KEYCODE(.MEDIA_RECORD) */
|
||||||
|
K_MEDIA_FAST_FORWARD :: 0x40000109 /**< SCANCODE_TO_KEYCODE(.MEDIA_FAST_FORWARD) */
|
||||||
|
K_MEDIA_REWIND :: 0x4000010a /**< SCANCODE_TO_KEYCODE(.MEDIA_REWIND) */
|
||||||
|
K_MEDIA_NEXT_TRACK :: 0x4000010b /**< SCANCODE_TO_KEYCODE(.MEDIA_NEXT_TRACK) */
|
||||||
|
K_MEDIA_PREVIOUS_TRACK :: 0x4000010c /**< SCANCODE_TO_KEYCODE(.MEDIA_PREVIOUS_TRACK) */
|
||||||
|
K_MEDIA_STOP :: 0x4000010d /**< SCANCODE_TO_KEYCODE(.MEDIA_STOP) */
|
||||||
|
K_MEDIA_EJECT :: 0x4000010e /**< SCANCODE_TO_KEYCODE(.MEDIA_EJECT) */
|
||||||
|
K_MEDIA_PLAY_PAUSE :: 0x4000010f /**< SCANCODE_TO_KEYCODE(.MEDIA_PLAY_PAUSE) */
|
||||||
|
K_MEDIA_SELECT :: 0x40000110 /**< SCANCODE_TO_KEYCODE(.MEDIA_SELECT) */
|
||||||
|
K_AC_NEW :: 0x40000111 /**< SCANCODE_TO_KEYCODE(.AC_NEW) */
|
||||||
|
K_AC_OPEN :: 0x40000112 /**< SCANCODE_TO_KEYCODE(.AC_OPEN) */
|
||||||
|
K_AC_CLOSE :: 0x40000113 /**< SCANCODE_TO_KEYCODE(.AC_CLOSE) */
|
||||||
|
K_AC_EXIT :: 0x40000114 /**< SCANCODE_TO_KEYCODE(.AC_EXIT) */
|
||||||
|
K_AC_SAVE :: 0x40000115 /**< SCANCODE_TO_KEYCODE(.AC_SAVE) */
|
||||||
|
K_AC_PRINT :: 0x40000116 /**< SCANCODE_TO_KEYCODE(.AC_PRINT) */
|
||||||
|
K_AC_PROPERTIES :: 0x40000117 /**< SCANCODE_TO_KEYCODE(.AC_PROPERTIES) */
|
||||||
|
K_AC_SEARCH :: 0x40000118 /**< SCANCODE_TO_KEYCODE(.AC_SEARCH) */
|
||||||
|
K_AC_HOME :: 0x40000119 /**< SCANCODE_TO_KEYCODE(.AC_HOME) */
|
||||||
|
K_AC_BACK :: 0x4000011a /**< SCANCODE_TO_KEYCODE(.AC_BACK) */
|
||||||
|
K_AC_FORWARD :: 0x4000011b /**< SCANCODE_TO_KEYCODE(.AC_FORWARD) */
|
||||||
|
K_AC_STOP :: 0x4000011c /**< SCANCODE_TO_KEYCODE(.AC_STOP) */
|
||||||
|
K_AC_REFRESH :: 0x4000011d /**< SCANCODE_TO_KEYCODE(.AC_REFRESH) */
|
||||||
|
K_AC_BOOKMARKS :: 0x4000011e /**< SCANCODE_TO_KEYCODE(.AC_BOOKMARKS) */
|
||||||
|
K_SOFTLEFT :: 0x4000011f /**< SCANCODE_TO_KEYCODE(.SOFTLEFT) */
|
||||||
|
K_SOFTRIGHT :: 0x40000120 /**< SCANCODE_TO_KEYCODE(.SOFTRIGHT) */
|
||||||
|
K_CALL :: 0x40000121 /**< SCANCODE_TO_KEYCODE(.CALL) */
|
||||||
|
K_ENDCALL :: 0x40000122 /**< SCANCODE_TO_KEYCODE(.ENDCALL) */
|
||||||
|
K_LEFT_TAB :: 0x20000001 /**< Extended key Left Tab */
|
||||||
|
K_LEVEL5_SHIFT :: 0x20000002 /**< Extended key Level 5 Shift */
|
||||||
|
K_MULTI_KEY_COMPOSE :: 0x20000003 /**< Extended key Multi-key Compose */
|
||||||
|
K_LMETA :: 0x20000004 /**< Extended key Left Meta */
|
||||||
|
K_RMETA :: 0x20000005 /**< Extended key Right Meta */
|
||||||
|
K_LHYPER :: 0x20000006 /**< Extended key Left Hyper */
|
||||||
|
K_RHYPER :: 0x20000007 /**< Extended key Right Hyper */
|
||||||
|
|
||||||
|
|
||||||
|
Keymod :: distinct bit_set[KeymodFlag; Uint16]
|
||||||
|
KeymodFlag :: enum Uint16 {
|
||||||
|
LSHIFT = 0, /**< the left Shift key is down. */
|
||||||
|
RSHIFT = 1, /**< the right Shift key is down. */
|
||||||
|
LEVEL5 = 2, /**< the Level 5 Shift key is down. */
|
||||||
|
LCTRL = 6, /**< the left Ctrl (Control) key is down. */
|
||||||
|
RCTRL = 7, /**< the right Ctrl (Control) key is down. */
|
||||||
|
LALT = 8, /**< the left Alt key is down. */
|
||||||
|
RALT = 9, /**< the right Alt key is down. */
|
||||||
|
LGUI = 10, /**< the left GUI key (often the Windows key) is down. */
|
||||||
|
RGUI = 11, /**< the right GUI key (often the Windows key) is down. */
|
||||||
|
NUM = 12, /**< the Num Lock key (may be located on an extended keypad) is down. */
|
||||||
|
CAPS = 13, /**< the Caps Lock key is down. */
|
||||||
|
MODE = 14, /**< the !AltGr key is down. */
|
||||||
|
SCROLL = 15, /**< the Scroll Lock key is down. */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
KMOD_NONE :: Keymod{} /**< no modifier is applicable. */
|
||||||
|
KMOD_LSHIFT :: Keymod{.LSHIFT} /**< the left Shift key is down. */
|
||||||
|
KMOD_RSHIFT :: Keymod{.RSHIFT} /**< the right Shift key is down. */
|
||||||
|
KMOD_LEVEL5 :: Keymod{.LEVEL5} /**< the Level 5 Shift key is down. */
|
||||||
|
KMOD_LCTRL :: Keymod{.LCTRL} /**< the left Ctrl (Control) key is down. */
|
||||||
|
KMOD_RCTRL :: Keymod{.RCTRL} /**< the right Ctrl (Control) key is down. */
|
||||||
|
KMOD_LALT :: Keymod{.LALT} /**< the left Alt key is down. */
|
||||||
|
KMOD_RALT :: Keymod{.RALT} /**< the right Alt key is down. */
|
||||||
|
KMOD_LGUI :: Keymod{.LGUI} /**< the left GUI key (often the Windows key) is down. */
|
||||||
|
KMOD_RGUI :: Keymod{.RGUI} /**< the right GUI key (often the Windows key) is down. */
|
||||||
|
KMOD_NUM :: Keymod{.NUM} /**< the Num Lock key (may be located on an extended keypad) is down. */
|
||||||
|
KMOD_CAPS :: Keymod{.CAPS} /**< the Caps Lock key is down. */
|
||||||
|
KMOD_MODE :: Keymod{.MODE} /**< the !AltGr key is down. */
|
||||||
|
KMOD_SCROLL :: Keymod{.SCROLL} /**< the Scroll Lock key is down. */
|
||||||
|
KMOD_CTRL :: Keymod{.LCTRL, .RCTRL} /**< Any Ctrl key is down. */
|
||||||
|
KMOD_SHIFT :: Keymod{.LSHIFT, .RSHIFT} /**< Any Shift key is down. */
|
||||||
|
KMOD_ALT :: Keymod{.LALT, .RALT} /**< Any Alt key is down. */
|
||||||
|
KMOD_GUI :: Keymod{.LGUI, .RGUI} /**< Any GUI key is down. */
|
||||||
Vendored
+82
@@ -0,0 +1,82 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
|
MouseID :: distinct Uint32
|
||||||
|
|
||||||
|
Cursor :: struct {}
|
||||||
|
|
||||||
|
SystemCursor :: enum c.int {
|
||||||
|
DEFAULT, /**< Default cursor. Usually an arrow. */
|
||||||
|
TEXT, /**< Text selection. Usually an I-beam. */
|
||||||
|
WAIT, /**< Wait. Usually an hourglass or watch or spinning ball. */
|
||||||
|
CROSSHAIR, /**< Crosshair. */
|
||||||
|
PROGRESS, /**< Program is busy but still interactive. Usually it's WAIT with an arrow. */
|
||||||
|
NWSE_RESIZE, /**< Double arrow pointing northwest and southeast. */
|
||||||
|
NESW_RESIZE, /**< Double arrow pointing northeast and southwest. */
|
||||||
|
EW_RESIZE, /**< Double arrow pointing west and east. */
|
||||||
|
NS_RESIZE, /**< Double arrow pointing north and south. */
|
||||||
|
MOVE, /**< Four pointed arrow pointing north, south, east, and west. */
|
||||||
|
NOT_ALLOWED, /**< Not permitted. Usually a slashed circle or crossbones. */
|
||||||
|
POINTER, /**< Pointer that indicates a link. Usually a pointing hand. */
|
||||||
|
NW_RESIZE, /**< Window resize top-left. This may be a single arrow or a double arrow like NWSE_RESIZE. */
|
||||||
|
N_RESIZE, /**< Window resize top. May be NS_RESIZE. */
|
||||||
|
NE_RESIZE, /**< Window resize top-right. May be NESW_RESIZE. */
|
||||||
|
E_RESIZE, /**< Window resize right. May be EW_RESIZE. */
|
||||||
|
SE_RESIZE, /**< Window resize bottom-right. May be NWSE_RESIZE. */
|
||||||
|
S_RESIZE, /**< Window resize bottom. May be NS_RESIZE. */
|
||||||
|
SW_RESIZE, /**< Window resize bottom-left. May be NESW_RESIZE. */
|
||||||
|
W_RESIZE, /**< Window resize left. May be EW_RESIZE. */
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseWheelDirection :: enum c.int {
|
||||||
|
NORMAL, /**< The scroll direction is normal */
|
||||||
|
FLIPPED, /**< The scroll direction is flipped / natural */
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseButtonFlags :: distinct bit_set[MouseButtonFlag; Uint32]
|
||||||
|
MouseButtonFlag :: enum Uint32 {
|
||||||
|
LEFT = 1 - 1,
|
||||||
|
MIDDLE = 2 - 1,
|
||||||
|
RIGHT = 3 - 1,
|
||||||
|
X1 = 4 - 1,
|
||||||
|
X2 = 5 - 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
BUTTON_LEFT :: 1
|
||||||
|
BUTTON_MIDDLE :: 2
|
||||||
|
BUTTON_RIGHT :: 3
|
||||||
|
BUTTON_X1 :: 4
|
||||||
|
BUTTON_X2 :: 5
|
||||||
|
|
||||||
|
BUTTON_LMASK :: MouseButtonFlags{.LEFT}
|
||||||
|
BUTTON_MMASK :: MouseButtonFlags{.MIDDLE}
|
||||||
|
BUTTON_RMASK :: MouseButtonFlags{.RIGHT}
|
||||||
|
BUTTON_X1MASK :: MouseButtonFlags{.X1}
|
||||||
|
BUTTON_X2MASK :: MouseButtonFlags{.X2}
|
||||||
|
|
||||||
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
|
foreign lib {
|
||||||
|
HasMouse :: proc() -> bool ---
|
||||||
|
GetMice :: proc(count: ^c.int) -> [^]MouseID ---
|
||||||
|
GetMouseNameForID :: proc(instance_id: MouseID) -> cstring ---
|
||||||
|
GetMouseFocus :: proc() -> ^Window ---
|
||||||
|
GetMouseState :: proc(x, y: ^f32) -> MouseButtonFlags ---
|
||||||
|
GetGlobalMouseState :: proc(x, y: ^f32) -> MouseButtonFlags ---
|
||||||
|
GetRelativeMouseState :: proc(x, y: ^f32) -> MouseButtonFlags ---
|
||||||
|
WarpMouseInWindow :: proc(window: ^Window, x, y: f32) ---
|
||||||
|
WarpMouseGlobal :: proc(x, y: f32) -> bool ---
|
||||||
|
SetWindowRelativeMouseMode :: proc(window: ^Window, enabled: bool) -> bool ---
|
||||||
|
GetWindowRelativeMouseMode :: proc(window: ^Window) -> bool ---
|
||||||
|
CaptureMouse :: proc(enabled: bool) -> bool ---
|
||||||
|
CreateCursor :: proc(data: [^]byte, mask: [^]Uint8, w, h, hot_x, hot_y: c.int) -> ^Cursor ---
|
||||||
|
CreateColorCursor :: proc(surface: ^Surface, hot_x, hot_y: c.int) -> ^Cursor ---
|
||||||
|
CreateSystemCursor :: proc(id: SystemCursor) -> ^Cursor ---
|
||||||
|
SetCursor :: proc(cursor: ^Cursor) -> bool ---
|
||||||
|
GetCursor :: proc() -> ^Cursor ---
|
||||||
|
GetDefaultCursor :: proc() -> ^Cursor ---
|
||||||
|
DestroyCursor :: proc(cursor: ^Cursor) ---
|
||||||
|
ShowCursor :: proc() -> bool ---
|
||||||
|
HideCursor :: proc() -> bool ---
|
||||||
|
CursorVisible :: proc() -> bool ---
|
||||||
|
}
|
||||||
Vendored
+30
@@ -0,0 +1,30 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
|
PenID :: distinct Uint32
|
||||||
|
|
||||||
|
PEN_MOUSEID :: MouseID(1<<32 - 2)
|
||||||
|
PEN_TOUCHID :: TouchID(1<<64 - 2)
|
||||||
|
|
||||||
|
|
||||||
|
PenInputFlags :: distinct bit_set[PenInputFlag; Uint32]
|
||||||
|
PenInputFlag :: enum Uint32 {
|
||||||
|
DOWN = 0, /**< pen is pressed down */
|
||||||
|
BUTTON_1 = 1, /**< button 1 is pressed */
|
||||||
|
BUTTON_2 = 2, /**< button 2 is pressed */
|
||||||
|
BUTTON_3 = 3, /**< button 3 is pressed */
|
||||||
|
BUTTON_4 = 4, /**< button 4 is pressed */
|
||||||
|
BUTTON_5 = 5, /**< button 5 is pressed */
|
||||||
|
ERASER_TIP = 30, /**< eraser tip is used */
|
||||||
|
}
|
||||||
|
|
||||||
|
PenAxis :: enum c.int {
|
||||||
|
PRESSURE, /**< Pen pressure. Unidirectional: 0 to 1.0 */
|
||||||
|
XTILT, /**< Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right). */
|
||||||
|
YTILT, /**< Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down). */
|
||||||
|
DISTANCE, /**< Pen distance to drawing surface. Unidirectional: 0.0 to 1.0 */
|
||||||
|
ROTATION, /**< Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). */
|
||||||
|
SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 */
|
||||||
|
TANGENTIAL_PRESSURE, /**< Pressure from squeezing the pen ("barrel pressure"). */
|
||||||
|
}
|
||||||
Vendored
+380
@@ -0,0 +1,380 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
|
Scancode :: enum c.int {
|
||||||
|
UNKNOWN = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Usage page 0x07
|
||||||
|
*
|
||||||
|
* These values are from usage page 0x07 (USB keyboard page).
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
|
||||||
|
A = 4,
|
||||||
|
B = 5,
|
||||||
|
C = 6,
|
||||||
|
D = 7,
|
||||||
|
E = 8,
|
||||||
|
F = 9,
|
||||||
|
G = 10,
|
||||||
|
H = 11,
|
||||||
|
I = 12,
|
||||||
|
J = 13,
|
||||||
|
K = 14,
|
||||||
|
L = 15,
|
||||||
|
M = 16,
|
||||||
|
N = 17,
|
||||||
|
O = 18,
|
||||||
|
P = 19,
|
||||||
|
Q = 20,
|
||||||
|
R = 21,
|
||||||
|
S = 22,
|
||||||
|
T = 23,
|
||||||
|
U = 24,
|
||||||
|
V = 25,
|
||||||
|
W = 26,
|
||||||
|
X = 27,
|
||||||
|
Y = 28,
|
||||||
|
Z = 29,
|
||||||
|
|
||||||
|
_1 = 30,
|
||||||
|
_2 = 31,
|
||||||
|
_3 = 32,
|
||||||
|
_4 = 33,
|
||||||
|
_5 = 34,
|
||||||
|
_6 = 35,
|
||||||
|
_7 = 36,
|
||||||
|
_8 = 37,
|
||||||
|
_9 = 38,
|
||||||
|
_0 = 39,
|
||||||
|
|
||||||
|
RETURN = 40,
|
||||||
|
ESCAPE = 41,
|
||||||
|
BACKSPACE = 42,
|
||||||
|
TAB = 43,
|
||||||
|
SPACE = 44,
|
||||||
|
|
||||||
|
MINUS = 45,
|
||||||
|
EQUALS = 46,
|
||||||
|
LEFTBRACKET = 47,
|
||||||
|
RIGHTBRACKET = 48,
|
||||||
|
BACKSLASH = 49, /**< Located at the lower left of the return
|
||||||
|
* key on ISO keyboards and at the right end
|
||||||
|
* of the QWERTY row on ANSI keyboards.
|
||||||
|
* Produces REVERSE SOLIDUS (backslash) and
|
||||||
|
* VERTICAL LINE in a US layout, REVERSE
|
||||||
|
* SOLIDUS and VERTICAL LINE in a UK Mac
|
||||||
|
* layout, NUMBER SIGN and TILDE in a UK
|
||||||
|
* Windows layout, DOLLAR SIGN and POUND SIGN
|
||||||
|
* in a Swiss German layout, NUMBER SIGN and
|
||||||
|
* APOSTROPHE in a German layout, GRAVE
|
||||||
|
* ACCENT and POUND SIGN in a French Mac
|
||||||
|
* layout, and ASTERISK and MICRO SIGN in a
|
||||||
|
* French Windows layout.
|
||||||
|
*/
|
||||||
|
NONUSHASH = 50, /**< ISO USB keyboards actually use this code
|
||||||
|
* instead of 49 for the same key, but all
|
||||||
|
* OSes I've seen treat the two codes
|
||||||
|
* identically. So, as an implementor, unless
|
||||||
|
* your keyboard generates both of those
|
||||||
|
* codes and your OS treats them differently,
|
||||||
|
* you should generate BACKSLASH
|
||||||
|
* instead of this code. As a user, you
|
||||||
|
* should not rely on this code because SDL
|
||||||
|
* will never generate it with most (all?)
|
||||||
|
* keyboards.
|
||||||
|
*/
|
||||||
|
SEMICOLON = 51,
|
||||||
|
APOSTROPHE = 52,
|
||||||
|
GRAVE = 53, /**< Located in the top left corner (on both ANSI
|
||||||
|
* and ISO keyboards). Produces GRAVE ACCENT and
|
||||||
|
* TILDE in a US Windows layout and in US and UK
|
||||||
|
* Mac layouts on ANSI keyboards, GRAVE ACCENT
|
||||||
|
* and NOT SIGN in a UK Windows layout, SECTION
|
||||||
|
* SIGN and PLUS-MINUS SIGN in US and UK Mac
|
||||||
|
* layouts on ISO keyboards, SECTION SIGN and
|
||||||
|
* DEGREE SIGN in a Swiss German layout (Mac:
|
||||||
|
* only on ISO keyboards), CIRCUMFLEX ACCENT and
|
||||||
|
* DEGREE SIGN in a German layout (Mac: only on
|
||||||
|
* ISO keyboards), SUPERSCRIPT TWO and TILDE in a
|
||||||
|
* French Windows layout, COMMERCIAL AT and
|
||||||
|
* NUMBER SIGN in a French Mac layout on ISO
|
||||||
|
* keyboards, and LESS-THAN SIGN and GREATER-THAN
|
||||||
|
* SIGN in a Swiss German, German, or French Mac
|
||||||
|
* layout on ANSI keyboards.
|
||||||
|
*/
|
||||||
|
COMMA = 54,
|
||||||
|
PERIOD = 55,
|
||||||
|
SLASH = 56,
|
||||||
|
|
||||||
|
CAPSLOCK = 57,
|
||||||
|
|
||||||
|
F1 = 58,
|
||||||
|
F2 = 59,
|
||||||
|
F3 = 60,
|
||||||
|
F4 = 61,
|
||||||
|
F5 = 62,
|
||||||
|
F6 = 63,
|
||||||
|
F7 = 64,
|
||||||
|
F8 = 65,
|
||||||
|
F9 = 66,
|
||||||
|
F10 = 67,
|
||||||
|
F11 = 68,
|
||||||
|
F12 = 69,
|
||||||
|
|
||||||
|
PRINTSCREEN = 70,
|
||||||
|
SCROLLLOCK = 71,
|
||||||
|
PAUSE = 72,
|
||||||
|
INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
|
||||||
|
does send code 73, not 117) */
|
||||||
|
HOME = 74,
|
||||||
|
PAGEUP = 75,
|
||||||
|
DELETE = 76,
|
||||||
|
END = 77,
|
||||||
|
PAGEDOWN = 78,
|
||||||
|
RIGHT = 79,
|
||||||
|
LEFT = 80,
|
||||||
|
DOWN = 81,
|
||||||
|
UP = 82,
|
||||||
|
|
||||||
|
NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
|
||||||
|
*/
|
||||||
|
KP_DIVIDE = 84,
|
||||||
|
KP_MULTIPLY = 85,
|
||||||
|
KP_MINUS = 86,
|
||||||
|
KP_PLUS = 87,
|
||||||
|
KP_ENTER = 88,
|
||||||
|
KP_1 = 89,
|
||||||
|
KP_2 = 90,
|
||||||
|
KP_3 = 91,
|
||||||
|
KP_4 = 92,
|
||||||
|
KP_5 = 93,
|
||||||
|
KP_6 = 94,
|
||||||
|
KP_7 = 95,
|
||||||
|
KP_8 = 96,
|
||||||
|
KP_9 = 97,
|
||||||
|
KP_0 = 98,
|
||||||
|
KP_PERIOD = 99,
|
||||||
|
|
||||||
|
NONUSBACKSLASH = 100, /**< This is the additional key that ISO
|
||||||
|
* keyboards have over ANSI ones,
|
||||||
|
* located between left shift and Y.
|
||||||
|
* Produces GRAVE ACCENT and TILDE in a
|
||||||
|
* US or UK Mac layout, REVERSE SOLIDUS
|
||||||
|
* (backslash) and VERTICAL LINE in a
|
||||||
|
* US or UK Windows layout, and
|
||||||
|
* LESS-THAN SIGN and GREATER-THAN SIGN
|
||||||
|
* in a Swiss German, German, or French
|
||||||
|
* layout. */
|
||||||
|
APPLICATION = 101, /**< windows contextual menu, compose */
|
||||||
|
POWER = 102, /**< The USB document says this is a status flag,
|
||||||
|
* not a physical key - but some Mac keyboards
|
||||||
|
* do have a power key. */
|
||||||
|
KP_EQUALS = 103,
|
||||||
|
F13 = 104,
|
||||||
|
F14 = 105,
|
||||||
|
F15 = 106,
|
||||||
|
F16 = 107,
|
||||||
|
F17 = 108,
|
||||||
|
F18 = 109,
|
||||||
|
F19 = 110,
|
||||||
|
F20 = 111,
|
||||||
|
F21 = 112,
|
||||||
|
F22 = 113,
|
||||||
|
F23 = 114,
|
||||||
|
F24 = 115,
|
||||||
|
EXECUTE = 116,
|
||||||
|
HELP = 117, /**< AL Integrated Help Center */
|
||||||
|
MENU = 118, /**< Menu (show menu) */
|
||||||
|
SELECT = 119,
|
||||||
|
STOP = 120, /**< AC Stop */
|
||||||
|
AGAIN = 121, /**< AC Redo/Repeat */
|
||||||
|
UNDO = 122, /**< AC Undo */
|
||||||
|
CUT = 123, /**< AC Cut */
|
||||||
|
COPY = 124, /**< AC Copy */
|
||||||
|
PASTE = 125, /**< AC Paste */
|
||||||
|
FIND = 126, /**< AC Find */
|
||||||
|
MUTE = 127,
|
||||||
|
VOLUMEUP = 128,
|
||||||
|
VOLUMEDOWN = 129,
|
||||||
|
/* not sure whether there's a reason to enable these */
|
||||||
|
/* LOCKINGCAPSLOCK = 130, */
|
||||||
|
/* LOCKINGNUMLOCK = 131, */
|
||||||
|
/* LOCKINGSCROLLLOCK = 132, */
|
||||||
|
KP_COMMA = 133,
|
||||||
|
KP_EQUALSAS400 = 134,
|
||||||
|
|
||||||
|
INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
|
||||||
|
footnotes in USB doc */
|
||||||
|
INTERNATIONAL2 = 136,
|
||||||
|
INTERNATIONAL3 = 137, /**< Yen */
|
||||||
|
INTERNATIONAL4 = 138,
|
||||||
|
INTERNATIONAL5 = 139,
|
||||||
|
INTERNATIONAL6 = 140,
|
||||||
|
INTERNATIONAL7 = 141,
|
||||||
|
INTERNATIONAL8 = 142,
|
||||||
|
INTERNATIONAL9 = 143,
|
||||||
|
LANG1 = 144, /**< Hangul/English toggle */
|
||||||
|
LANG2 = 145, /**< Hanja conversion */
|
||||||
|
LANG3 = 146, /**< Katakana */
|
||||||
|
LANG4 = 147, /**< Hiragana */
|
||||||
|
LANG5 = 148, /**< Zenkaku/Hankaku */
|
||||||
|
LANG6 = 149, /**< reserved */
|
||||||
|
LANG7 = 150, /**< reserved */
|
||||||
|
LANG8 = 151, /**< reserved */
|
||||||
|
LANG9 = 152, /**< reserved */
|
||||||
|
|
||||||
|
ALTERASE = 153, /**< Erase-Eaze */
|
||||||
|
SYSREQ = 154,
|
||||||
|
CANCEL = 155, /**< AC Cancel */
|
||||||
|
CLEAR = 156,
|
||||||
|
PRIOR = 157,
|
||||||
|
RETURN2 = 158,
|
||||||
|
SEPARATOR = 159,
|
||||||
|
OUT = 160,
|
||||||
|
OPER = 161,
|
||||||
|
CLEARAGAIN = 162,
|
||||||
|
CRSEL = 163,
|
||||||
|
EXSEL = 164,
|
||||||
|
|
||||||
|
KP_00 = 176,
|
||||||
|
KP_000 = 177,
|
||||||
|
THOUSANDSSEPARATOR = 178,
|
||||||
|
DECIMALSEPARATOR = 179,
|
||||||
|
CURRENCYUNIT = 180,
|
||||||
|
CURRENCYSUBUNIT = 181,
|
||||||
|
KP_LEFTPAREN = 182,
|
||||||
|
KP_RIGHTPAREN = 183,
|
||||||
|
KP_LEFTBRACE = 184,
|
||||||
|
KP_RIGHTBRACE = 185,
|
||||||
|
KP_TAB = 186,
|
||||||
|
KP_BACKSPACE = 187,
|
||||||
|
KP_A = 188,
|
||||||
|
KP_B = 189,
|
||||||
|
KP_C = 190,
|
||||||
|
KP_D = 191,
|
||||||
|
KP_E = 192,
|
||||||
|
KP_F = 193,
|
||||||
|
KP_XOR = 194,
|
||||||
|
KP_POWER = 195,
|
||||||
|
KP_PERCENT = 196,
|
||||||
|
KP_LESS = 197,
|
||||||
|
KP_GREATER = 198,
|
||||||
|
KP_AMPERSAND = 199,
|
||||||
|
KP_DBLAMPERSAND = 200,
|
||||||
|
KP_VERTICALBAR = 201,
|
||||||
|
KP_DBLVERTICALBAR = 202,
|
||||||
|
KP_COLON = 203,
|
||||||
|
KP_HASH = 204,
|
||||||
|
KP_SPACE = 205,
|
||||||
|
KP_AT = 206,
|
||||||
|
KP_EXCLAM = 207,
|
||||||
|
KP_MEMSTORE = 208,
|
||||||
|
KP_MEMRECALL = 209,
|
||||||
|
KP_MEMCLEAR = 210,
|
||||||
|
KP_MEMADD = 211,
|
||||||
|
KP_MEMSUBTRACT = 212,
|
||||||
|
KP_MEMMULTIPLY = 213,
|
||||||
|
KP_MEMDIVIDE = 214,
|
||||||
|
KP_PLUSMINUS = 215,
|
||||||
|
KP_CLEAR = 216,
|
||||||
|
KP_CLEARENTRY = 217,
|
||||||
|
KP_BINARY = 218,
|
||||||
|
KP_OCTAL = 219,
|
||||||
|
KP_DECIMAL = 220,
|
||||||
|
KP_HEXADECIMAL = 221,
|
||||||
|
|
||||||
|
LCTRL = 224,
|
||||||
|
LSHIFT = 225,
|
||||||
|
LALT = 226, /**< alt, option */
|
||||||
|
LGUI = 227, /**< windows, command (apple), meta */
|
||||||
|
RCTRL = 228,
|
||||||
|
RSHIFT = 229,
|
||||||
|
RALT = 230, /**< alt gr, option */
|
||||||
|
RGUI = 231, /**< windows, command (apple), meta */
|
||||||
|
|
||||||
|
MODE = 257, /**< I'm not sure if this is really not covered
|
||||||
|
* by any of the above, but since there's a
|
||||||
|
* special SDL_KMOD_MODE for it I'm adding it here
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @} *//* Usage page 0x07 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Usage page 0x0C
|
||||||
|
*
|
||||||
|
* These values are mapped from usage page 0x0C (USB consumer page).
|
||||||
|
*
|
||||||
|
* There are way more keys in the spec than we can represent in the
|
||||||
|
* current scancode range, so pick the ones that commonly come up in
|
||||||
|
* real world usage.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
|
||||||
|
SLEEP = 258, /**< Sleep */
|
||||||
|
WAKE = 259, /**< Wake */
|
||||||
|
|
||||||
|
CHANNEL_INCREMENT = 260, /**< Channel Increment */
|
||||||
|
CHANNEL_DECREMENT = 261, /**< Channel Decrement */
|
||||||
|
|
||||||
|
MEDIA_PLAY = 262, /**< Play */
|
||||||
|
MEDIA_PAUSE = 263, /**< Pause */
|
||||||
|
MEDIA_RECORD = 264, /**< Record */
|
||||||
|
MEDIA_FAST_FORWARD = 265, /**< Fast Forward */
|
||||||
|
MEDIA_REWIND = 266, /**< Rewind */
|
||||||
|
MEDIA_NEXT_TRACK = 267, /**< Next Track */
|
||||||
|
MEDIA_PREVIOUS_TRACK = 268, /**< Previous Track */
|
||||||
|
MEDIA_STOP = 269, /**< Stop */
|
||||||
|
MEDIA_EJECT = 270, /**< Eject */
|
||||||
|
MEDIA_PLAY_PAUSE = 271, /**< Play / Pause */
|
||||||
|
MEDIA_SELECT = 272, /* Media Select */
|
||||||
|
|
||||||
|
AC_NEW = 273, /**< AC New */
|
||||||
|
AC_OPEN = 274, /**< AC Open */
|
||||||
|
AC_CLOSE = 275, /**< AC Close */
|
||||||
|
AC_EXIT = 276, /**< AC Exit */
|
||||||
|
AC_SAVE = 277, /**< AC Save */
|
||||||
|
AC_PRINT = 278, /**< AC Print */
|
||||||
|
AC_PROPERTIES = 279, /**< AC Properties */
|
||||||
|
|
||||||
|
AC_SEARCH = 280, /**< AC Search */
|
||||||
|
AC_HOME = 281, /**< AC Home */
|
||||||
|
AC_BACK = 282, /**< AC Back */
|
||||||
|
AC_FORWARD = 283, /**< AC Forward */
|
||||||
|
AC_STOP = 284, /**< AC Stop */
|
||||||
|
AC_REFRESH = 285, /**< AC Refresh */
|
||||||
|
AC_BOOKMARKS = 286, /**< AC Bookmarks */
|
||||||
|
|
||||||
|
/* @} *//* Usage page 0x0C */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name Mobile keys
|
||||||
|
*
|
||||||
|
* These are values that are often used on mobile phones.
|
||||||
|
*/
|
||||||
|
/* @{ */
|
||||||
|
|
||||||
|
SOFTLEFT = 287, /**< Usually situated below the display on phones and
|
||||||
|
used as a multi-function feature key for selecting
|
||||||
|
a software defined function shown on the bottom left
|
||||||
|
of the display. */
|
||||||
|
SOFTRIGHT = 288, /**< Usually situated below the display on phones and
|
||||||
|
used as a multi-function feature key for selecting
|
||||||
|
a software defined function shown on the bottom right
|
||||||
|
of the display. */
|
||||||
|
CALL = 289, /**< Used for accepting phone calls. */
|
||||||
|
ENDCALL = 290, /**< Used for rejecting phone calls. */
|
||||||
|
|
||||||
|
/* @} *//* Mobile keys */
|
||||||
|
|
||||||
|
/* Add any other keys here. */
|
||||||
|
|
||||||
|
RESERVED = 400, /**< 400-500 reserved for dynamic keycodes */
|
||||||
|
|
||||||
|
_ = 511,
|
||||||
|
// COUNT = 512 /**< not a key, just marks the number of scancodes for array bounds */
|
||||||
|
|
||||||
|
}
|
||||||
Vendored
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
|
|
||||||
|
TouchID :: distinct Uint64
|
||||||
|
FingerID :: distinct Uint64
|
||||||
|
|
||||||
|
TouchDeviceType :: enum c.int {
|
||||||
|
INVALID = -1,
|
||||||
|
DIRECT, /**< touch screen with window-relative coordinates */
|
||||||
|
INDIRECT_ABSOLUTE, /**< trackpad with absolute device coordinates */
|
||||||
|
INDIRECT_RELATIVE, /**< trackpad with screen cursor-relative coordinates */
|
||||||
|
}
|
||||||
|
|
||||||
|
Finger :: struct {
|
||||||
|
id: FingerID, /**< the finger ID */
|
||||||
|
x: f32, /**< the x-axis location of the touch event, normalized (0...1) */
|
||||||
|
y: f32, /**< the y-axis location of the touch event, normalized (0...1) */
|
||||||
|
pressure: f32, /**< the quantity of pressure applied, normalized (0...1) */
|
||||||
|
}
|
||||||
|
|
||||||
|
TOUCH_MOUSEID :: MouseID(1<<32 - 1)
|
||||||
|
MOUSE_TOUCHID :: TouchID(1<<64 - 1)
|
||||||
|
|
||||||
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
|
foreign lib {
|
||||||
|
GetTouchDevices :: proc(count: ^c.int) -> [^]TouchID ---
|
||||||
|
GetTouchDeviceName :: proc(touchID: TouchID) -> cstring ---
|
||||||
|
GetTouchDeviceType :: proc(touchID: TouchID) -> TouchDeviceType ---
|
||||||
|
GetTouchFingers :: proc(touchID: TouchID, count: ^c.int) -> [^]^Finger ---
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user