Keyboard, mouse, and joystick input handling.
More...
#include <gelInput.h>
List of all members.
Static Public Member Functions |
static KeyState | getKeyState (Key key) |
| Gets the state of the specified keyboard key.
|
static bool | keyPressed (Key key) |
| Tests if the specified keyboard key was pressed during the last frame.
|
static bool | keyReleased (Key key) |
| Tests if the specified keyboard key was released during the last frame.
|
static KeyState | getMouseButton (MouseBtn button) |
| Gets the state of the specified mouse button.
|
static bool | mouseBtnPressed (MouseBtn button) |
| Tests if the specified mouse button was pressed during the last frame.
|
static bool | mouseBtnReleased (MouseBtn button) |
| Tests if the specified mouse button was released during the last frame.
|
static int | getMouseWheel () |
| Gets the mouse wheel position.
|
static void | setMouseWheel (int pos) |
| Sets the mouse wheel position.
|
static void | setCursorPos (int x, int y) |
| Sets the mouse cursor position.
|
static void | getCursorPos (int *x, int *y) |
| Gets the mouse cursor's position.
|
static GelPoint | getCursorPos () |
| Gets the mouse cursor's position.
|
static int | getCursorX () |
| Gets the mouse cursor's horizontal position.
|
static int | getCursorY () |
| Gets the mouse cursor's vertical position.
|
static void | showCursor (int mode) |
| Shows or hides the mouse cursor.
|
static void | setCursor (const char *filename) |
| Sets the specified image as the new cursor.
|
static void | setCursor (SysCursorShape shape) |
| Sets the cursor shape.
|
static int | getJoystickBtn (int joystick, int button) |
| Gets the state of the specified joystick button.
|
static float | getJoystickAxis (int joystick, int axis) |
| Gets the position of the specified joystick axis.
|
static int | getJoyHatPos (int joystick, int hat) |
| Gets the position of the specified joystick hat.
|
static int | getJoystickCount () |
| Gets the number of available joysticks.
|
static Gel2dVec | mouseToWorld () |
Detailed Description
Keyboard, mouse, and joystick input handling.
Member Function Documentation
static KeyState gel::GelInput::getKeyState |
( |
Key |
key | ) |
[static] |
Gets the state of the specified keyboard key.
- Parameters:
-
key | : The key to get the state of. |
- Returns:
- GEL_PRESS if the key is being pressed, else GEL_RELEASE.
static bool gel::GelInput::keyPressed |
( |
Key |
key | ) |
[static] |
Tests if the specified keyboard key was pressed during the last frame.
- Parameters:
-
- Returns:
- True if the key was pressed, else false.
static bool gel::GelInput::keyReleased |
( |
Key |
key | ) |
[static] |
Tests if the specified keyboard key was released during the last frame.
- Parameters:
-
- Returns:
- True if the key was released, else false.
Gets the state of the specified mouse button.
- Parameters:
-
button | : The button to get the state of. |
- Returns:
- GEL_PRESS if the button is being pressed, else GEL_RELEASE.
static bool gel::GelInput::mouseBtnPressed |
( |
MouseBtn |
button | ) |
[static] |
Tests if the specified mouse button was pressed during the last frame.
- Parameters:
-
button | : The button to test. |
- Returns:
- True if the button was pressed, else false.
static bool gel::GelInput::mouseBtnReleased |
( |
MouseBtn |
button | ) |
[static] |
Tests if the specified mouse button was released during the last frame.
- Parameters:
-
button | : The button to test. |
- Returns:
- True if the button was released, else false.
static int gel::GelInput::getMouseWheel |
( |
| ) |
[static] |
Gets the mouse wheel position.
Scrolling the mouse wheel forward (away from the user) increments the wheel's position, and scrolling the wheel backwards (towards the user) decrements it's position. The position of the wheel is initially set to 0.
- Returns:
- The position of the mouse wheel.
static void gel::GelInput::setMouseWheel |
( |
int |
pos | ) |
[static] |
Sets the mouse wheel position.
- Parameters:
-
pos | : The new position of the mouse wheel. |
static void gel::GelInput::setCursorPos |
( |
int |
x, |
|
|
int |
y |
|
) |
| [static] |
Sets the mouse cursor position.
- Parameters:
-
x | : The new horizontal position for the cursor. |
y | : The new vertical position for the cursor. |
static void gel::GelInput::getCursorPos |
( |
int * |
x, |
|
|
int * |
y |
|
) |
| [static] |
Gets the mouse cursor's position.
- Parameters:
-
x | : The mouse cursor's x coordinate in pixels. |
y | : The mouse cursor's y coordinate in pixels. |
static GelPoint gel::GelInput::getCursorPos |
( |
| ) |
[static] |
Gets the mouse cursor's position.
- Returns:
- The cursor's position.
static int gel::GelInput::getCursorX |
( |
| ) |
[static] |
Gets the mouse cursor's horizontal position.
- Returns:
- The mouse cursor's x coordinate in pixels.
static int gel::GelInput::getCursorY |
( |
| ) |
[static] |
Gets the mouse cursor's vertical position.
- Returns:
- The mouse cursor's y coordinate in pixels.
static void gel::GelInput::showCursor |
( |
int |
mode | ) |
[static] |
Shows or hides the mouse cursor.
- Parameters:
-
mode | : Set to GEL_TRUE to show, or GEL_FALSE to hide. |
static void gel::GelInput::setCursor |
( |
const char * |
filename | ) |
[static] |
Sets the specified image as the new cursor.
On Windows, the filename should be the name of the cursor resource embedded in your executable.
- Parameters:
-
filename | : The new cursor. |
Sets the cursor shape.
This function will set the system's standard cursor.
- Parameters:
-
shape | : The new cursor shape. |
static int gel::GelInput::getJoystickBtn |
( |
int |
joystick, |
|
|
int |
button |
|
) |
| [static] |
Gets the state of the specified joystick button.
- Parameters:
-
joystick | : The joystick index. |
button | : The button to get the state of. |
- Returns:
- GEL_PRESS if the button is being pressed, else GEL_RELEASE.
static float gel::GelInput::getJoystickAxis |
( |
int |
joystick, |
|
|
int |
axis |
|
) |
| [static] |
Gets the position of the specified joystick axis.
- Parameters:
-
joystick | : The joystick index. |
axis | : The axis to get the position of. |
- Returns:
- The position of the axis.
static int gel::GelInput::getJoyHatPos |
( |
int |
joystick, |
|
|
int |
hat |
|
) |
| [static] |
Gets the position of the specified joystick hat.
- Parameters:
-
joystick | : The joystick index. |
hat | : The hat to get the position of. |
- Returns:
- The position of the hat.
static int gel::GelInput::getJoystickCount |
( |
| ) |
[static] |
Gets the number of available joysticks.
- Returns:
- The number of joysticks available.
static Gel2dVec gel::GelInput::mouseToWorld |
( |
| ) |
[static] |
The documentation for this class was generated from the following file: