aboutsummaryrefslogtreecommitdiff
path: root/sons_of_sol/ControlMotionEvent.hpp
blob: 930539ba98d5ba997b07fba277496e47198d4586 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef CONTROLMOTIONEVENT_HPP_
#define CONTROLMOTIONEVENT_HPP_

/*
 * Author: jrahm
 * created: 2013/11/01
 * ControlMotionEvent.hpp: <description>
 */

/* This is the class used to 
 * signal an event from the controller.
 *
 * These values have been normalized */
class ControlMotionEvent {
 public:
  enum MotionEventType {
    NONE,
    PITCH,
    ROLL,
    YAW,
    THROTTLE,
    STRAFE_SIDE,
    STRAFE_UP,
    FIRE_PRIMARY
  };

  enum MotionOrigin { JOYSTICK, MOUSE, BUTTON };

  ControlMotionEvent(MotionEventType type, double mag, MotionOrigin origin)
      : mag(mag), type(type), origin(origin) {}

  inline double getMagnitude() const { return mag; }

  inline MotionEventType getType() const { return type; }

  inline MotionOrigin getOrigin() const { return origin; }

  inline void setMagnitude(double mag) { this->mag = mag; }

  inline void setType(MotionEventType type) { this->type = type; }

  inline void setOrigin(MotionOrigin origin) { this->origin = origin; }

 private:
  double mag;
  MotionEventType type;
  MotionOrigin origin;
};

#endif /* CONTROLMOTIONEVENT_HPP_ */