asge::input::InputState
Queryable keyboard/mouse state, built by feeding it the SystemEvent stream.
#include <InputState.hpp>Not a second input source: NewFrame()/Consume() accumulate the same SystemEvents Application::Run already pumps through IGame::OnSystemEvent, so games can poll (IsKeyDown, ...) instead of hand-tracking bools themselves.
Private Attributes
Public Member Functions
InputState()=defaultInputState(InputState const &)=defaultInputState(InputState &&)=defaultInputState & operator=(InputState const &)=defaultInputState & operator=(InputState &&)=default~InputState()=defaultvoid Consume(event::SystemEvent const &inEvent) noexceptFolds one SystemEvent's key/mouse data into the current-frame state.
void NewFrame() noexceptCall once per frame, before pumping this frame's events, to roll current into previous.
bool IsKeyDown(Keycode inKey) const noexceptTrue while inKey is held down.
bool IsKeyPressed(Keycode inKey) const noexceptTrue only on the frame inKey went from up to down.
bool IsKeyReleased(Keycode inKey) const noexceptTrue only on the frame inKey went from down to up.
bool IsMouseButtonDown(MouseButton inButton) const noexceptTrue while inButton is held down.
bool IsMouseButtonPressed(MouseButton inButton) const noexceptTrue only on the frame inButton went from up to down.
bool IsMouseButtonReleased(MouseButton inButton) const noexceptTrue only on the frame inButton went from down to up.
math::Float2 GetMousePosition() const noexceptMouse position, relative to the window.
math::Float2 GetMouseDelta() const noexceptMouse movement since the last NewFrame().
math::Float2 GetScrollDelta() const noexceptWheel scroll accumulated since the last NewFrame().