ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::InputAccumulator Class Reference

Buffers asynchronous OS mouse/keyboard/text events and drains them once per frame into PointerState and InputEvents. More...

#include <InputAccumulator.hpp>

Public Types

using ButtonDownArray = std::array<bool, static_cast<size_t>(MouseButton::Count)>

Public Member Functions

void pushMouseMove (Vec2 logicalPos)
 Record logical pointer movement.
void pushMouseButton (MouseButton btn, bool down)
 Record a mouse button transition (down == true sets pressed, false sets released).
void pushMouseWheel (float deltaY)
 Accumulate vertical scroll wheel delta for the current frame.
void pushKey (int zenitKey, bool down)
 Record a ZenitUI Key::* press or release.
void pushChar (uint32_t codepoint)
 Record a single typed Unicode codepoint.
void pushTextUtf8 (std::string_view utf8)
 Decode a UTF-8 text input string into typed codepoints.
void pushComposition (std::string_view utf8, int cursor=-1, int selectionLen=0)
 Record an IME pre-edit (composition) update.
void cancelComposition ()
 Cancel any active IME composition.
PointerState drainPointer ()
 Drain queued edge-triggered mouse states using the internally tracked position and down flags.
PointerState drainPointer (Vec2 livePos, const ButtonDownArray &liveDown)
 Drain queued edge-triggered mouse states while supplying live OS position and button-down flags.
InputEvents drainEvents ()
 Drain queued key presses, typed chars, and IME composition updates.
InputEvents drainEvents (std::vector< int > liveHeldKeys)
 Drain queued key presses, typed chars, and IME updates with live held keys.
void clear ()
 Clear all pending and held state (e.g.

Detailed Description

Buffers asynchronous OS mouse/keyboard/text events and drains them once per frame into PointerState and InputEvents.

Member Function Documentation

◆ clear()

void ZenitUI::InputAccumulator::clear ( )
inline

Clear all pending and held state (e.g.

on window focus loss).

◆ pushComposition()

void ZenitUI::InputAccumulator::pushComposition ( std::string_view utf8,
int cursor = -1,
int selectionLen = 0 )
inline

Record an IME pre-edit (composition) update.

Empty utf8 ends composition.


The documentation for this class was generated from the following file: