cgv
Loading...
Searching...
No Matches
throttle_event.cxx
1#include "throttle_event.h"
2
3namespace cgv {
4 namespace gui {
5
7throttle_event::throttle_event(float _x, float _dx, unsigned _player_index, unsigned _controller_index, unsigned _throttle_index, double _time) :
8 event(EID_THROTTLE,0,0,_time), x(_x), dx(_dx), player_index(_player_index), controller_index(_controller_index), throttle_index(_throttle_index)
9{
10}
11
14{
15 return player_index;
16}
19{
20 return controller_index;
21}
24{
25 return throttle_index;
26}
27
28
30void throttle_event::stream_out(std::ostream& os) const
31{
33 os << x << "[";
34 if (dx > 0)
35 os << "+";
36 os << dx << "]";
37 os << "<" << (int)player_index << ":" << (int)controller_index << ":" << (int)throttle_index << ">";
38}
39
41void throttle_event::stream_in(std::istream& is)
42{
43 std::cerr << "not implemented" << std::endl;
44}
45
48{
49 return x;
50}
51
54{
55 return dx;
56}
57
60{
61 return get_value() - get_value_change();
62}
63 }
64}
virtual void stream_out(std::ostream &os) const
write to stream
Definition event.cxx:139
void stream_out(std::ostream &os) const
write to stream
float get_last_value() const
return the last value of the throttle
float get_value() const
return the current value of the throttle
unsigned get_controller_index() const
return controller index
throttle_event(float _x, float _dx, unsigned _player_index=0, unsigned _controller_index=0, unsigned _throttle_index=0, double _time=0)
construct a throttle event from value and value change
void stream_in(std::istream &is)
read from stream
float get_value_change() const
return the change of value of the throttle
unsigned get_throttle_index() const
return throttle index
unsigned get_player_index() const
return player index
@ EID_THROTTLE
id of throttle event describing a one axis controller
Definition event.h:19
the cgv namespace
Definition print.h:11