CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csutil/inpnames.h File Reference

Crystal Space input library. More...

#include "csextern.h"
#include "iutil/evdefs.h"
#include "iutil/event.h"
#include "csstring.h"

Go to the source code of this file.

str Strings are in the form "Ctrl+a", "alt-shift+enter" etc.

Convert a free-format string into a set of values that can be compared against the data of a keyboard event.
Parameters:
rawCode  Pointer to where the raw code is written to.
cookedCode  Pointer to where the cooked code is written to.
modifiers  Pointer where the key modifiers are written to.
Returns:
Whether the string could be successfully parsed. Error can be unrecognized keys etc.
Remarks:
For any piece of information in which you are not interested, pass 0 for the address.
The cooked code returned *may* be 0. This is the case if the non-modifier part is a single letter.


bool csParseKeyDef (const char *str, utf32_char *rawCode, utf32_char *cookedCode, csKeyModifiers *modifiers)
csString csGetKeyDesc (utf32_char code, const csKeyModifiers *modifiers, bool distinguishModifiers=true)
 Convert a keycode and an optional set of modifiers into a free-form key string.

bool csParseMouseDef (const char *str, int *x, int *y, int *button, csKeyModifiers *modifiers)
 Convert a free-format string into a set of values that can be compared against the data of a mouse event.

csString csGetMouseDesc (int x, int y, int button, const csKeyModifiers *modifiers, bool distinguishModifiers=true)
 Convert mouse specifiers and an optional set of modifiers into a free-form mouse event string.

bool csParseJoystickDef (const char *str, int *x, int *y, int *button, csKeyModifiers *modifiers)
 Convert a free-format string into a set of values that can be compared against the data of a joystick event.

csString csGetJoystickDesc (int x, int y, int button, const csKeyModifiers *modifiers, bool distinguishModifiers=true)
 Convert joystick specifiers and an optional set of modifiers into a free-form joystick event string.


Defines

#define CSAXIS_X   -1
 Use in `int button' for csevXXXMove events with the backward compatible funcs.

#define CSAXIS_Y   -2
 Use in `int button' for csevXXXMove events with the backward compatible funcs.


Functions

int csTypeOfInputDef (const char *str)
 Returns the event type described by a free-format string.


Detailed Description

Crystal Space input library.

Definition in file inpnames.h.


Define Documentation

#define CSAXIS_X   -1
 

Use in `int button' for csevXXXMove events with the backward compatible funcs.

Definition at line 78 of file inpnames.h.

#define CSAXIS_Y   -2
 

Use in `int button' for csevXXXMove events with the backward compatible funcs.

Definition at line 83 of file inpnames.h.


Function Documentation

csString csGetJoystickDesc int    x,
int    y,
int    button,
const csKeyModifiers   modifiers,
bool    distinguishModifiers = true
 

Convert joystick specifiers and an optional set of modifiers into a free-form joystick event string.

Parameters:
x  If x is not zero, it translates to a JoystickX event.
y  If y is not zero, it translates to a JoystickY event.
button  If button is not zero, it translates to a Joystick<button> button event.
modifiers  The modifiers to include in the string. Can be 0.
distinguishModifiers  Whether to out put distinguished modifiers. (e.g. "LAlt" vs just "Alt".)
Returns:
The joystick event string or an empty string if translation failed.
Remarks:
The resulting event is either a JoystickX, JoystickY or Button event It will be tested in this order. So setting x and y to nonzero will result in a JoystickX event.

csString csGetKeyDesc utf32_char    code,
const csKeyModifiers   modifiers,
bool    distinguishModifiers = true
 

Convert a keycode and an optional set of modifiers into a free-form key string.

Parameters:
code  The key code. Is treated as a raw code, however raw vs cooked doesn't matter here, only when evaluating the data returned by e.g. csParseKeyString().
modifiers  The modifiers to include in the string. Can be 0.
distinguishModifiers  Whether to out put distinguished modifiers. (e.g. "LAlt" vs just "Alt".)
Returns:
The key string.

csString csGetMouseDesc int    x,
int    y,
int    button,
const csKeyModifiers   modifiers,
bool    distinguishModifiers = true
 

Convert mouse specifiers and an optional set of modifiers into a free-form mouse event string.

Parameters:
x  If x is not zero, it translates to a MouseX event.
y  If y is not zero, it translates to a MouseY event.
button  If button is not zero, it translates to a Mouse<button> button event.
modifiers  The modifiers to include in the string. Can be 0.
distinguishModifiers  Whether to out put distinguished modifiers. (e.g. "LAlt" vs just "Alt".)
Returns:
The mouse event string or an empty string if translation failed.
Remarks:
The resulting event is either a MouseX, MouseY or Button event It will be tested in this order. So setting x and y to nonzero will result in a MouseX event.

bool csParseJoystickDef const char *    str,
int *    x,
int *    y,
int *    button,
csKeyModifiers   modifiers
 

Convert a free-format string into a set of values that can be compared against the data of a joystick event.

Parameters:
str  Strings are in the form "joystickX", "joystick2" etc.
x  pointer to where the X value is written this will be 1 for mouseX events, 0 otherwise
y  pointer to where the Y value is written this will be 1 for mouseY events, 0 otherwise
button  pointer to where the button number is written to. for example, the string "joystick1" results in *button = 1; this will be -1 if not a joystick button event.
Returns:
Whether the string could be successfully parsed.
Remarks:
For any piece of information in which you are not interested, pass 0 for the address.

bool csParseMouseDef const char *    str,
int *    x,
int *    y,
int *    button,
csKeyModifiers   modifiers
 

Convert a free-format string into a set of values that can be compared against the data of a mouse event.

Parameters:
str  Strings are in the form "mouseX", "mouse2" etc.
x  pointer to where the X value is written; this will be 1 for mouseX events, 0 otherwise.
y  pointer to where the Y value is written; this will be 1 for mouseY events, 0 otherwise.
button  pointer to where the button number is written to. for example, the string "mouse1" results in *button = 1; this will be -1 if not a mouse button event.
modifiers  pointer to where the modifiers are written to.
Returns:
Whether the string could be successfully parsed.
Remarks:
For any piece of information in which you are not interested, pass 0 for the address.

int csTypeOfInputDef const char *    str
 

Returns the event type described by a free-format string.

Parameters:
str  Strings are in the form "Ctrl+a", "mouse1", "joystickX" etc.
Returns:
CSEVTYPE_Keyboard, CSEVTYPE_Mouse, CSEVTYPE_Joystick or 0 if the string could not be successfully parsed.


Generated for Crystal Space by doxygen 1.2.18