InputSystem Class Reference
[Input and Interaction]

Controls the passing of input from some windowing system (e.g. GLUT) to the various controllers, filters, and objects in the scene graph. More...

#include <InputSystem.h>

List of all members.

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.

See also:
SetupGLUT.h


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...


Detailed Description

Controls the passing of input from some windowing system (e.g. GLUT) to the various controllers, filters, and objects in the scene graph.

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.


Member Typedef Documentation

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)

See also:
boost::signal


Member Enumeration Documentation

Constants for special keys that can be passed to keyboard methods.

Contains the following:

Enumerator:
KEY_LEFT 
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 

Mouse button constants.

Contains the following:

Enumerator:
BUTTON_NONE 
BUTTON_LEFT 
BUTTON_RIGHT 
BUTTON_MIDDLE 

Modifier key bitmasks, can be OR'd together.

Contains the following:

Enumerator:
MODIFIER_NONE 
MODIFIER_SHIFT 
MODIFIER_CONTROL 
MODIFIER_ALT 

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:

Enumerator:
PRIORITY_HIGHEST 
PRIORITY_HIGH 
PRIORITY_MEDIUM 
PRIORITY_LOW 
PRIORITY_LOWEST 


Constructor & Destructor Documentation

InputSystem::InputSystem (  ) 

Constructs a new InputSystem with the default "empty" ActivationSystem.

See also:
ActivationSystem
The default activation system will consider all controllers to be active at all times.

InputSystem::InputSystem ( ActivationSystem &  system  ) 

Constructs a new InputSystem with the specified ActivationSystem.

See also:
ActivationSystem
Parameters:
system ActivationSystem to use

InputSystem::InputSystem ( ActivationSystem *  system  ) 

Constructs a new InputSystem with the specified ActivationSystem.

See also:
ActivationSystem
Parameters:
system ActivationSystem to use


Member Function Documentation

void InputSystem::setActivationSystem ( ActivationSystem *  system  ) 

Changes the InputSystem to use the specified ActivationSystem.

See also:
ActivationSystem
Parameters:
system ActivationSystem to use

ActivationSystem* InputSystem::getActivationSystem (  ) 

Gets the current ActivationSystem.

See also:
ActivationSystem
Returns:
The current activation system

void InputSystem::addListener ( InputListener listener  ) 

Add an InputListener to the InputSystem. InputListeners added to the InputSystem will receive notification when events occur.

See also:
InputListener
Parameters:
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.

See also:
InputListener, InputSystem::Priority
Parameters:
listener InputListener to register
p priority of the listener

void InputSystem::removeListener ( InputListener l  ) 

Remove an InputListener from the InputSystem.

See also:
InputListener
Parameters:
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.

See also:
Controller
Parameters:
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.

See also:
Controller
Parameters:
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.

Parameters:
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.


Member Data Documentation

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.

See also:
MouseDown

Connect slots to this signal to receive mouse click events.

See also:
MouseDown

Connect slots to this signal to receive mouse dragged events.

See also:
MouseDown

Connect slots to this signal to receive mouse moved events.

See also:
MouseDown

Connect slots to this signal to receive key down events.

See also:
MouseDown

Connect slots to this signal to receive key up events.

See also:
MouseDown

int InputSystem::Modifiers [static]

Bit mask of currently pressed modifier keys.

See also:
InputSystem::ModifierKeys

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).


The documentation for this class was generated from the following file:

Generated on Fri Feb 22 15:56:20 2008 for Scene2D by  doxygen 1.5.5