smk::Input Class Referenceabstract

#include <Input.hpp>

Inheritance diagram for smk::Input:

A class for querying input state (keyboard, mouse, touch). The Input class is tied to a smk::Window. You need to call regularly smk::Screen::PoolEvent to update the input state. More...

Description

A class for querying input state (keyboard, mouse, touch). The Input class is tied to a smk::Window. You need to call regularly smk::Screen::PoolEvent to update the input state.

To know keyboard and mouse buttons identifer, you need to refer to the GLFW definitions:

See also
smk::Window::PoolEvents()

Definition at line 29 of file Input.hpp.

Classes

class  CharacterListenerInterface
 Receive characters typed from the keyboard. All the keyboard modifiers are applied (Shift, Ctrl, Alt, ...). Useful for implementing input boxes. More...
 

Public Types

using FingerID = int
 
using CharacterListener = std::unique_ptr< CharacterListenerInterface >
 

Public Member Functions

virtual bool IsKeyHold (int key)=0
 Whether a keyboard button is down or not. More...
 
virtual bool IsKeyPressed (int key)=0
 Whether a keyboard button is pressed or not. More...
 
virtual bool IsKeyReleased (int key)=0
 Whether a keyboard button is released or not. More...
 
virtual bool IsMouseHeld (int key)=0
 Whether a mouse button is down or not. More...
 
virtual bool IsMousePressed (int key)=0
 Whether a mouse button is pressed or not. More...
 
virtual bool IsMouseReleased (int key)=0
 Whether a mouse button is released or not. More...
 
virtual glm::vec2 mouse () const =0
 The mouse position. More...
 
virtual std::map< FingerID, Touch > & touches ()=0
 The touch states. More...
 
virtual bool IsCursorHeld ()=0
 Whether the cursor is down or not. More...
 
virtual bool IsCursorPressed ()=0
 Whether the cursor is pressed or not. More...
 
virtual bool IsCursorReleased ()=0
 Whether the cursor is released or not. More...
 
virtual glm::vec2 cursor () const =0
 The cursor position. More...
 
virtual glm::vec2 scroll_offset () const =0
 The mouse/touchpad scrolling offset since the last frame. More...
 
virtual CharacterListener MakeCharacterListener ()=0
 

Member Typedef Documentation

◆ CharacterListener

using smk::Input::CharacterListener = std::unique_ptr<CharacterListenerInterface>

Definition at line 118 of file Input.hpp.

◆ FingerID

using smk::Input::FingerID = int

Definition at line 66 of file Input.hpp.

Constructor & Destructor Documentation

◆ ~Input()

virtual smk::Input::~Input ( )
inlinevirtual

Definition at line 31 of file Input.hpp.

31{}

Member Function Documentation

◆ cursor()

virtual glm::vec2 smk::Input::cursor ( ) const
pure virtual

The cursor position.

Returns
the cursor position.

Implemented in smk::InputImpl.

◆ IsCursorHeld()

virtual bool smk::Input::IsCursorHeld ( )
pure virtual

Whether the cursor is down or not.

Returns
true whenever the cursor is down.

Implemented in smk::InputImpl.

◆ IsCursorPressed()

virtual bool smk::Input::IsCursorPressed ( )
pure virtual

Whether the cursor is pressed or not.

Returns
true whenever the cursor is pressed.

Implemented in smk::InputImpl.

◆ IsCursorReleased()

virtual bool smk::Input::IsCursorReleased ( )
pure virtual

Whether the cursor is released or not.

Returns
true whenever the cursor is released.

Implemented in smk::InputImpl.

◆ IsKeyHold()

virtual bool smk::Input::IsKeyHold ( int  key)
pure virtual

Whether a keyboard button is down or not.

Returns
true whenever a keyboard button is hold.
Parameters
keyThe keyboard button.

Implemented in smk::InputImpl.

◆ IsKeyPressed()

virtual bool smk::Input::IsKeyPressed ( int  key)
pure virtual

Whether a keyboard button is pressed or not.

Returns
true whenever a keyboard button is pressed.
Parameters
keyThe keyboard button.

Implemented in smk::InputImpl.

◆ IsKeyReleased()

virtual bool smk::Input::IsKeyReleased ( int  key)
pure virtual

Whether a keyboard button is released or not.

Returns
true whenever a keyboard button is released
Parameters
keyThe keyboard button.

Implemented in smk::InputImpl.

◆ IsMouseHeld()

virtual bool smk::Input::IsMouseHeld ( int  key)
pure virtual

Whether a mouse button is down or not.

Returns
true whenever a mouse button is hold.
Parameters
keyThe mouse button.

Implemented in smk::InputImpl.

◆ IsMousePressed()

virtual bool smk::Input::IsMousePressed ( int  key)
pure virtual

Whether a mouse button is pressed or not.

Returns
true whenever a mouse button is pressed.
Parameters
keyThe mouse button.

Implemented in smk::InputImpl.

◆ IsMouseReleased()

virtual bool smk::Input::IsMouseReleased ( int  key)
pure virtual

Whether a mouse button is released or not.

Returns
true whenever a mouse button is released
Parameters
keyThe mouse button.

Implemented in smk::InputImpl.

◆ mouse()

virtual glm::vec2 smk::Input::mouse ( ) const
pure virtual

The mouse position.

Returns
the mouse position.

Implemented in smk::InputImpl.

◆ scroll_offset()

virtual glm::vec2 smk::Input::scroll_offset ( ) const
pure virtual

The mouse/touchpad scrolling offset since the last frame.

Returns
the scrolling offset.

Implemented in smk::InputImpl.

◆ touches()

virtual std::map< FingerID, Touch > & smk::Input::touches ( )
pure virtual

The touch states.

Returns
the touches states.

Implemented in smk::InputImpl.


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