Ocean
Ocean::Platform::Mouse Class Reference

This class implements mouse functionalities. More...

Inheritance diagram for Ocean::Platform::Mouse:

Public Types

enum  Button {
  BUTTON_NONE = 0 , BUTTON_LEFT = (1 << 0) , BUTTON_MIDDLE = (1 << 1) , BUTTON_RIGHT = (1 << 2) ,
  BUTTON_LAST_UNIQUE_VALUE = (1 << 2)
}
 Definition of individual mouse buttons. More...
 

Static Public Member Functions

static bool allButtonsDown (const Button buttons, const bool synchron=true)
 Returns whether all specified buttons of the mouse are currently pushed (down) or not. More...
 
static bool oneButtonDown (const Button buttons, const bool synchron=true)
 Returns whether at least one button of the specified buttons of the mouse is currently pushed (down) or not. More...
 
static bool isButtonDown (const Button button, const bool synchron=true)
 Returns whether exactly one (specified button) is currently pushed (down) or not. More...
 
static Button currentMouseButtonState (const bool synchron=true)
 Returns the current mouse button state for the left, middle and right mouse button. More...
 
static VectorI2 screenPosition (const VectorI2 &invalidPosition=VectorI2(NumericT< int >::minValue(), NumericT< int >::minValue()))
 Returns the current position of the mouse/cursor in screen coordinates. More...
 

Static Protected Member Functions

static bool isButtonDownWindows (const Button button, const bool synchron=true)
 Returns whether exactly one (specified button) 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 VectorI2 screenPositionWindows (const VectorI2 &invalidPosition=VectorI2(NumericT< int >::minValue(), NumericT< int >::minValue()))
 Returns the current position of the mouse/cursor in screen coordinates (specialization for Windows). More...
 
static bool isButtonDownApple (const Button button, const bool synchron=true)
 Returns whether exactly one (specified button) is currently pushed (down) or not (specialization for Apple platforms). More...
 
static VectorI2 screenPositionApple (const VectorI2 &invalidPosition=VectorI2(NumericT< int >::minValue(), NumericT< int >::minValue()))
 Returns the current position of the mouse/cursor in screen coordinates (specialization for Apple platforms). More...
 

Detailed Description

This class implements mouse functionalities.

Not available on the following platforms: Android, IOS.

Member Enumeration Documentation

◆ Button

Definition of individual mouse buttons.

Enumerator
BUTTON_NONE 

No key.

BUTTON_LEFT 

The left mouse button.

BUTTON_MIDDLE 

The middle mouse button.

BUTTON_RIGHT 

The right mouse button.

BUTTON_LAST_UNIQUE_VALUE 

Last key value.

Member Function Documentation

◆ allButtonsDown()

static bool Ocean::Platform::Mouse::allButtonsDown ( const Button  buttons,
const bool  synchron = true 
)
static

Returns whether all specified buttons of the mouse are currently pushed (down) or not.

Parameters
buttonsThe buttons for that the states are requested (may be a combination of several buttons)
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 button is provided

◆ currentMouseButtonState()

static Button Ocean::Platform::Mouse::currentMouseButtonState ( const bool  synchron = true)
static

Returns the current mouse button state for the left, middle and right mouse button.

Parameters
synchronTrue, to request the state synchronously with the message queue; False, to request the state in the current moment
Returns
Current mouse button state

◆ isButtonDown()

static bool Ocean::Platform::Mouse::isButtonDown ( const Button  button,
const bool  synchron = true 
)
static

Returns whether exactly one (specified button) is currently pushed (down) or not.

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

◆ isButtonDownApple()

static bool Ocean::Platform::Mouse::isButtonDownApple ( const Button  button,
const bool  synchron = true 
)
staticprotected

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

See also
isButtonDown()
Parameters
buttonOne unique button for that the state is requested, must not be a combination of several buttons
synchronTrue, to request the state synchronously with the message queue; False, to request the state in the current moment
Returns
True, if so

◆ isButtonDownWindows()

static bool Ocean::Platform::Mouse::isButtonDownWindows ( const Button  button,
const bool  synchron = true 
)
staticprotected

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

See also
isButtonDown()
Parameters
buttonOne unique button for that the state is requested, must not be a combination of several buttons
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::Mouse::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

◆ oneButtonDown()

static bool Ocean::Platform::Mouse::oneButtonDown ( const Button  buttons,
const bool  synchron = true 
)
static

Returns whether at least one button of the specified buttons of the mouse is currently pushed (down) or not.

Parameters
buttonsThe buttons for that the states are requested (may be a combination of several buttons)
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 button is provided

◆ screenPosition()

static VectorI2 Ocean::Platform::Mouse::screenPosition ( const VectorI2 invalidPosition = VectorI2(NumericT< int >::minValue(), NumericT< int >::minValue()))
static

Returns the current position of the mouse/cursor in screen coordinates.

Parameters
invalidPositionThe invalid mouse/cursor position if currently no mouse/cursor position exists or can be determined.
Returns
Mouse screen coordinates

◆ screenPositionApple()

static VectorI2 Ocean::Platform::Mouse::screenPositionApple ( const VectorI2 invalidPosition = VectorI2(NumericT< int >::minValue(), NumericT< int >::minValue()))
staticprotected

Returns the current position of the mouse/cursor in screen coordinates (specialization for Apple platforms).

See also
screenPosition()
Parameters
invalidPositionThe invalid mouse/cursor position if currently no mouse/cursor position exists or can be determined.
Returns
Mouse screen coordinates

◆ screenPositionWindows()

static VectorI2 Ocean::Platform::Mouse::screenPositionWindows ( const VectorI2 invalidPosition = VectorI2(NumericT< int >::minValue(), NumericT< int >::minValue()))
staticprotected

Returns the current position of the mouse/cursor in screen coordinates (specialization for Windows).

See also
screenPosition()
Parameters
invalidPositionThe invalid mouse/cursor position if currently no mouse/cursor position exists or can be determined.
Returns
Mouse screen coordinates

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