Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
IInputProvider Class Referenceabstract

Interface for querying low-level keyboard input. More...

#include <i_input_provider.h>

Inheritance diagram for IInputProvider:
[legend]

Public Member Functions

virtual ~IInputProvider ()=default
 
void set_input (std::unique_ptr< IInput > input)
 
std::optional< std::reference_wrapper< IInput > > input () const
 
virtual bool is_key_held (KeyCode key) const =0
 Returns whether the specified key is currently held down.
 
virtual bool is_key_pressed (KeyCode key) const =0
 Returns true on the frame the specified key transitions to pressed.
 
virtual KeyCode get_pressed_key () const =0
 Returns the first key pressed this frame.
 
virtual bool is_key_released (KeyCode key) const =0
 Returns true on the frame the specified key transitions to released.
 
virtual bool any_key_held () const =0
 Returns true if any key is currently held down.
 
virtual bool any_key_pressed () const =0
 Returns true if any key was pressed this frame.
 
virtual bool any_key_released () const =0
 Returns true on the frame any key transitions to released.
 
virtual bool is_mouse_held (MouseButton button) const =0
 Returns whether the specified mouse button is currently held down.
 
virtual bool is_mouse_pressed (MouseButton button) const =0
 Returns true on the frame the specified mouse button transitions to pressed.
 
virtual bool is_mouse_released (MouseButton button) const =0
 Returns true on the frame the specified mouse button transitions to released.
 
virtual bool any_mouse_held () const =0
 Returns true if any mouse button is currently held down.
 
virtual bool any_mouse_pressed () const =0
 Returns true if any mouse button was pressed this frame.
 
virtual bool any_mouse_released () const =0
 Returns true on the frame any mouse button transitions to released.
 
virtual const Pointmouse_position () const =0
 Returns the current mouse cursor position (X, Y) in window coordinates.
 
virtual std::pair< float, float > mouse_delta () const =0
 Returns the change in mouse position since the last frame (deltaX, deltaY).
 
virtual bool mouse_moved () const =0
 Returns true if the mouse moved during the current frame.
 
virtual std::pair< float, float > mouse_scroll () const =0
 Returns the accumulated scroll offset along X and Y axes.
 
virtual std::pair< float, float > mouse_scroll_delta () const =0
 Returns the scroll delta since the last frame (deltaX, deltaY).
 
virtual MouseDirection mouse_scroll_direction () const =0
 Returns the last detected scroll direction as an integer enum.
 
virtual void reset_state ()=0
 Clears all input states (useful when changing scenes or focus).
 
virtual void register_events ()=0
 Registers necessary event listeners with the underlying system.
 
virtual void update ()=0
 Polls the underlying system for input updates.
 

Detailed Description

Interface for querying low-level keyboard input.

Defines a unified polling API for backend-specific input providers (e.g., SDL, GLFW, or platform-native implementations).

Constructor & Destructor Documentation

◆ ~IInputProvider()

virtual IInputProvider::~IInputProvider ( )
virtualdefault

Member Function Documentation

◆ any_key_held()

virtual bool IInputProvider::any_key_held ( ) const
pure virtual

Returns true if any key is currently held down.

Handy for pausing or skipping scenes on any user interaction.

Implemented in InputSystem.

◆ any_key_pressed()

virtual bool IInputProvider::any_key_pressed ( ) const
pure virtual

Returns true if any key was pressed this frame.

Used for detecting first input or simple "Press any key" prompts.

Implemented in InputSystem.

◆ any_key_released()

virtual bool IInputProvider::any_key_released ( ) const
pure virtual

Returns true on the frame any key transitions to released.

Useful for detecting global input releases or cancellation events.

Implemented in InputSystem.

◆ any_mouse_held()

virtual bool IInputProvider::any_mouse_held ( ) const
pure virtual

Returns true if any mouse button is currently held down.

Useful for generic interaction detection or camera controls.

Implemented in InputSystem.

◆ any_mouse_pressed()

virtual bool IInputProvider::any_mouse_pressed ( ) const
pure virtual

Returns true if any mouse button was pressed this frame.

Detects first mouse interaction or UI click triggers.

Implemented in InputSystem.

◆ any_mouse_released()

