Skip to content

feat(platform): translate SDL input events and queue to GameHost - #126

Merged
isrcalebe merged 1 commit into
developfrom
feat/120-sdl-input-translation-queue
Nov 18, 2026
Merged

isrcalebe merged 1 commit into
developfrom
feat/120-sdl-input-translation-queue

Conversation

@isrcalebe

Copy link
Copy Markdown
Contributor

Summary

  • Extend IPlatformBackend and SdlPlatformBackend to translate SDL3 mouse motion, mouse buttons, mouse wheel, keyboard scancodes/modifiers/repeat, UTF-8 text input (decoded immediately on InputThread), and window focus/cursor events into internal PlatformInputEvent payloads while keeping SDL3-CS strictly internal.
  • Add a per-instance double-buffered FIFO input queue on GameHost bridging InputThread (pumpEvents()) to UpdateThread (Game.InvokeUpdate()) before Game.Update() and Root.UpdateSubTree(), with capture-time HiDPI pointer scaling and Window.Id filtering.
  • Wire physical pixel size tracking (PixelWidth/PixelHeight), focus tracking (HasFocus/FocusChanged), and thread-safe StartTextInput()/StopTextInput() lifecycle management on GameWindow (automatically stopping on Destroy()).
  • Add deterministic synthetic input injection methods on HeadlessGameHost (InjectMouseMove, InjectMouseDown, InjectMouseUp, InjectMouseScroll, InjectKeyDown, InjectKeyUp, InjectTextInput, InjectWindowFocus, InjectWindowMouseLeave).
  • Add unit, multi-threaded host, and NativeAOT smoke tests covering SDL event translation, HiDPI scaling, text input lifecycle, FIFO queue handoff, and headless injection.

Closes #120

Checklist

  • Labeled with one primary type label (feature, fix, docs, ci, chore, dependencies), plus breaking-change if applicable
  • Labeled with relevant area:* labels
  • Linked to an issue (Closes #120)
  • Public API changes are intentional (none, or listed below)
  • Tests added or updated
  • No new reflection or runtime code generation on the main path (NativeAOT-safe)

Public API changes

  • kajarlabs.Framework.Platform.GameWindow:
    • PixelWidth, PixelHeight, HasFocus, IsTextInputActive
    • PixelSizeChanged, FocusChanged
    • StartTextInput(), StopTextInput()
  • kajarlabs.Framework.Platform.HeadlessGameHost:
    • InjectMouseMove(...), InjectMouseDown(...), InjectMouseUp(...), InjectMouseScroll(...)
    • InjectKeyDown(...), InjectKeyUp(...), InjectTextInput(...)
    • InjectWindowFocus(...), InjectWindowMouseLeave()

@isrcalebe isrcalebe added feature New functionality area:platform Host, window, SDL integration area:threading Game threads and scheduling area:input Input handling and propagation labels Nov 18, 2026
@isrcalebe
isrcalebe merged commit 0acf476 into develop Nov 18, 2026
3 of 6 checks passed
@isrcalebe
isrcalebe deleted the feat/120-sdl-input-translation-queue branch November 18, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:input Input handling and propagation area:platform Host, window, SDL integration area:threading Game threads and scheduling feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Platform: translate SDL input events and queue to GameHost

1 participant