Public Attributes
Input Class Reference

Keyboard and mouse input handler. More...

List of all members.

Public Attributes

Key Key
 Global Script Object to access the Input Key enumeration.
MouseButton MouseButton
 Global Script Object to access the Input MouseButton enumeration.
Action Action
 Global Script Object to access the Input Action enumeration.

Low Level Methods

string GetActionName (int action)
 Get the name assigned to the specified action.
int GetKey (int action)
 Get the key code associated with the specified action.
int GetKeyAction (int key)
 Get the action associated with the specified key.
string GetKeyName (int key)
 Get the name of the specified key.
int GetMouseButton (int action)
 Get the mouse button ID associated with the specified action.
int GetMouseButtonAction (int mouseButton)
 Get the action associated with the specified mouse button.
string GetMouseButtonName (int mouseButton)
 Get the name assigned to the specified mouse button.
int GetJoystickAxisX (int joystick)
 Get the left-right movement of the specified joystick.
int GetJoystickAxisY (int joystick)
 Get the forward-backward movement of the specified joystick.
int GetJoystickAxisZ (int joystick)
 Checks z-axis (often the throttle control) of the specified joystick.
int GetNumberOfJoysticks ()
 Get the number of joysticks connected to the system.
bool IsJoystickButtonDown (int joystick, int button)
 Get the state of the button with the ID button of the specified joystick.
bool IsKeyDown (int key)
 Check if the specified key is pressed.
bool IsMouseButtonDown (int mouseButton)
 Check if the specified mouse button is pressed.
int KeyDown ()
 Check if any key is pressed.
void SetEnabled (bool pause)
 Pause or restore the keyboard control.
void SetMousePosition (Point position)
 Set the current mouse cursor position.
Point GetMousePosition ()
 Return the current mouse cursor position as a pixel offset from the top-left corner of the display.

Detailed Description

Keyboard and mouse input handler.


Member Function Documentation

string Input::GetActionName ( int  action)

Get the name assigned to the specified action.

Parameters:
actioninteger value specifying the action ID.
Returns:
the name assigned to the specified action.
int Input::GetKey ( int  action)

Get the key code associated with the specified action.

Parameters:
actioninteger value specifying the action ID.
Returns:
the key code associated with the specified action (or -1 if not mapped).
int Input::GetKeyAction ( int  key)

Get the action associated with the specified key.

Parameters:
keyinteger value specifying the key code.
Returns:
the action ID associated with the specified key (or 0 if no action mapped).
string Input::GetKeyName ( int  key)

Get the name of the specified key.

Parameters:
keyinteger value specifying the key code.
Returns:
the name of the specified key.
int Input::GetMouseButton ( int  action)

Get the mouse button ID associated with the specified action.

Parameters:
actioninteger value specifying the action ID.
Returns:
the mouse button ID associated with the specified action (or -1 if not mapped).
int Input::GetMouseButtonAction ( int  mouseButton)

Get the action associated with the specified mouse button.

Parameters:
mouseButtoninteger value specifying the mouse button.
Returns:
the action ID associated with the specified mouse button (or 0 if no action mapped).
string Input::GetMouseButtonName ( int  mouseButton)

Get the name assigned to the specified mouse button.

Parameters:
mouseButtoninteger value specifying the mouse button.
Returns:
the name assigned to the specified mouse button.
int Input::GetJoystickAxisX ( int  joystick)

Get the left-right movement of the specified joystick.

Parameters:
joystickinteger value used to identify the joystick (0 - max. 3).
Returns:
the left-right movement of the stick.
int Input::GetJoystickAxisY ( int  joystick)

Get the forward-backward movement of the specified joystick.

Parameters:
joystickinteger value used to identify the joystick (0 - max. 3).
Returns:
the forward-backward movement of the stick.
int Input::GetJoystickAxisZ ( int  joystick)

Checks z-axis (often the throttle control) of the specified joystick.

If the joystick does not have this axis, the value is 0.

Parameters:
joystickinteger value used to identify the joystick (0 - max. 3).
Returns:
the z-axis value of the stick.
int Input::GetNumberOfJoysticks ( )

Get the number of joysticks connected to the system.

Returns:
the number of joysticks connected to the system.
bool Input::IsJoystickButtonDown ( int  joystick,
int  button 
)

Get the state of the button with the ID button of the specified joystick.

Parameters:
joystickinteger value used to identify the joystick (0 - max. 3).
buttoninteger value used to identify the button of the joystick.
Returns:
the state of the specified joystick button.
bool Input::IsKeyDown ( int  key)

Check if the specified key is pressed.

Parameters:
keyinteger value specifying the key code to check.
Returns:
  • true if the specified key is pressed.
  • false if the specified key is not pressed.
bool Input::IsMouseButtonDown ( int  mouseButton)

Check if the specified mouse button is pressed.

Parameters:
mouseButtoninteger value specifying the mouse button to check.
Returns:
  • true if the specified mouse button is pressed.
  • false if the specified mouse button is not pressed.
int Input::KeyDown ( )

Check if any key is pressed.

Returns:
the key code of the pressed key (or 0 if no key is pressed).
void Input::SetEnabled ( bool  pause)

Pause or restore the keyboard control.

Parameters:
pause
  • true to pause the keyboard control.
  • false to restore the keyboard control.
Returns:
Nothing.
void Input::SetMousePosition ( Point  position)

Set the current mouse cursor position.

Parameters:
positionPoint object describing the new location for the mouse.
Returns:
Nothing.
Point Input::GetMousePosition ( )

Return the current mouse cursor position as a pixel offset from the top-left corner of the display.

Returns:
Point object describing the mouse cursor position in screen pixels.