## Public API Reference

- Main Page
- Classes
- Files

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

# iPcCommandInput Struct Reference

Input propery class. More...

`#include <propclass/input.h>`

List of all members.

## Public Member Functions

virtual void | Activate (bool activate=true)=0
| Activates the input to get Commands.
virtual bool | Bind (const char *triggername, const char *command)=0
| Binds a trigger to a command.
virtual float | CenteredToScreen (float centeredcoord, float axis=0)=0
| Convert a coordinate from a value between -1 and 1 to screen-space.
virtual const char * | GetBind (const char *triggername) const =0
| returns the command bind to a key
virtual bool | GetCookedMode () const =0
| Get cooked or raw.
virtual bool | LoadConfig (const char *prefix)=0
| Loads from a config file binding triggers(for example keys) to commands.
virtual void | RemoveAllBinds ()=0
| deletes all binds
virtual bool | RemoveBind (const char *triggername, const char *command)=0
| deletes a bind, if triggername is 0 deletes all binds to the command
virtual void | SaveConfig (const char *prefix)=0
| Saves to a config file binding triggers(for example keys) to commands.
virtual void | ScreenCoordinates (bool screen=true)=0
| Send screen coordinates instead of coordinates between -1 and 1 for axis movement messages.
virtual float | ScreenToCentered (float screencoord, float axis=0)=0
| Convert a coordinate from screen-space to a value between -1 and 1.
virtual void | SetCookedMode (bool cooked)=0
| Enable/disable cooked mode.

## Detailed Description

Input propery class.

This property class supports the following actions (add prefix 'cel.action.' to get the ID of the action and add prefix 'cel.parameter.' to get the ID of the parameter):

- Bind: parameters 'trigger' (string) and 'command' (string).
- LoadConfig: parameters 'prefix' (string).
- SaveConfig: parameters 'prefix' (string).

This property class can send out the following messages to the behaviour:

- pccommandinput_<key>0: key is unpressed
- pccommandinput_<key>1: key is pressed
- pccommandinput_<key>_: key is pressed and auto-repeating
- pccommandinput_<axis>: movement on the given axis

This property class supports the following properties (add prefix 'cel.property.' to get the ID of the property:

- screenspace (bool, read/write): use screenspace instead of -1/1 normalized coordinates (-1/1 is default).
- cooked (bool, read/write): use cooked mode instead of raw (default is raw.

Definition at line 56 of file input.h.

## Member Function Documentation

virtual void iPcCommandInput::Activate | ( | bool | activate = `true` | ) | `[pure virtual]`

Activates the input to get Commands.

virtual bool iPcCommandInput::Bind | ( | const char * | triggername,
|  | const char * | command |
| ) |  |  | `[pure virtual]`

Binds a trigger to a command.

virtual float iPcCommandInput::CenteredToScreen | ( | float | centeredcoord,
|  | float | axis = `0` |
| ) |  |  | `[pure virtual]`

Convert a coordinate from a value between -1 and 1 to screen-space.

Parameters:

  | centeredcoord | a value between -1 and 1
  | axis | the screen axis to use for the conversion (0 = x, 1 = y)

virtual const char* iPcCommandInput::GetBind | ( | const char * | triggername | ) | const`[pure virtual]`

returns the command bind to a key

virtual bool iPcCommandInput::GetCookedMode | ( |  | ) | const`[pure virtual]`

Get cooked or raw.

virtual bool iPcCommandInput::LoadConfig | ( | const char * | prefix | ) | `[pure virtual]`

Loads from a config file binding triggers(for example keys) to commands.

Parameters:

  | prefix | for the <prefix>.CommandInput.Bind.<trigger>

virtual void iPcCommandInput::RemoveAllBinds | ( |  | ) | `[pure virtual]`

deletes all binds

virtual bool iPcCommandInput::RemoveBind | ( | const char * | triggername,
|  | const char * | command |
| ) |  |  | `[pure virtual]`

deletes a bind, if triggername is 0 deletes all binds to the command

virtual void iPcCommandInput::SaveConfig | ( | const char * | prefix | ) | `[pure virtual]`

Saves to a config file binding triggers(for example keys) to commands.

Parameters:

  | prefix | for the <prefix>.CommandInput.Bind.<trigger>

virtual void iPcCommandInput::ScreenCoordinates | ( | bool | screen = `true` | ) | `[pure virtual]`

Send screen coordinates instead of coordinates between -1 and 1 for axis movement messages.

virtual float iPcCommandInput::ScreenToCentered | ( | float | screencoord,
|  | float | axis = `0` |
| ) |  |  | `[pure virtual]`

Convert a coordinate from screen-space to a value between -1 and 1.

Parameters:

  | screencoord | the coordinate in screen-space
  | axis | the screen axis to use for the conversion (0 = x, 1 = y)

virtual void iPcCommandInput::SetCookedMode | ( | bool | cooked | ) | `[pure virtual]`

Enable/disable cooked mode.

By default raw mode is used which means that keyboard events are parsed in raw mode. That implies the following:

- You can't bind on key combinations like Shift-F3
- Binding on 'a' is the same as 'A'. In cooked mode you can bind on key combinations and on keys like 'shift'.

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

- propclass/input.h