Skip to content

Add SDL3Swift wrappers for OpenGL, keyboard, mouse, and misc APIs#13

Merged
colemancda merged 13 commits into
masterfrom
feature/sdl3
Jul 7, 2026
Merged

Add SDL3Swift wrappers for OpenGL, keyboard, mouse, and misc APIs#13
colemancda merged 13 commits into
masterfrom
feature/sdl3

Conversation

@colemancda

Copy link
Copy Markdown
Member

Summary

  • Adds OpenGL.swift wrapping SDL3's GL context management (SDL_GL_CreateContext/MakeCurrent/SwapWindow/attributes/swap interval), previously uncovered.
  • Adds Keyboard.swift and Mouse.swift for polled input state (SDL_GetKeyboardState, SDL_GetMouseState, relative mouse mode, mouse grab).
  • Adds Time.swift, Log.swift, MessageBox.swift, Rect.swift, Properties.swift, Joystick.swift.
  • Extends Gamepad.swift (name, rumble, player index, mapping files), Window.swift (fullscreen, position, sync), VideoDisplay.swift (bounds, usable bounds, per-window display, current video driver), and Event.swift (mouse wheel, text input, window close requested).

Test plan

  • swift build (whole package) succeeds
  • swift test --filter SDL3Tests passes
  • Manual runtime smoke test: GL context creation/make-current/swap, keyboard state + scancode names, mouse state, ticks, logging, display bounds, video driver, window position/fullscreen/sync, joystick enumeration all verified working against the local SDL3 install

colemancda added 13 commits July 7, 2026 19:44
Wraps SDL_GL_CreateContext/MakeCurrent/DestroyContext/SwapWindow and the
attribute get/set + swap interval APIs, which had no coverage before.
Wraps SDL_GetKeyboardState/SDL_GetScancodeName and adds ~50 named
Scancode constants for keybinding use cases.
Wraps SDL_GetMouseState/GetRelativeMouseState and window relative-mouse-mode
and mouse-grab setters.
Adds SDL_GetGamepadName/Properties/RumbleGamepad/SetGamepadPlayerIndex,
axis/button string lookups, and the mapping-file/isGamepad helpers.
Adds SDL_SetWindowFullscreen, SDL_GetWindowPosition, and SDL_SyncWindow.
Needed as the return type for the new display bounds accessors.
Adds SDL_GetDisplayBounds/GetDisplayUsableBounds/GetDisplayForWindow and
SDL_GetCurrentVideoDriver.
Wraps SDL_GetTicks/SDL_Delay (millisecond variants, alongside SDL's existing
nanosecond wrappers) and SDL_GetCurrentTime/SDL_TimeToDateTime.
SDL's logging functions are C-variadic and unavailable in Swift, so this
routes through SDL_LogMessageV via withVaList with a fixed "%s" format.
Wraps SDL_ShowSimpleMessageBox.
Wraps SDL_GetBooleanProperty, used by Gamepad.hasRumble.
Wraps SDL_GetJoysticks/SDL_GetJoystickNameForID, distinct from the
higher-level Gamepad API.
Adds SDL_EVENT_MOUSE_WHEEL, SDL_EVENT_TEXT_INPUT, and
SDL_EVENT_WINDOW_CLOSE_REQUESTED cases, previously falling through to
.unknown.
@colemancda colemancda merged commit cec18d0 into master Jul 7, 2026
6 checks passed
@colemancda colemancda deleted the feature/sdl3 branch July 7, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant