G3D::UserInput Class ReferenceUser input class that consolidates joystick, keyboard, and mouse input.
More...
#include <UserInput.h>
List of all members.
Detailed Description
User input class that consolidates joystick, keyboard, and mouse input.
Four axes are supported directly: joystick/keyboard x and y and mouse x and y. Mouse buttons, joystick buttons, and keyboard keys can all be used as generic buttons.
Call beginEvents() immediately before your SDL event handling routine and hand events to processEvent() as they become available. Call endEvents() immediately after the loop.
Member Enumeration Documentation
Constructor & Destructor Documentation
| G3D::UserInput::UserInput |
( |
GWindow * |
window |
) |
|
| virtual G3D::UserInput::~UserInput |
( |
|
) |
[virtual] |
Closes the joystick if necessary.
Member Function Documentation
| bool G3D::UserInput::anyKeyPressed |
( |
|
) |
const |
True if any key has been pressed since the last call to poll().
| void G3D::UserInput::beginEvents |
( |
|
) |
|
Call before your GWindow event polling loop.If you are using G3D::GApplet, this is handled for you.
| void G3D::UserInput::endEvents |
( |
|
) |
|
Call after your GWindow event polling loop.
If you are using G3D::GApplet, this is handled for you.
| int G3D::UserInput::getNumJoysticks |
( |
|
) |
const |
| float G3D::UserInput::getX |
( |
|
) |
const |
Returns a number between -1 and 1 indicating the horizontal input from the user.
Keyboard overrides joystick. - Deprecated:
| Vector2 G3D::UserInput::getXY |
( |
|
) |
const |
| float G3D::UserInput::getY |
( |
|
) |
const |
Returns a number between -1 and 1 indicating the vertical input from the user.
Up is positive, down is negative. Keyboard overrides joystick. - Deprecated:
| bool G3D::UserInput::keyDown |
( |
GKey |
code |
) |
const |
Returns true iff the given key is currently held down.
| bool G3D::UserInput::keyPressed |
( |
GKey |
code |
) |
const |
Returns true if this key went down at least once since the last call to poll().
| bool G3D::UserInput::keyReleased |
( |
GKey |
code |
) |
const |
Returns true if this key came up since the last call to poll().
| float G3D::UserInput::mouseDX |
( |
|
) |
const |
| Vector2 G3D::UserInput::mouseDXY |
( |
|
) |
const |
| float G3D::UserInput::mouseDY |
( |
|
) |
const |
| Vector2 G3D::UserInput::mouseXY |
( |
|
) |
const [inline] |
| void G3D::UserInput::pressedKeys |
( |
Array< GKey > & |
code |
) |
const |
An array of all keys pressed since the last poll() call.
| void G3D::UserInput::processEvent |
( |
const GEvent & |
event |
) |
|
Call from inside the event loop for every event inside processEvents() (done for you by App3D.processEvents()).
| bool G3D::UserInput::pureDeltaMouse |
( |
|
) |
const |
| void G3D::UserInput::releasedKeys |
( |
Array< GKey > & |
code |
) |
const |
| void G3D::UserInput::setMouseXY |
( |
const Vector2 & |
v |
) |
[inline] |
| void G3D::UserInput::setMouseXY |
( |
float |
x, |
|
|
float |
y | |
|
) |
| | |
Sets the mouse position.
That new position will be returned by getMouseXY until the next endEvents() statement.
| void G3D::UserInput::setPureDeltaMouse |
( |
bool |
m |
) |
|
When set to true, the mouse cursor is invisible and the mouse is restricted to the current window.
Regardless of how far the user moves the mouse in one direction, continous mouseDXY values are returned.
The mouseXY values are not particularly useful in this mode.
This setting is commonly used by first-person games.
When the app loses focus the mouse is automatically freed and recaptured when focus returns. debugBreak also frees the mouse.
| GWindow* G3D::UserInput::window |
( |
|
) |
const |
Return the window used internally by the UserInput.
Member Data Documentation
The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:48 2007 for G3D by
1.5.2
Hosted by
|