ActionMapper Struct Reference
[Standard Library of Useful Things]

Inherits Service.

Inherited by ActionMapperImpl.

List of all members.

Public Methods

virtual bool createTrigger (const Char *name, Float pressAt, Float relAt)=0
virtual bool createToggle (const Char *name, Float pressAt, Float relAt)=0
virtual bool createAxis (const Char *name, Float rampUp, Float rampDn)=0
virtual bool bind (const Char *physical, const Char *logical)=0
virtual bool translate (Event *event)=0


Detailed Description

Convert between physical input events ("the [J] key was pressed") and logical game actions ("jump").

Start by creating new logical game objects -- toggles, triggers, and axes -- then map one or more physical input objects to these logical objects.


Member Function Documentation

virtual bool ActionMapper::bind const Char   physical,
const Char   logical
[pure virtual]
 

Binds a physical input object, such as a keyboard button, to a logical object like a trigger.

Parameters:
physical  A description of the physics input object to be bound. For a keyboard button, this is the name of the button (see F4/Services/System/Src/key_event.cpp for a complete list). For a game controller, the format is "ctrl0.+axis0" for the positive half of the first axis on the first controller, or "ctrl0.btn0" for the first button. Mouse buttons may be mapped ("mouse.btn0") but currently not the mouse axes.
logical  The name of the logical input object, specified in the call to createTrigger(), etc. If this parameter is NULL, the binding is removed.
Returns:
True if successful, false if physical is improperly formatted or does not refer to an actual physical object.
Scripted as:
bind(string, string)

virtual bool ActionMapper::createAxis const Char   name,
Float    rampUp,
Float    rampDn
[pure virtual]
 

An "axis" has a value which ranges from 0.0 to 1.0, and fires an event whenever it's value changes. This corresponds to one half of a physical input axis.

Parameters:
name  A unique identifier for the object.
rampUp  Used to convert from a digital button to an analog axis value. This controls how quickly the axis will move from 0.0 to 1.0 when the button is pressed, in seconds.
rampDn  Used to convert from a digital button to an analog axis value. This controls how quickly the axis will move from 1.0 to 0.0 when the button is released, in seconds.
Scripted as:
bool createAxis(string)

virtual bool ActionMapper::createToggle const Char   name,
Float    pressAt,
Float    relAt
[pure virtual]
 

A "toggle" fires an event when it is pressed and another when it is released.

Parameters:
name  A unique identifier for the object.
pressAt  Used to convert from an analog axis to a digital button. This is the axis position at which the state will switch from "released" to "pressed".
relAt  Used to convert from an analog axis to a digital button. This is the axis position at which the state will switch from "pressed" to "released".
Scripted as:
bool createToggle(string)

virtual bool ActionMapper::createTrigger const Char   name,
Float    pressAt,
Float    relAt
[pure virtual]
 

A "trigger" fires an event when it is pressed (but not when it is released).

Parameters:
name  A unique identifier for the object.
pressAt  Used to convert from an analog axis to a digital button. This is the axis position at which the state will switch from "released" to "pressed".
relAt  Used to convert from an analog axis to a digital button. This is the axis position at which the state will switch from "pressed" to "released".
Scripted as:
bool createTrigger(string)

virtual bool ActionMapper::translate Event   event [pure virtual]
 

Translate a physical input event to a logical action. If a mapping exists, a new Action event will be added to the event queue. This is called automatically for all unhandled user input events.


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


Flat Four Engine
Copyright (C) 2001 by 379, Inc.
This page generated by Doxygen