sdl3 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE +21 -0
  4. data/README.md +188 -0
  5. data/Rakefile +12 -0
  6. data/examples/01_hello_window.rb +24 -0
  7. data/examples/02_basic_rendering.rb +45 -0
  8. data/examples/03_keyboard_input.rb +52 -0
  9. data/examples/04_mouse_input.rb +56 -0
  10. data/examples/05_simple_game.rb +107 -0
  11. data/lib/sdl3/high_level/audio_device.rb +202 -0
  12. data/lib/sdl3/high_level/camera.rb +118 -0
  13. data/lib/sdl3/high_level/clipboard.rb +59 -0
  14. data/lib/sdl3/high_level/event.rb +240 -0
  15. data/lib/sdl3/high_level/gamepad.rb +190 -0
  16. data/lib/sdl3/high_level/gpu.rb +194 -0
  17. data/lib/sdl3/high_level/haptic.rb +213 -0
  18. data/lib/sdl3/high_level/joystick.rb +165 -0
  19. data/lib/sdl3/high_level/renderer.rb +163 -0
  20. data/lib/sdl3/high_level/sensor.rb +105 -0
  21. data/lib/sdl3/high_level/surface.rb +143 -0
  22. data/lib/sdl3/high_level/texture.rb +111 -0
  23. data/lib/sdl3/high_level/timer.rb +88 -0
  24. data/lib/sdl3/high_level/window.rb +151 -0
  25. data/lib/sdl3/library_loader.rb +63 -0
  26. data/lib/sdl3/raw/assert.rb +32 -0
  27. data/lib/sdl3/raw/asyncio.rb +36 -0
  28. data/lib/sdl3/raw/atomic.rb +40 -0
  29. data/lib/sdl3/raw/audio.rb +95 -0
  30. data/lib/sdl3/raw/base.rb +12 -0
  31. data/lib/sdl3/raw/bits.rb +17 -0
  32. data/lib/sdl3/raw/blendmode.rb +36 -0
  33. data/lib/sdl3/raw/camera.rb +38 -0
  34. data/lib/sdl3/raw/clipboard.rb +20 -0
  35. data/lib/sdl3/raw/cpuinfo.rb +29 -0
  36. data/lib/sdl3/raw/dialog.rb +33 -0
  37. data/lib/sdl3/raw/endian.rb +8 -0
  38. data/lib/sdl3/raw/error.rb +15 -0
  39. data/lib/sdl3/raw/events.rb +563 -0
  40. data/lib/sdl3/raw/filesystem.rb +47 -0
  41. data/lib/sdl3/raw/gamepad.rb +135 -0
  42. data/lib/sdl3/raw/gpu.rb +734 -0
  43. data/lib/sdl3/raw/guid.rb +12 -0
  44. data/lib/sdl3/raw/haptic.rb +167 -0
  45. data/lib/sdl3/raw/hidapi.rb +57 -0
  46. data/lib/sdl3/raw/hints.rb +20 -0
  47. data/lib/sdl3/raw/init.rb +27 -0
  48. data/lib/sdl3/raw/iostream.rb +88 -0
  49. data/lib/sdl3/raw/joystick.rb +101 -0
  50. data/lib/sdl3/raw/keyboard.rb +30 -0
  51. data/lib/sdl3/raw/keycode.rb +132 -0
  52. data/lib/sdl3/raw/loadso.rb +9 -0
  53. data/lib/sdl3/raw/locale.rb +12 -0
  54. data/lib/sdl3/raw/log.rb +61 -0
  55. data/lib/sdl3/raw/main.rb +23 -0
  56. data/lib/sdl3/raw/messagebox.rb +50 -0
  57. data/lib/sdl3/raw/metal.rb +9 -0
  58. data/lib/sdl3/raw/misc.rb +7 -0
  59. data/lib/sdl3/raw/mouse.rb +82 -0
  60. data/lib/sdl3/raw/mutex.rb +48 -0
  61. data/lib/sdl3/raw/openxr.rb +21 -0
  62. data/lib/sdl3/raw/pen.rb +38 -0
  63. data/lib/sdl3/raw/pixels.rb +180 -0
  64. data/lib/sdl3/raw/platform.rb +7 -0
  65. data/lib/sdl3/raw/power.rb +14 -0
  66. data/lib/sdl3/raw/process.rb +15 -0
  67. data/lib/sdl3/raw/properties.rb +39 -0
  68. data/lib/sdl3/raw/rect.rb +41 -0
  69. data/lib/sdl3/raw/render.rb +153 -0
  70. data/lib/sdl3/raw/scancode.rb +112 -0
  71. data/lib/sdl3/raw/sensor.rb +31 -0
  72. data/lib/sdl3/raw/stdinc.rb +209 -0
  73. data/lib/sdl3/raw/storage.rb +50 -0
  74. data/lib/sdl3/raw/surface.rb +106 -0
  75. data/lib/sdl3/raw/system.rb +77 -0
  76. data/lib/sdl3/raw/thread.rb +40 -0
  77. data/lib/sdl3/raw/time.rb +36 -0
  78. data/lib/sdl3/raw/timer.rb +19 -0
  79. data/lib/sdl3/raw/touch.rb +22 -0
  80. data/lib/sdl3/raw/tray.rb +42 -0
  81. data/lib/sdl3/raw/types.rb +21 -0
  82. data/lib/sdl3/raw/version.rb +8 -0
  83. data/lib/sdl3/raw/video.rb +208 -0
  84. data/lib/sdl3/raw/vulkan.rb +13 -0
  85. data/lib/sdl3/version.rb +5 -0
  86. data/lib/sdl3.rb +128 -0
  87. data/sdl3.gemspec +30 -0
  88. metadata +143 -0
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ SDL_GamepadType = enum :SDL_GAMEPAD_TYPE_UNKNOWN, 0,
6
+ :SDL_GAMEPAD_TYPE_STANDARD, 1,
7
+ :SDL_GAMEPAD_TYPE_XBOX360, 2,
8
+ :SDL_GAMEPAD_TYPE_XBOXONE, 3,
9
+ :SDL_GAMEPAD_TYPE_PS3, 4,
10
+ :SDL_GAMEPAD_TYPE_PS4, 5,
11
+ :SDL_GAMEPAD_TYPE_PS5, 6,
12
+ :SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO, 7,
13
+ :SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, 8,
14
+ :SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, 9,
15
+ :SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, 10,
16
+ :SDL_GAMEPAD_TYPE_COUNT, 11
17
+
18
+ SDL_GamepadButton = enum :SDL_GAMEPAD_BUTTON_INVALID, -1,
19
+ :SDL_GAMEPAD_BUTTON_SOUTH, 0,
20
+ :SDL_GAMEPAD_BUTTON_EAST, 1,
21
+ :SDL_GAMEPAD_BUTTON_WEST, 2,
22
+ :SDL_GAMEPAD_BUTTON_NORTH, 3,
23
+ :SDL_GAMEPAD_BUTTON_BACK, 4,
24
+ :SDL_GAMEPAD_BUTTON_GUIDE, 5,
25
+ :SDL_GAMEPAD_BUTTON_START, 6,
26
+ :SDL_GAMEPAD_BUTTON_LEFT_STICK, 7,
27
+ :SDL_GAMEPAD_BUTTON_RIGHT_STICK, 8,
28
+ :SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, 9,
29
+ :SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, 10,
30
+ :SDL_GAMEPAD_BUTTON_DPAD_UP, 11,
31
+ :SDL_GAMEPAD_BUTTON_DPAD_DOWN, 12,
32
+ :SDL_GAMEPAD_BUTTON_DPAD_LEFT, 13,
33
+ :SDL_GAMEPAD_BUTTON_DPAD_RIGHT, 14,
34
+ :SDL_GAMEPAD_BUTTON_MISC1, 15,
35
+ :SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1, 16,
36
+ :SDL_GAMEPAD_BUTTON_LEFT_PADDLE1, 17,
37
+ :SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2, 18,
38
+ :SDL_GAMEPAD_BUTTON_LEFT_PADDLE2, 19,
39
+ :SDL_GAMEPAD_BUTTON_TOUCHPAD, 20,
40
+ :SDL_GAMEPAD_BUTTON_MISC2, 21,
41
+ :SDL_GAMEPAD_BUTTON_MISC3, 22,
42
+ :SDL_GAMEPAD_BUTTON_MISC4, 23,
43
+ :SDL_GAMEPAD_BUTTON_MISC5, 24,
44
+ :SDL_GAMEPAD_BUTTON_MISC6, 25,
45
+ :SDL_GAMEPAD_BUTTON_COUNT, 26
46
+
47
+ SDL_GamepadAxis = enum :SDL_GAMEPAD_AXIS_INVALID, -1,
48
+ :SDL_GAMEPAD_AXIS_LEFTX, 0,
49
+ :SDL_GAMEPAD_AXIS_LEFTY, 1,
50
+ :SDL_GAMEPAD_AXIS_RIGHTX, 2,
51
+ :SDL_GAMEPAD_AXIS_RIGHTY, 3,
52
+ :SDL_GAMEPAD_AXIS_LEFT_TRIGGER, 4,
53
+ :SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, 5,
54
+ :SDL_GAMEPAD_AXIS_COUNT, 6
55
+
56
+ SDL_GamepadBindingType = enum :SDL_GAMEPAD_BINDTYPE_NONE, 0,
57
+ :SDL_GAMEPAD_BINDTYPE_BUTTON, 1,
58
+ :SDL_GAMEPAD_BINDTYPE_AXIS, 2,
59
+ :SDL_GAMEPAD_BINDTYPE_HAT, 3
60
+
61
+ attach_function :SDL_AddGamepadMapping, [:string], :int
62
+ attach_function :SDL_AddGamepadMappingsFromIO, %i[pointer bool], :int
63
+ attach_function :SDL_AddGamepadMappingsFromFile, [:string], :int
64
+ attach_function :SDL_ReloadGamepadMappings, [], :bool
65
+ attach_function :SDL_GetGamepadMappings, [:pointer], :pointer
66
+ attach_function :SDL_GetGamepadMappingForGUID, [SDL_GUID.by_value], :string
67
+ attach_function :SDL_GetGamepadMapping, [:pointer], :string
68
+ attach_function :SDL_SetGamepadMapping, %i[SDL_JoystickID string], :bool
69
+ attach_function :SDL_HasGamepad, [], :bool
70
+ attach_function :SDL_GetGamepads, [:pointer], :pointer
71
+ attach_function :SDL_IsGamepad, [:SDL_JoystickID], :bool
72
+ attach_function :SDL_GetGamepadNameForID, [:SDL_JoystickID], :string
73
+ attach_function :SDL_GetGamepadPathForID, [:SDL_JoystickID], :string
74
+ attach_function :SDL_GetGamepadPlayerIndexForID, [:SDL_JoystickID], :int
75
+ attach_function :SDL_GetGamepadGUIDForID, [:SDL_JoystickID], SDL_GUID.by_value
76
+ attach_function :SDL_GetGamepadVendorForID, [:SDL_JoystickID], :uint16
77
+ attach_function :SDL_GetGamepadProductForID, [:SDL_JoystickID], :uint16
78
+ attach_function :SDL_GetGamepadProductVersionForID, [:SDL_JoystickID], :uint16
79
+ attach_function :SDL_GetGamepadTypeForID, [:SDL_JoystickID], SDL_GamepadType
80
+ attach_function :SDL_GetRealGamepadTypeForID, [:SDL_JoystickID], SDL_GamepadType
81
+ attach_function :SDL_GetGamepadMappingForID, [:SDL_JoystickID], :string
82
+ attach_function :SDL_OpenGamepad, [:SDL_JoystickID], :pointer
83
+ attach_function :SDL_GetGamepadFromID, [:SDL_JoystickID], :pointer
84
+ attach_function :SDL_GetGamepadFromPlayerIndex, [:int], :pointer
85
+ attach_function :SDL_GetGamepadProperties, [:pointer], :SDL_PropertiesID
86
+ attach_function :SDL_GetGamepadID, [:pointer], :SDL_JoystickID
87
+ attach_function :SDL_GetGamepadName, [:pointer], :string
88
+ attach_function :SDL_GetGamepadPath, [:pointer], :string
89
+ attach_function :SDL_GetGamepadType, [:pointer], SDL_GamepadType
90
+ attach_function :SDL_GetRealGamepadType, [:pointer], SDL_GamepadType
91
+ attach_function :SDL_GetGamepadPlayerIndex, [:pointer], :int
92
+ attach_function :SDL_SetGamepadPlayerIndex, %i[pointer int], :bool
93
+ attach_function :SDL_GetGamepadVendor, [:pointer], :uint16
94
+ attach_function :SDL_GetGamepadProduct, [:pointer], :uint16
95
+ attach_function :SDL_GetGamepadProductVersion, [:pointer], :uint16
96
+ attach_function :SDL_GetGamepadFirmwareVersion, [:pointer], :uint16
97
+ attach_function :SDL_GetGamepadSerial, [:pointer], :string
98
+ attach_function :SDL_GetGamepadSteamHandle, [:pointer], :uint64
99
+ attach_function :SDL_GetGamepadConnectionState, [:pointer], SDL_JoystickConnectionState
100
+ attach_function :SDL_GetGamepadPowerInfo, %i[pointer pointer], :int32
101
+ attach_function :SDL_GamepadConnected, [:pointer], :bool
102
+ attach_function :SDL_GetGamepadJoystick, [:pointer], :pointer
103
+ attach_function :SDL_SetGamepadEventsEnabled, [:bool], :void
104
+ attach_function :SDL_GamepadEventsEnabled, [], :bool
105
+ attach_function :SDL_GetGamepadBindings, %i[pointer pointer], :pointer
106
+ attach_function :SDL_UpdateGamepads, [], :void
107
+ attach_function :SDL_GetGamepadTypeFromString, [:string], SDL_GamepadType
108
+ attach_function :SDL_GetGamepadStringForType, [SDL_GamepadType], :string
109
+ attach_function :SDL_GetGamepadAxisFromString, [:string], SDL_GamepadAxis
110
+ attach_function :SDL_GetGamepadStringForAxis, [SDL_GamepadAxis], :string
111
+ attach_function :SDL_GamepadHasAxis, [:pointer, SDL_GamepadAxis], :bool
112
+ attach_function :SDL_GetGamepadAxis, [:pointer, SDL_GamepadAxis], :int16
113
+ attach_function :SDL_GetGamepadButtonFromString, [:string], SDL_GamepadButton
114
+ attach_function :SDL_GetGamepadStringForButton, [SDL_GamepadButton], :string
115
+ attach_function :SDL_GamepadHasButton, [:pointer, SDL_GamepadButton], :bool
116
+ attach_function :SDL_GetGamepadButton, [:pointer, SDL_GamepadButton], :bool
117
+ attach_function :SDL_GetGamepadButtonLabelForType, [SDL_GamepadType, SDL_GamepadButton], :int32
118
+ attach_function :SDL_GetGamepadButtonLabel, [:pointer, SDL_GamepadButton], :int32
119
+ attach_function :SDL_GetNumGamepadTouchpads, [:pointer], :int
120
+ attach_function :SDL_GetNumGamepadTouchpadFingers, %i[pointer int], :int
121
+ attach_function :SDL_GetGamepadTouchpadFinger, %i[pointer int int pointer pointer pointer pointer], :bool
122
+ attach_function :SDL_GamepadHasSensor, %i[pointer int], :bool
123
+ attach_function :SDL_SetGamepadSensorEnabled, %i[pointer int bool], :bool
124
+ attach_function :SDL_GamepadSensorEnabled, %i[pointer int], :bool
125
+ attach_function :SDL_GetGamepadSensorDataRate, %i[pointer int], :float
126
+ attach_function :SDL_GetGamepadSensorData, %i[pointer int pointer int], :bool
127
+ attach_function :SDL_RumbleGamepad, %i[pointer uint16 uint16 uint32], :bool
128
+ attach_function :SDL_RumbleGamepadTriggers, %i[pointer uint16 uint16 uint32], :bool
129
+ attach_function :SDL_SetGamepadLED, %i[pointer uint8 uint8 uint8], :bool
130
+ attach_function :SDL_SendGamepadEffect, %i[pointer pointer int], :bool
131
+ attach_function :SDL_CloseGamepad, [:pointer], :void
132
+ attach_function :SDL_GetGamepadAppleSFSymbolsNameForButton, [:pointer, SDL_GamepadButton], :string
133
+ attach_function :SDL_GetGamepadAppleSFSymbolsNameForAxis, [:pointer, SDL_GamepadAxis], :string
134
+ end
135
+ end