21 #include "ControlStatus.h" 25 const float ControlStatus::NO_MAX = -10000.0f;
31 this->addButton(activator,value);
34 void ControlStatus::addButton(Activator activator,
float value) {
35 buttons.insert(std::pair<Activator,int>(activator,value));
40 for(
auto it = cs.buttons.begin(); it != cs.buttons.end(); it++)
41 buttons.insert(std::pair<Activator,float>(it->first,it->second));
45 ControlStatus::Activator ControlStatus::activatorFromJoystickNumber(
int n) {
47 throw "Argument must be less than 8";
48 const Activator map[8] = {JOYSTICK_0,JOYSTICK_1,JOYSTICK_2,JOYSTICK_3,JOYSTICK_4,JOYSTICK_5,JOYSTICK_6,JOYSTICK_7};
53 if(maxValue == NO_MAX) {
55 for (
auto it = buttons.begin(); it != buttons.end(); it++)
56 if (std::abs(it->second) > std::abs(maxValue)) {
57 maxValue = it->second;
58 maxValueActivator = it->first;
65 if(maxValue == NO_MAX)
67 return maxValueActivator;
71 std::map<Activator ,float>::iterator elem = buttons.find(activator);
72 return elem == buttons.end() ? 0.0f : elem->second;
75 bool ControlStatus::isActive(){
80 bool ControlStatus::isActive(Activator activator) {
ControlStatus(Activator activator, float value)
The class that contains information about a function at the state of creation.
Activator getMaxActivator()