Crystal Space 2.0.0: C.5.3 Input Helper Changes

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### C.5.3 Input Helper Changes

#### Input Definitions

The file `‘csutil/inpnames.h’` has been renamed to `‘inputdef.h’`, and the following functions have been removed:

- `csTypeOfInputDef()`
- `csParseKeyDef()`
- `csGetKeyDesc()`
- `csParseMouseDef()`
- `csGetMouseDesc()`
- `csParseJoystickDef()`
- `csGetJoystickDesc()`

These functions allowed you to convert a string such as ``Ctrl`+A`, `‘JoystickX’` or `‘Alt+Mouse1’` into values describing input events and vice versa.

The way to do this is now, however, is to use `‘csInputDefinition’`, which resides in `‘csutil/inputdef.h’`. The preferred way to convert a string to a definition is to construct a `‘csInputDefinition’` from a `‘char const*’`; and the preferred way to convert a definition back to a string (perhaps constructed some other way) is via `csInputDefinition::ToString()`.

There are also static helper methods in `‘csInputDefinition’` which accept arguments in a similar way to the old functions. These are convenience methods which perform the work of instantiating the object for you:

- `csInputDefinition::ParseKey()`
- `csInputDefinition::GetKeyString()`
- `csInputDefinition::ParseOther()`
- `csInputDefinition::GetOtherString()`

#### Mouse Corrections

Mouse buttons and axes used to be enumerated basis 1 (first mouse button was 1, Y axis was 2, etc). In keeping with good C/C++/Java/etc coding style, they are now basis-0 (first mouse button is 0, Y axis is 1, etc).

#### Joystick Corrections

The implementation of `‘iJoystickDriver’` has been fixed to treat joystick numbers consistently. Previously, on account of buggy implementation, some parts of the driver considered joystick numbers 0-based, while other parts considered them 1-based. It now uniformly treats joystick numbers as 0-based. This is consistent with button numbers for joysticks and mice, which are also basis-0.

This document was generated using texi2html 1.76.