Ocean
Ocean::Platform::Keyboard Class Reference

This class implements keyboard functionalities. More...

Inheritance diagram for Ocean::Platform::Keyboard:

Public Types

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 Public Member Functions

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 Protected Member Functions

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.

Not available on the following platforms: Android, IOS.

Member Enumeration Documentation

◆ Key

Definition of individual keyboard keys.

Enumerator
KEY_NONE 

No key.

KEY_SHIFT_LEFT 

The left shift key.

KEY_SHIFT_RIGHT 

The right shift key.

KEY_CONTROL_LEFT 

The left control key.

KEY_CONTROL_RIGHT 

The right control key.

KEY_MENU_LEFT 

The left menu key.

KEY_MENU_RIGHT 

The right menu key.

KEY_SPACE 

The space key.

KEY_LAST_UNIQUE_VALUE 

Last key value.

KEY_SHIFT 

Both shift keys (left and right), beware: is not a unique (single) key.

KEY_CONTROL 

Both control keys (left and right), beware: is not a unique (single) key.

KEY_MENU 

Both menu keys (left and right), beware: is not a unique (single) key.

Member Function Documentation

◆ allKeysDown()

static bool Ocean::Platform::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::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::Keyboard::isKeyDown ( const Key  key,
const bool  synchron = true 
)
static

Returns whether 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

◆ isKeyDownApple()

static bool Ocean::Platform::Keyboard::isKeyDownApple ( const Key  key,
const bool  synchron = true 
)
staticprotected

Returns whether exactly one (specified key) is currently pushed (down) or not (specialization for Apple platforms)

See also
isKeyDown()
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

◆ isKeyDownWindows()

static bool Ocean::Platform::Keyboard::isKeyDownWindows ( const Key  key,
const bool  synchron = true 
)
staticprotected

Returns whether exactly one (specified key) is currently pushed (down) or not (specialization for Windows)

See also
isKeyDown()
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

◆ keyStateApple()

static bool Ocean::Platform::Keyboard::keyStateApple ( const unsigned short  nVirtualKey,
const bool  synchron 
)
staticprotected

Returns whether 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

◆ keyStateWindows()

static bool Ocean::Platform::Keyboard::keyStateWindows ( const int  nVirtualKey,
const bool  synchron 
)
staticprotected

Returns whether 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::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

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