#include <InputSystem.h>
User Methods, Signals and Types | |
The following methods provided by the InputSystem class are to be used in end-user applications. | |
typedef boost::signal< void(int, int, int)> | signal_t |
signal_t | MouseDown |
signal_t | MouseUp |
signal_t | MouseClicked |
signal_t | MouseDragged |
signal_t | MouseMoved |
signal_t | KeyDown |
signal_t | KeyUp |
boost::signal< void(int, int)> | Resize |
static int | Modifiers |
InputSystem () | |
InputSystem (ActivationSystem &system) | |
InputSystem (ActivationSystem *system) | |
~InputSystem () | |
void | setActivationSystem (ActivationSystem *system) |
ActivationSystem * | getActivationSystem () |
void | addListener (InputListener *listener) |
void | addListener (InputListener *listener, Priority p) |
void | removeListener (InputListener *l) |
void | addController (Controller *c) |
void | removeController (Controller *c) |
void | updateControllers (float delta) |
System Methods | |
The following methods are provided to link an InputSystem with a specific native input or event system. That is, these methods are called to tell the InputSystem when events have occured. For example, the LinkToGLUT(InputSystem) function in SetupGLUT.h uses these methods to tie a specific InputSystem to the GLUT window system.
| |
void | mouseDown (int button, int x, int y) |
void | mouseUp (int button, int x, int y) |
void | mouseClicked (int button, int x, int y) |
void | mouseDragged (int button, int x, int y, int dx, int dy) |
void | mouseMoved (int x, int y, int dx, int dy) |
void | keyDown (int key, int x, int y) |
void | keyUp (int key, int x, int y) |
void | resize (int x, int y) |
Public Types | |
enum | Keys { KEY_LEFT = 255, KEY_RIGHT, KEY_UP, KEY_DOWN, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_PAGE_UP, KEY_PAGE_DOWN, KEY_HOME, KEY_END, KEY_INSERT } |
Constants for special keys that can be passed to keyboard methods. More... | |
enum | Mouse { BUTTON_NONE = 0, BUTTON_LEFT = 512, BUTTON_RIGHT, BUTTON_MIDDLE } |
Mouse button constants. More... | |
enum | ModifierKeys { MODIFIER_NONE = 0, MODIFIER_SHIFT = (1<<0), MODIFIER_CONTROL = (1<<1), MODIFIER_ALT = (1<<3) } |
Modifier key bitmasks, can be OR'd together. More... | |
enum | Priority { PRIORITY_HIGHEST = 0, PRIORITY_HIGH = 10, PRIORITY_MEDIUM = 20, PRIORITY_LOW = 30, PRIORITY_LOWEST = 40 } |
Priority constants. More... |
Decides which controllers are currently active and passes input onto them. Controllers are determined to be active as specified by the currently set ActivationSystem.
For example, a MouseSelectionSystem will activate controllers for objects which have been clicked on by the mouse.
typedef boost::signal<void (int, int, int)> InputSystem::signal_t |
Specifies the type of the most common signal used by the InputSystem to manage events.
Most signals require a signature of void (int,int,int)
enum InputSystem::Keys |
enum InputSystem::Mouse |
Priority constants.
InputListener objects can be added to the InputSystem at a specific priority. A higher priority for an object indicates that object will receive events before others of a lower priority.
Contains the following:
InputSystem::InputSystem | ( | ) |
Constructs a new InputSystem with the default "empty" ActivationSystem.
InputSystem::InputSystem | ( | ActivationSystem & | system | ) |
Constructs a new InputSystem with the specified ActivationSystem.
system | ActivationSystem to use |
InputSystem::InputSystem | ( | ActivationSystem * | system | ) |
Constructs a new InputSystem with the specified ActivationSystem.
system | ActivationSystem to use |
void InputSystem::setActivationSystem | ( | ActivationSystem * | system | ) |
Changes the InputSystem to use the specified ActivationSystem.
system | ActivationSystem to use |
ActivationSystem* InputSystem::getActivationSystem | ( | ) |
Gets the current ActivationSystem.
void InputSystem::addListener | ( | InputListener * | listener | ) |
Add an InputListener to the InputSystem. InputListeners added to the InputSystem will receive notification when events occur.
l | InputListener to register |
void InputSystem::addListener | ( | InputListener * | listener, | |
Priority | p | |||
) |
Add an InputListener to the InputSystem at priority p. InputListeners added to the InputSystem will receive notification when events occur.
listener | InputListener to register | |
p | priority of the listener |
void InputSystem::removeListener | ( | InputListener * | l | ) |
Remove an InputListener from the InputSystem.
listener | InputListener to remove |
void InputSystem::addController | ( | Controller * | c | ) |
Add a Controller to the InputSystem. Active Controllers are updated by the InputSystem each time the updateControllers(float) method is called.
c | Controller to add |
void InputSystem::removeController | ( | Controller * | c | ) |
Remove a Controller from the InputSystem. Note that Controllers will remove themselves from the InputSystem if they are deleted, so removal is not strictly necessary if the Controller is going to be deleted.
c | Controller to remove |
void InputSystem::updateControllers | ( | float | delta | ) |
Update all Controller objects registered with this InputSystem. The delta parameter is used to specify how much time has passed since the last update.
delta | time-step delta, this will be passed to all Controllers |
void InputSystem::mouseDown | ( | int | button, | |
int | x, | |||
int | y | |||
) |
Call this method to notify the InputSystem of a mouse down event.
void InputSystem::mouseUp | ( | int | button, | |
int | x, | |||
int | y | |||
) |
Call this method to notify the InputSystem of a mouse up event.
void InputSystem::mouseClicked | ( | int | button, | |
int | x, | |||
int | y | |||
) |
Call this method to notify the InputSystem of a mouse clicked event.
void InputSystem::mouseDragged | ( | int | button, | |
int | x, | |||
int | y, | |||
int | dx, | |||
int | dy | |||
) |
Call this method to notify the InputSystem of a mouse dragged event.
void InputSystem::mouseMoved | ( | int | x, | |
int | y, | |||
int | dx, | |||
int | dy | |||
) |
Call this method to notify the InputSystem of a mouse moved event.
void InputSystem::keyDown | ( | int | key, | |
int | x, | |||
int | y | |||
) |
Call this method to notify the InputSystem of a key down event.
void InputSystem::keyUp | ( | int | key, | |
int | x, | |||
int | y | |||
) |
Call this method to notify the InputSystem of a key up event.
void InputSystem::resize | ( | int | x, | |
int | y | |||
) |
Call this method to notify the InputSystem of a resize event.
Connect slots to this signal to receive mouse down events.
For example, given some function or function object that conforms to the slot type (void(int,int,int)
):
void MyMouseDown ( int button, int x, int y ) { std::cout << "Mouse down\n"; }
The function, function object (including boost::function, or boost::bind result) can be bound to a signal on the InputSystem as follows:
InputSystem myInputSystem; myInputSystem.connect ( &MyMouseDown );
See the documentation for the Boost.Signals library for more information http://www.boost.org/doc/html/signals.html
Connect slots to this signal to receive mouse up events.
Connect slots to this signal to receive mouse click events.
Connect slots to this signal to receive mouse dragged events.
Connect slots to this signal to receive mouse moved events.
Connect slots to this signal to receive key down events.
Connect slots to this signal to receive key up events.
int InputSystem::Modifiers [static] |
Bit mask of currently pressed modifier keys.
boost::signal<void (int, int)> InputSystem::Resize |
Connect slots to this signal to receive resize events.
Note that slots for this signal should be of the type void (int,int)
.