The input class is closely coupled to a view to retrieve actions taken by the user directly from the underlying UIView or window that it concerns. More...

#include <Input.h>

Public Member Functions

 Input ()
 Constructor. More...
 
 Input (ViewPtr view)
 Constructor. More...
 
virtual ~Input ()
 Virtual destructor. More...
 
void setView (ViewPtr view)
 Set the view to get inputs from. More...
 
GLint getKeyState (GLint key)
 Gets the current state of a specified key. More...
 
GLint getMouseButtonState (GLint button)
 Gets the current state of a specified mouse button. More...
 
double getCursorPositionX ()
 Returns the current x-position of the cursor. More...
 
double getCursorPositionY ()
 Returns the current y-position of the cursor. More...
 
void getCursorPosition (double *x, double *y, bool *deviceHasCursor=nullptr)
 Returns the current position of the cursor. More...
 
double getGyroscopePitch (bool *deviceHasGyroscope=nullptr)
 Returns the pitch measured by the gyroscope of the mobile device. More...
 
double getGyroscopeYaw (bool *deviceHasGyroscope=nullptr)
 Returns the yaw measured by the gyroscope of the mobile device. More...
 
double getGyroscopeRoll (bool *deviceHasGyroscope=nullptr)
 Returns the roll measured by the gyroscope of the mobile device. More...
 
TouchMap getTouches ()
 Returns a map containing all current touches. More...
 
bool singleTapRecognized ()
 Returns true if a single tap was recognized since last calling the function. More...
 
bool doubleTapRecognized ()
 Returns true if a single tap was recognized since last calling the function. More...
 
Touch getLastSingleTapLocation ()
 Returns the last single tap location as a touch object. More...
 
Touch getLastDoubleTapLocation ()
 Returns the last double tap location as a touch object. More...
 
void setCursorEnabled ()
 Sets the cursor enabled. More...
 
void setCursorEnabled (bool enabled)
 Sets the cursor enabled. More...
 
void setCursorDisabled ()
 Sets the cursor disabled. More...
 
void setCursorPosition (double x, double y)
 Sets the position of the cursor. More...
 

Static Public Member Functions

static bool isTouchDevice ()
 Returns true on mobile devices like the iPad. More...
 

Detailed Description

The input class is closely coupled to a view to retrieve actions taken by the user directly from the underlying UIView or window that it concerns.

Author
Benjamin Buergisser

Constructor & Destructor Documentation

Input::Input ( )

Constructor.

Input::Input ( ViewPtr  view)

Constructor.

Parameters
[in]view
virtual Input::~Input ( )
virtual

Virtual destructor.

Member Function Documentation

bool Input::doubleTapRecognized ( )

Returns true if a single tap was recognized since last calling the function.

void Input::getCursorPosition ( double *  x,
double *  y,
bool *  deviceHasCursor = nullptr 
)

Returns the current position of the cursor.

Parameters
[out]xThe x position of the cursor
[out]yThe y position of the cursor
[out]deviceHasCursorReturns true if the current device has a cursor
double Input::getCursorPositionX ( )

Returns the current x-position of the cursor.

double Input::getCursorPositionY ( )

Returns the current y-position of the cursor.

double Input::getGyroscopePitch ( bool *  deviceHasGyroscope = nullptr)

Returns the pitch measured by the gyroscope of the mobile device.

Parameters
[out]deviceHasCursorReturns true if the current device has a gyroscope
double Input::getGyroscopeRoll ( bool *  deviceHasGyroscope = nullptr)

Returns the roll measured by the gyroscope of the mobile device.

Parameters
[out]deviceHasCursorReturns true if the current device has a gyroscope
double Input::getGyroscopeYaw ( bool *  deviceHasGyroscope = nullptr)

Returns the yaw measured by the gyroscope of the mobile device.

Parameters
[out]deviceHasCursorReturns true if the current device has a gyroscope
GLint Input::getKeyState ( GLint  key)

Gets the current state of a specified key.

Parameters
[in]key
Touch Input::getLastDoubleTapLocation ( )

Returns the last double tap location as a touch object.

Touch Input::getLastSingleTapLocation ( )

Returns the last single tap location as a touch object.

GLint Input::getMouseButtonState ( GLint  button)

Gets the current state of a specified mouse button.

Parameters
[in]buttonLeft mouse button = 1, right mouse button = 2, middle mouse button = 3
TouchMap Input::getTouches ( )

Returns a map containing all current touches.

static bool Input::isTouchDevice ( )
static

Returns true on mobile devices like the iPad.

void Input::setCursorDisabled ( )

Sets the cursor disabled.

void Input::setCursorEnabled ( )

Sets the cursor enabled.

void Input::setCursorEnabled ( bool  enabled)

Sets the cursor enabled.

Parameters
[in]enabledSet true to enable, set false to disable
void Input::setCursorPosition ( double  x,
double  y 
)

Sets the position of the cursor.

Parameters
[in]xThe x position of the cursor
[in]yThe y position of the cursor
void Input::setView ( ViewPtr  view)
inline

Set the view to get inputs from.

Parameters
[in]view
bool Input::singleTapRecognized ( )

Returns true if a single tap was recognized since last calling the function.