Skip to content

v0.23.0

Choose a tag to compare

@marcelocantos marcelocantos released this 11 May 10:40
· 174 commits to master since this release
df1c11c

ge::Button + ge::ButtonGroup — standard touch-button interactor

iOS-style press semantics, rendering-agnostic. Replaces inline button hit-testing across ge consumers.

Added

  • ge::Button (<ge/button.h>) — Press-button state machine. Tap down inside the hit region highlights, drag outside un-highlights, drag back in re-highlights, release inside fires, release outside (or external cancel()) doesn't. Consumer supplies a hitTest predicate (rect, SVG element via lunasvg::Document::elementFromPoint, polygon, anything) and queries highlighted() from the render loop. tracking() reports whether a press is in flight. onFire / onHighlightChange callbacks for action triggers and one-shot side effects.
  • ge::ButtonGroup (<ge/button.h>) — Borrows a std::vector<Button*> and routes PointerEvents with single-button-lock semantics: once a button claims a touch, all subsequent events for any finger are routed to it until it returns to idle. Single-touch by design — additional fingers are ignored.
  • ge::PointerEvent (<ge/button.h>) — Tiny pre-converted struct ({kind, pos, id}). Consumer converts SDL_Event → PointerEvent once at the dispatch site (mouse uses ge::kMouseId sentinel; touch copies SDL_TouchFingerEvent::fingerID). Keeps the engine out of the coord-space conversion business — consumer's pixel space stays authoritative.
  • ge::rectHitTest(Rect) — Convenience helper for the most common case. For dynamic rects, reassign per frame or write the lambda inline.

Why pre-converted PointerEvent instead of SDL_Event?

Touch events report normalized (0..1) coords; mouse events report pixel coords. The engine can't convert without knowing the consumer's surface size, and consumers like multimaze already do this conversion at their dispatch site. Pre-converted PointerEvent keeps that conversion exactly once at the consumer's chosen boundary.

Migration

Consumers replace inline button-hit-test + state-tracking with a ge::Button or ge::ButtonGroup. For multimaze specifically, this subsumes the TopBar::dispatchTap logic and the menu button hit-testing in Application.cpp. The migration happens post-release in multimaze's repo.