| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iInputBinder Struct Reference

SCF interface for csInputBinder, used to bind input events (keypress, button press, mouse move, etc. More...

`#include <iutil/binder.h>`

Inheritance diagram for iInputBinder:

[legend]
List of all members.

## Public Member Functions
virtual int | Axis (unsigned cmd)=0
| Returns the position of the given axis command.
virtual void | BindAxis (csInputDefinition const &def, unsigned int cmd, int sensitivity=1)=0
| Bind an axis motion event to an axis command.
virtual void | BindButton (csInputDefinition const &def, unsigned int cmd, bool toggle=false)=0
| Bind a button event to a button command.
virtual bool | Button (unsigned cmd)=0
| Returns the status of the given button command.
virtual void | LoadConfig (iConfigFile *, const char *subsection=0)=0
| Load bindings from a configuration file.
virtual iEventHandler * | QueryHandler ()=0
| Get a pointer to the embedded iEventHander.
virtual void | SaveConfig (iConfigFile *, const char *subsection=0)=0
| Save bindings to a configuration file.
virtual void | UnbindAll ()=0
| Remove all bindings.
virtual bool | UnbindAxis (unsigned cmd)=0
| Remove a binding.
virtual bool | UnbindButton (unsigned cmd)=0
| Remove a binding.

## Detailed Description

SCF interface for csInputBinder, used to bind input events (keypress, button press, mouse move, etc.

) to commands which are represented by an unsigned integer. It is up to the application to specify the meaning of a command value.

Example:

     enum MyCommand = { Walk, Shoot, Jump, LookX, LookY };
     ...
     csRef<iInputBinder> binder = ...;
     binder->BindButton (csInputDefinition ("ctrl"), Shoot);
     binder->BindAxis (csInputDefinition ("mousex"), LookX);
     ...
     if (binder->Button (Shoot))
       ...
     else
     {
       DoSomething (binder->Axis (LookX), binder->Axis (LookY));
     }

Definition at line 55 of file binder.h.

## Member Function Documentation

virtual int iInputBinder::Axis | ( | unsigned | cmd | ) | `[pure virtual]`

Returns the position of the given axis command.

Implemented in csInputBinder.

virtual void iInputBinder::BindAxis | ( | csInputDefinition const & | def,
|  | unsigned int | cmd,
|  | int | sensitivity = `1` |
| ) |  |  | `[pure virtual]`

Bind an axis motion event to an axis command.

Parameters:

  | def | Describes the physical axis to bind to.
  | cmd | The ID of the command to bind.
  | sensitivity | A multiplier for the axis command.

Remarks:
  Note that cmd is used as an array index so the numbers you use should be consecutive, starting with 0.

Implemented in csInputBinder.

virtual void iInputBinder::BindButton | ( | csInputDefinition const & | def,
|  | unsigned int | cmd,
|  | bool | toggle = `false` |
| ) |  |  | `[pure virtual]`

Bind a button event to a button command.

Parameters:

  | def | Describes the physical button to bind to.
  | cmd | The ID of the command to bind.
  | toggle | If true, button status is only toggled on keydown events.

Remarks:
  Note that cmd is used as an array index so the numbers you use should be consecutive, starting with 0. Also note that there must be a 1:1 mapping between buttons and commands, that is, a button cannot issue multiple commands, and the same command cannot be bound to multiple buttons. If you require this, you must handle it in your application. Binding a button (or command) will remove any previous bindings involving the button or command.

Implemented in csInputBinder.

virtual bool iInputBinder::Button | ( | unsigned | cmd | ) | `[pure virtual]`

Returns the status of the given button command.

Implemented in csInputBinder.

virtual void iInputBinder::LoadConfig | ( | iConfigFile * | ,
|  | const char * | subsection = `0` |
| ) |  |  | `[pure virtual]`

Load bindings from a configuration file.

Implemented in csInputBinder.

virtual iEventHandler* iInputBinder::QueryHandler | ( |  | ) | `[pure virtual]`

Get a pointer to the embedded iEventHander.

Remarks:
  This class has to be registered with the event queue: EventQueue->RegisterListener(InputBinder->QueryHandler (), CSMASK_Input); to get working Axis() and Button() methods.

Implemented in csInputBinder.

virtual void iInputBinder::SaveConfig | ( | iConfigFile * | ,
|  | const char * | subsection = `0` |
| ) |  |  | `[pure virtual]`

Save bindings to a configuration file.

Implemented in csInputBinder.

virtual void iInputBinder::UnbindAll | ( |  | ) | `[pure virtual]`

Remove all bindings.

Implemented in csInputBinder.

virtual bool iInputBinder::UnbindAxis | ( | unsigned | cmd | ) | `[pure virtual]`

Remove a binding.

Implemented in csInputBinder.

virtual bool iInputBinder::UnbindButton | ( | unsigned | cmd | ) | `[pure virtual]`

Remove a binding.

Implemented in csInputBinder.

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

- iutil/binder.h