-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.cpp
More file actions
40 lines (38 loc) · 806 Bytes
/
controller.cpp
File metadata and controls
40 lines (38 loc) · 806 Bytes
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
#include "controller.h"
#include <Arduino.h>
float Controller::getAxis(int ID){
while (axes.getLength() <= ID){
axes.add(0.0f);
}
return axes.get(ID);
}
bool Controller::getButton(int ID){
while (buttons.getLength() <= ID){
buttons.add(0.0f);
}
return buttons.get(ID);
}
float Controller::getPOV(int ID){
while (POVs.getLength() <= ID){
POVs.add(0.0f);
}
return POVs.get(ID);
}
void Controller::setAxis(int ID, float value){
while (axes.getLength() <= ID){
axes.add(0.0f);
}
axes.get(ID) = value;
}
void Controller::setButton(int ID, bool on){
while (buttons.getLength() <= ID){
buttons.add(0.0f);
}
buttons.get(ID) = on;
}
void Controller::setPOV(int ID, float value){
while (POVs.getLength() <= ID){
POVs.add(0.0f);
}
POVs.get(ID) = value;
}