virtual bool IInputProvider::any_mouse_released ( ) const
pure virtual

Returns true on the frame any mouse button transitions to released.

Helps detect end of drag or click-release events.

Implemented in InputSystem.

◆ get_pressed_key()

virtual KeyCode IInputProvider::get_pressed_key ( ) const
pure virtual

Returns the first key pressed this frame.

Useful for detecting initial input.

Implemented in InputSystem.

◆ input()

std::optional< std::reference_wrapper< IInput > > IInputProvider::input ( ) const

◆ is_key_held()

virtual bool IInputProvider::is_key_held ( KeyCode  key) const
pure virtual

Returns whether the specified key is currently held down.

Suitable for continuous input such as movement or sustained actions.

Implemented in InputSystem.

◆ is_key_pressed()

virtual bool IInputProvider::is_key_pressed ( KeyCode  key) const
pure virtual

Returns true on the frame the specified key transitions to pressed.

Supports one-shot actions such as jumping or confirming selections.

Implemented in InputSystem.

◆ is_key_released()

virtual bool IInputProvider::is_key_released ( KeyCode  key) const
pure virtual

Returns true on the frame the specified key transitions to released.

Useful for detecting input releases or cancellation events.

Implemented in InputSystem.

◆ is_mouse_held()

virtual bool IInputProvider::is_mouse_held ( MouseButton  button) const
pure virtual

Returns whether the specified mouse button is currently held down.

Suitable for continuous input such as aiming or dragging.

Implemented in InputSystem.

◆ is_mouse_pressed()

virtual bool IInputProvider::is_mouse_pressed ( MouseButton  button) const
pure virtual

Returns true on the frame the specified mouse button transitions to pressed.

Supports one-shot actions such as firing or selecting.

Implemented in InputSystem.

◆ is_mouse_released()

virtual bool IInputProvider::is_mouse_released ( MouseButton  button) const
pure virtual

Returns true on the frame the specified mouse button transitions to released.

Useful for detecting clicks, drops, or interaction ends.

Implemented in InputSystem.

◆ mouse_delta()

virtual std::pair< float, float > IInputProvider::mouse_delta ( ) const
pure virtual

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.

Implemented in InputSystem.

◆ mouse_moved()

virtual bool IInputProvider::mouse_moved ( ) const
pure virtual

Returns true if the mouse moved during the current frame.

Useful for conditional logic that only triggers when the cursor changes position.

Implemented in InputSystem.

◆ mouse_position()

virtual const Point & IInputProvider::mouse_position ( ) const
pure virtual

Returns the current mouse cursor position (X, Y) in window coordinates.

Useful for UI interaction, cursor tracking, or camera control.

Implemented in InputSystem.

◆ mouse_scroll()

virtual std::pair< float, float > IInputProvider::mouse_scroll ( ) const
pure virtual

Returns the accumulated scroll offset along X and Y axes.

Useful for continuous scrolling or zooming interactions.

Implemented in InputSystem.

◆ mouse_scroll_delta()

virtual std::pair< float, float > IInputProvider::mouse_scroll_delta ( ) const
pure virtual

Returns the scroll delta since the last frame (deltaX, deltaY).

Useful for detecting incremental scroll events for UI or gameplay.

Implemented in InputSystem.

◆ mouse_scroll_direction()

virtual MouseDirection IInputProvider::mouse_scroll_direction ( ) const
pure virtual

Returns the last detected scroll direction as an integer enum.

Can be used to determine the general scroll direction (up, down, left, right).

Implemented in InputSystem.

◆ register_events()

virtual void IInputProvider::register_events ( )
pure virtual

Registers necessary event listeners with the underlying system.

Must be called during initialization to ensure input events are captured.

Implemented in InputSystem.

◆ reset_state()

virtual void IInputProvider::reset_state ( )
pure virtual

Clears all input states (useful when changing scenes or focus).

Ensures stale input doesn’t carry over between menus or gameplay.

Implemented in InputSystem.

◆ set_input()

void IInputProvider::set_input ( std::unique_ptr< IInput input)

◆ update()

virtual void IInputProvider::update ( )
pure virtual

Polls the underlying system for input updates.

Usually called once per frame before querying input state.

Implemented in InputSystem.


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