|
Capycore Engine
0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
|
SDL-backed implementation of the input provider interface. More...
#include <input_system.h>
Public Member Functions | |
| bool | is_key_held (KeyCode key) const override |
| Returns whether the specified key is currently held down. | |
| KeyCode | get_pressed_key () const override |
| Returns the first key pressed this frame. | |
| bool | is_key_pressed (KeyCode key) const override |
| Returns true on the frame the specified key transitions to pressed. | |
| bool | is_key_released (KeyCode key) const override |
| Returns true on the frame the specified key transitions to released. | |
| bool | any_key_held () const override |
| Returns true if any key is currently held down. | |
| bool | any_key_pressed () const override |
| Returns true if any key was pressed this frame. | |
| bool | any_key_released () const override |
| Returns true on the frame any key transitions to released. | |
| bool | is_mouse_held (MouseButton button) const override |
| Returns whether the specified mouse button is currently held down. | |
| bool | is_mouse_pressed (MouseButton button) const override |
| Returns true on the frame the specified mouse button transitions to pressed. | |
| bool | is_mouse_released (MouseButton button) const override |
| Returns true on the frame the specified mouse button transitions to released. | |
| bool | any_mouse_held () const override |
| Returns true if any mouse button is currently held down. | |
| bool | any_mouse_pressed () const override |
| Returns true if any mouse button was pressed this frame. | |
| bool | any_mouse_released () const override |
| Returns true on the frame any mouse button transitions to released. | |
| const Point & | mouse_position () const override |
| Returns the current mouse cursor position (X, Y) in window coordinates. | |
| std::pair< float, float > | mouse_delta () const override |
| Returns the change in mouse position since the last frame (deltaX, deltaY). | |
| bool | mouse_moved () const override |
| Returns true if the mouse moved during the current frame. | |
| std::pair< float, float > | mouse_scroll () const override |
| Returns the accumulated scroll offset along X and Y axes. | |
| std::pair< float, float > | mouse_scroll_delta () const override |
| Returns the scroll delta since the last frame (deltaX, deltaY). | |
| MouseDirection | mouse_scroll_direction () const override |
| Returns the last detected scroll direction as an integer enum. | |
| void | reset_state () override |
| Clears all input states (useful when changing scenes or focus). | |
| void | register_events () override |
| Registers necessary event listeners with the underlying system. | |
| void | update () override |
| Polls the underlying system for input updates. | |
Public Member Functions inherited from IInputProvider | |
| virtual | ~IInputProvider ()=default |
| void | set_input (std::unique_ptr< IInput > input) |
| std::optional< std::reference_wrapper< IInput > > | input () const |
Protected Attributes | |
| std::map< KeyCode, KeyState > | key_states_ |
| Per-key state cache for frame-level input tracking. | |
| MouseState | mouse_state_ |
| Mouse state cache for frame-level input tracking. | |
SDL-backed implementation of the input provider interface.
Polls keyboard state from SDL each frame and tracks key transitions. Acts as the bridge between SDL event data and the engine’s logical input model.
|
overridevirtual |
Returns true if any key is currently held down.
Handy for pausing or skipping scenes on any user interaction.
Implements IInputProvider.
|
overridevirtual |
Returns true if any key was pressed this frame.
Used for detecting first input or simple "Press any key" prompts.
Implements IInputProvider.
|
overridevirtual |
Returns true on the frame any key transitions to released.
Useful for detecting global input releases or cancellation events.
Implements IInputProvider.
|
overridevirtual |
Returns true if any mouse button is currently held down.
Useful for generic interaction detection or camera controls.
Implements IInputProvider.
|
overridevirtual |
Returns true if any mouse button was pressed this frame.
Detects first mouse interaction or UI click triggers.
Implements IInputProvider.
|
overridevirtual |
Returns true on the frame any mouse button transitions to released.
Helps detect end of drag or click-release events.
Implements IInputProvider.
|
overridevirtual |
Returns the first key pressed this frame.
Useful for detecting initial input.
Implements IInputProvider.
|
overridevirtual |
Returns whether the specified key is currently held down.
Suitable for continuous input such as movement or sustained actions.
Implements IInputProvider.
|
overridevirtual |
Returns true on the frame the specified key transitions to pressed.
Supports one-shot actions such as jumping or confirming selections.
Implements IInputProvider.
|
overridevirtual |
Returns true on the frame the specified key transitions to released.
Useful for detecting input releases or cancellation events.
Implements IInputProvider.
|
overridevirtual |
Returns whether the specified mouse button is currently held down.
Suitable for continuous input such as aiming or dragging.
Implements IInputProvider.
|
overridevirtual |
Returns true on the frame the specified mouse button transitions to pressed.
Supports one-shot actions such as firing or selecting.
Implements IInputProvider.
|
overridevirtual |
Returns true on the frame the specified mouse button transitions to released.
Useful for detecting clicks, drops, or interaction ends.
Implements IInputProvider.
|
overridevirtual |
Returns the change in mouse position since the last frame (deltaX, deltaY).
Can be used to detect relative movement for camera rotation or drag operations.
Implements IInputProvider.
|
overridevirtual |
Returns true if the mouse moved during the current frame.
Useful for conditional logic that only triggers when the cursor changes position.
Implements IInputProvider.
|
overridevirtual |
Returns the current mouse cursor position (X, Y) in window coordinates.
Useful for UI interaction, cursor tracking, or camera control.
Implements IInputProvider.
|
overridevirtual |
Returns the accumulated scroll offset along X and Y axes.
Useful for continuous scrolling or zooming interactions.
Implements IInputProvider.
|
overridevirtual |
Returns the scroll delta since the last frame (deltaX, deltaY).
Useful for detecting incremental scroll events for UI or gameplay.
Implements IInputProvider.
|
overridevirtual |
Returns the last detected scroll direction as an integer enum.
Can be used to determine the general scroll direction (up, down, left, right).
Implements IInputProvider.
|
overridevirtual |
Registers necessary event listeners with the underlying system.
Must be called during initialization to ensure input events are captured.
Implements IInputProvider.
|
overridevirtual |
Clears all input states (useful when changing scenes or focus).
Ensures stale input doesn’t carry over between menus or gameplay.
Implements IInputProvider.
|
overridevirtual |
Polls the underlying system for input updates.
Usually called once per frame before querying input state.
Implements IInputProvider.
Per-key state cache for frame-level input tracking.
Indexed by logical key to decouple SDL scancodes from engine logic. Internal only—consumers should query through the public interface.
|
protected |
Mouse state cache for frame-level input tracking.
Tracks button states, cursor position, movement deltas, and scroll information. Indexed by logical mouse button to decouple backend events from engine logic. Internal only—consumers should query through the public interface.