P-E-R-R-Y
Utilitaires, contrats et vendors du moteur, en une seule doc
Loading...
Searching...
No Matches
SdlKeyboard Class Reference

Le clavier d'UNE fenetre. More...

#include <SdlKeyboard.hpp>

Inheritance diagram for SdlKeyboard:
Collaboration diagram for SdlKeyboard:

Public Member Functions

 SdlKeyboard (const SdlWindow &window)
 ~SdlKeyboard () override=default
std::vector< Keys > whichKeyDown () const override
 Every key HELD right now - like isKeyDown, without having to name the key.
bool isKeyPressed (Keys key) const override
 Check if the key is pressed.
bool isKeyReleased (Keys key) const override
 Check if the key is released.
bool isKeyDown (Keys key) const override
 Check if the key is down.
bool isKeyUp (Keys key) const override
 Check if the key is up.
 SdlKeyboard (const SdlWindow &window)
 ~SdlKeyboard () override=default
std::vector< Keys > whichKeyDown () const override
 Every key HELD right now - like isKeyDown, without having to name the key.
bool isKeyPressed (Keys key) const override
 Check if the key is pressed.
bool isKeyReleased (Keys key) const override
 Check if the key is released.
bool isKeyDown (Keys key) const override
 Check if the key is down.
bool isKeyUp (Keys key) const override
 Check if the key is up.
Public Member Functions inherited from graphic::IKeyboard
virtual ~IKeyboard ()
 Destroy the IKeyboard object.

Additional Inherited Members

Public Types inherited from graphic::IKeyboard
enum  Keys {
  KEY_UNKNOWN = -1 , KEY_ESCAPE , KEY_F1 , KEY_F2 ,
  KEY_F3 , KEY_F4 , KEY_F5 , KEY_F6 ,
  KEY_F7 , KEY_F8 , KEY_F9 , KEY_F10 ,
  KEY_F11 , KEY_F12 , KEY_1 , KEY_2 ,
  KEY_3 , KEY_4 , KEY_5 , KEY_6 ,
  KEY_7 , KEY_8 , KEY_9 , KEY_0 ,
  KEY_MINUS , KEY_EQUAL , KEY_BACKSPACE , KEY_TAB ,
  KEY_Q , KEY_W , KEY_E , KEY_R ,
  KEY_T , KEY_Y , KEY_U , KEY_I ,
  KEY_O , KEY_P , KEY_LEFT_BRACKET , KEY_RIGHT_BRACKET ,
  KEY_CAPS_LOCK , KEY_LEFT_CONTROL , KEY_A , KEY_S ,
  KEY_D , KEY_F , KEY_G , KEY_H ,
  KEY_J , KEY_K , KEY_L , KEY_SEMICOLON ,
  KEY_APOSTROPHE , KEY_BACKTICK , KEY_ENTER , KEY_LEFT_SHIFT ,
  KEY_BACKSLASH , KEY_Z , KEY_X , KEY_C ,
  KEY_V , KEY_B , KEY_N , KEY_M ,
  KEY_COMMA , KEY_PERIOD , KEY_SLASH , KEY_RIGHT_SHIFT ,
  KEY_LEFT_ALT , KEY_LEFT_SUPER , KEY_SPACE , KEY_RIGHT_ALT ,
  KEY_RIGHT_SUPER , KEY_RIGHT_CONTROL , KEY_PAD_0 , KEY_PAD_1 ,
  KEY_PAD_2 , KEY_PAD_3 , KEY_PAD_4 , KEY_PAD_5 ,
  KEY_PAD_6 , KEY_PAD_7 , KEY_PAD_8 , KEY_PAD_9 ,
  KEY_PAD_MINUS , KEY_PAD_PLUS , KEY_PAD_DOT , KEY_PAD_ENTER ,
  KEY_UP , KEY_DOWN , KEY_LEFT , KEY_RIGHT ,
  KEY_COUNT
}
 Scan codes. More...

Detailed Description

Le clavier d'UNE fenetre.

Rien n'est lu par SDL_GetKeyboardState() : cet etat est global au processus, donc la borne et le jeu liraient la meme chose meme si le focus est sur l'un des deux. Tout vient des evenements que la fenetre a recus, ce qui est aussi ce que fait le vendor sfml.

Constructor & Destructor Documentation

◆ SdlKeyboard() [1/2]

SdlKeyboard::SdlKeyboard ( const SdlWindow & window)
inline

◆ ~SdlKeyboard() [1/2]

SdlKeyboard::~SdlKeyboard ( )
overridedefault

◆ SdlKeyboard() [2/2]

SdlKeyboard::SdlKeyboard ( const SdlWindow & window)
inline

◆ ~SdlKeyboard() [2/2]

SdlKeyboard::~SdlKeyboard ( )
overridedefault

Member Function Documentation

◆ isKeyDown()

bool SdlKeyboard::isKeyDown ( Keys key) const
overridevirtual

Check if the key is down.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyPressed()

bool SdlKeyboard::isKeyPressed ( Keys key) const
overridevirtual

Check if the key is pressed.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyReleased()

bool SdlKeyboard::isKeyReleased ( Keys key) const
overridevirtual

Check if the key is released.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyUp()

bool SdlKeyboard::isKeyUp ( Keys key) const
overridevirtual

Check if the key is up.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ whichKeyDown()

std::vector< Keys > SdlKeyboard::whichKeyDown ( ) const
overridevirtual

Every key HELD right now - like isKeyDown, without having to name the key.

A held key stays in the list every frame. For a debug overlay, a state readout, chord detection.

Walks the whole keyboard : avoid in a hot loop, isKeyDown is a direct lookup.

Returns
std::vector<Keys>

Implements graphic::IKeyboard.


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