Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csInputBinder Class Reference

Bind an input event to a pointer to a variable, so that that variable will reflect the state of a given key, button or axis. More...

#include <binder.h>

Inheritance diagram for csInputBinder:

iEventHandler iBase List of all members.

Public Methods

 csInputBinder (int size=127)
 Create a new binder with initial bindings hash size size. More...

virtual ~csInputBinder ()
 Destructor does UnbindAll automatically.

bool HandleEvent (iEvent &ev)
 Handle an event, a method of iEventHandler This class can be registered with the event queue: iEventQueue::RegisterListener(this, CSMASK_Input);.

void Bind (iEvent *ev, int *xvar=NULL, int *yvar=NULL)
 Bind one or two variables to an event. More...

void Bind (csEvent &ev, int *xvar=NULL, int *yvar=NULL)
bool Unbind (iEvent *ev)
 Remove a binding.

bool Unbind (csEvent &ev)
bool UnbindAll ()
 Remove all bindings.


Public Attributes

 SCF_DECLARE_IBASE

Detailed Description

Bind an input event to a pointer to a variable, so that that variable will reflect the state of a given key, button or axis.


Constructor & Destructor Documentation

csInputBinder::csInputBinder ( int size = 127 )
 

Create a new binder with initial bindings hash size size.

size should be a prime number.


Member Function Documentation

void csInputBinder::Bind ( iEvent * ev,
int * xvar = NULL,
int * yvar = NULL )
 

Bind one or two variables to an event.

Bind one or two 'int's to a csev*Move type event. You can bind the two axes simultaneously or separately. If yvar is NULL and the event is a y-axis type, xvar is used as yvar. Or bind a button status '(int)bool' to a csev*Up/Down type event. Will modify the existing binding if any. It is recommended that you use this in conjuction with csParseKeyDef The axis (either x, y or both) is given by whether ev.*.x is greater than ev.*.y (x) or visa versa (y) or if they are equal (both).


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000