Ocean
Ocean::Platform::Win::Keyboard Class Reference

This class implements keyboard functionalities. More...

Inheritance diagram for Ocean::Platform::Win::Keyboard:

Static Public Member Functions

static bool translateVirtualkey (const unsigned int vKey, std::string &key)
 Translates a virtual key code to the corresponsing character key and key description. More...
 
static bool allKeysDown (const Key keys, const bool synchron=true)
 Returns whether all specified keys of the keyboard are currently pushed (down) or not. More...
 
static bool oneKeyDown (const Key keys, const bool synchron=true)
 Returns whether at least one key of the specified keys of the keyboard is currently pushed (down) or not. More...
 
static bool isKeyDown (const Key key, const bool synchron=true)
 Returns wheater exactly one (specified key) is currently pushed (down) or not. More...
 
static Key currentKeyState (const bool synchron=true)
 Returns the current key state for the shift, control and menu keys. More...
 

Static Protected Member Functions

static bool keyState (const int nVirtualKey, const bool synchron)
 Returns wheater exactly one (specified key) is currently pushed (down) or not. More...
 

Additional Inherited Members

- Private Types inherited from Ocean::Platform::Keyboard
enum  Key {
  KEY_NONE = 0 , KEY_SHIFT_LEFT = (1 << 0) , KEY_SHIFT_RIGHT = (1 << 1) , KEY_CONTROL_LEFT = (1 << 2) ,
  KEY_CONTROL_RIGHT = (1 << 3) , KEY_MENU_LEFT = (1 << 4) , KEY_MENU_RIGHT = (1 << 5) , KEY_SPACE = (1 << 6) ,
  KEY_LAST_UNIQUE_VALUE = (1 << 6) , KEY_SHIFT = KEY_SHIFT_LEFT | KEY_SHIFT_RIGHT , KEY_CONTROL = KEY_CONTROL_LEFT | KEY_CONTROL_RIGHT , KEY_MENU = KEY_MENU_LEFT | KEY_MENU_RIGHT
}
 Definition of individual keyboard keys. More...
 
- Static Private Member Functions inherited from Ocean::Platform::Keyboard
static bool allKeysDown (const Key keys, const bool synchron=true)
 Returns whether all specified keys of the keyboard are currently pushed (down) or not. More...
 
static bool oneKeyDown (const Key keys, const bool synchron=true)
 Returns whether at least one key of the specified keys of the keyboard is currently pushed (down) or not. More...
 
static bool isKeyDown (const Key key, const bool synchron=true)
 Returns whether exactly one (specified key) is currently pushed (down) or not. More...
 
static Key currentKeyState (const bool synchron=true)
 Returns the current key state for the shift, control and menu keys. More...
 
static bool isKeyDownWindows (const Key key, const bool synchron=true)
 Returns whether exactly one (specified key) is currently pushed (down) or not (specialization for Windows) More...
 
static bool keyStateWindows (const int nVirtualKey, const bool synchron)
 Returns whether exactly one (specified key) is currently pushed (down) or not. More...
 
static bool isKeyDownApple (const Key key, const bool synchron=true)
 Returns whether exactly one (specified key) is currently pushed (down) or not (specialization for Apple platforms) More...
 
static bool keyStateApple (const unsigned short nVirtualKey, const bool synchron)
 Returns whether exactly one (specified key) is currently pushed (down) or not. More...
 

Detailed Description

This class implements keyboard functionalities.

Member Function Documentation

◆ allKeysDown()

static bool Ocean::Platform::Win::Keyboard::allKeysDown ( const Key  keys,
const bool  synchron = true 
)
static

Returns whether all specified keys of the keyboard are currently pushed (down) or not.

Parameters
keysThe keys for that the states are requested (may be a combination of several keys)
synchronTrue, to request the state synchronously with the message queue; False, to request the state in the current moment
Returns
True, if so; also True if no key is provided

◆ currentKeyState()

static Key Ocean::Platform::Win::Keyboard::currentKeyState ( const bool  synchron = true)
static

Returns the current key state for the shift, control and menu keys.

This function does not distinguish between the left and a right key version.

Returns
Current key state

◆ isKeyDown()

static bool Ocean::Platform::Win::Keyboard::isKeyDown ( const Key  key,
const bool  synchron = true 
)
static

Returns wheater exactly one (specified key) is currently pushed (down) or not.

Parameters
keyOne unique key for that the state is requested, must not be a combination of several keys
synchronTrue, to request the state synchronously with the message queue; False, to request the state in the current moment
Returns
True, if so

◆ keyState()

bool Ocean::Platform::Win::Keyboard::keyState ( const int  nVirtualKey,
const bool  synchron 
)
inlinestaticprotected

Returns wheater exactly one (specified key) is currently pushed (down) or not.

Parameters
nVirtualKeyThe virtual key code for that the state is requested
synchronTrue, to request the state synchronously with the message queue; False, to request the state in the current moment
Returns
True, if so

◆ oneKeyDown()

static bool Ocean::Platform::Win::Keyboard::oneKeyDown ( const Key  keys,
const bool  synchron = true 
)
static

Returns whether at least one key of the specified keys of the keyboard is currently pushed (down) or not.

Parameters
keysThe keys for that the states are requested (may be a combination of several keys)
synchronTrue, to request the state synchronously with the message queue; False, to request the state in the current moment
Returns
True, if so; also True if no key is provided

◆ translateVirtualkey()

static bool Ocean::Platform::Win::Keyboard::translateVirtualkey ( const unsigned int  vKey,
std::string &  key 
)
static

Translates a virtual key code to the corresponsing character key and key description.

Parameters
vKeyVirtual key code to translate
keyResulting key character or name
Returns
True, if succeeded

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