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

raylib keyboard, read straight off the native state queries. More...

#include <RayKeyboard.hpp>

Inheritance diagram for RayKeyboard:
Collaboration diagram for RayKeyboard:

Public Member Functions

 RayKeyboard ()=default
 ~RayKeyboard () 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 isKeyDown (Keys key) const override
 Check if the key is down.
bool isKeyReleased (Keys key) const override
 Check if the key is released.
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

raylib keyboard, read straight off the native state queries.

IsKeyPressed() compares currentKeyState and previousKeyState, two array lookups : nothing is consumed, so any number of readers get the same answer anywhere in the frame. raylib swaps the two arrays inside EndDrawing(), which is why the frame boundary is endDraw().

This is the behaviour the contract asks for, and the one the other vendors are aligned on.

Constructor & Destructor Documentation

◆ RayKeyboard()

RayKeyboard::RayKeyboard ( )
default

◆ ~RayKeyboard()

RayKeyboard::~RayKeyboard ( )
overridedefault

Member Function Documentation

◆ isKeyDown()

bool RayKeyboard::isKeyDown ( Keys key) const
inlineoverridevirtual

Check if the key is down.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyPressed()

bool RayKeyboard::isKeyPressed ( Keys key) const
inlineoverridevirtual

Check if the key is pressed.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyReleased()

bool RayKeyboard::isKeyReleased ( Keys key) const
inlineoverridevirtual

Check if the key is released.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyUp()

bool RayKeyboard::isKeyUp ( Keys key) const
inlineoverridevirtual

Check if the key is up.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ whichKeyDown()

std::vector< Keys > RayKeyboard::whichKeyDown ( ) const
inlineoverridevirtual

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 file: