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

Maps the contract's keys to sfml scancodes, and reads the state the window accumulated while popping its events. More...

#include <SfmlKeyboard.hpp>

Inheritance diagram for SfmlKeyboard:
Collaboration diagram for SfmlKeyboard:

Public Member Functions

 SfmlKeyboard (const SfmlWindow &window)
 ~SfmlKeyboard () 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

Maps the contract's keys to sfml scancodes, and reads the state the window accumulated while popping its events.

The window is handed over at construction (the module passes it), so the link can never be missing. The methods are defined in SfmlWindow.hpp, once SfmlWindow is complete.

The reference is CONST : querying the keyboard cannot consume anything, and the compiler guarantees it. Only pollEvent() and endDraw() mutate, on the window side. That is what lets an arcade and the game running inside it read the same key in the same frame.

Modifiers are keys like any other : Shift+E is isKeyDown(KEY_LEFT_SHIFT) and isKeyPressed(KEY_E), composed by the caller.

Constructor & Destructor Documentation

◆ SfmlKeyboard()

SfmlKeyboard::SfmlKeyboard ( const SfmlWindow & window)
inline

◆ ~SfmlKeyboard()

SfmlKeyboard::~SfmlKeyboard ( )
overridedefault

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