~ubuntu-branches/ubuntu/quantal/flightgear/quantal

« back to all changes in this revision

Viewing changes to src/FDM/YASim/ControlMap.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Ove Kaaven
  • Date: 2002-03-27 21:50:15 UTC
  • Revision ID: james.westby@ubuntu.com-20020327215015-0rvi3o8iml0a8s93
Tags: upstream-0.7.9
ImportĀ upstreamĀ versionĀ 0.7.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _CONTROL_MAP_HPP
 
2
#define _CONTROL_MAP_HPP
 
3
 
 
4
#include "Vector.hpp"
 
5
 
 
6
namespace yasim {
 
7
 
 
8
class ControlMap {
 
9
public:
 
10
    ~ControlMap();
 
11
 
 
12
    enum OutputType { THROTTLE, MIXTURE, ADVANCE, REHEAT, PROP,
 
13
                      BRAKE, STEER, EXTEND,
 
14
                      INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER, VECTOR,
 
15
                      BOOST };
 
16
 
 
17
    enum { OPT_SPLIT  = 0x01,
 
18
           OPT_INVERT = 0x02,
 
19
           OPT_SQUARE = 0x04 };
 
20
 
 
21
    // Returns a new, not-yet-used "input handle" for addMapping and
 
22
    // setInput.  This typically corresponds to one user axis.
 
23
    int newInput();
 
24
 
 
25
    // Adds a mapping to between input handle and a particular setting
 
26
    // on an output object.  The value of output MUST match the type
 
27
    // of object!
 
28
    void addMapping(int input, int output, void* object, int options=0);
 
29
 
 
30
    // An additional form to specify a mapping range.  Input values
 
31
    // outside of [src0:src1] are clamped, and are then mapped to
 
32
    // [dst0:dst1] before being set on the object.
 
33
    void addMapping(int input, int output, void* object, int options,
 
34
                    float src0, float src1, float dst0, float dst1);
 
35
 
 
36
    // Resets our accumulated input values.  Call before any
 
37
    // setInput() invokations.
 
38
    void reset();
 
39
 
 
40
    // Sets the specified input (as returned by newInput) to the
 
41
    // specified value.
 
42
    void setInput(int input, float value);
 
43
 
 
44
    // Calculates and applies the settings received since the last reset().
 
45
    void applyControls();
 
46
 
 
47
private:
 
48
    struct OutRec { int type; void* object; Vector maps; };
 
49
    struct MapRec  { OutRec* out; int idx; int opt; float val;
 
50
                     float src0; float src1; float dst0; float dst1; };
 
51
 
 
52
    // A list of (sub)Vectors containing a bunch of MapRec objects for
 
53
    // each input handle.
 
54
    Vector _inputs;
 
55
 
 
56
    // An unordered list of output settings.
 
57
    Vector _outputs;
 
58
};
 
59
 
 
60
}; // namespace yasim
 
61
#endif // _CONTROL_MAP_HPP