-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathButtonFunction.pde
More file actions
47 lines (38 loc) · 1.35 KB
/
ButtonFunction.pde
File metadata and controls
47 lines (38 loc) · 1.35 KB
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
import java.util.LinkedHashMap;
enum ButtonFunction {
NONE("None"), JUMP("Jump"), DASH("Dash"), TOGGLE_TRAIL("Toggle show Trail"), TOGGLE_CAMERA("Toggle show Camera Marker"),
NEXT_STYLE("Next style"), PREV_STYLE("Previous style"), PAUSE("Pause"), STEP_FORWARD("Step forward");
private final String label;
private ButtonFunction(final String label) {
this.label = label;
}
String getLabel() {
return label;
}
private static final Map<String, Object> valuesMap;
private static final ButtonFunction[] reverseLookupTable;
private static final boolean[] enabledWhilePausing;
private static final int size = ButtonFunction.values().length;
static {
valuesMap = new LinkedHashMap<String, Object>();
for (ButtonFunction func : ButtonFunction.values()) {
valuesMap.put(func.getLabel(), func);
}
reverseLookupTable = ButtonFunction.values();
enabledWhilePausing = new boolean[size];
enabledWhilePausing[PAUSE.ordinal()] = true;
enabledWhilePausing[STEP_FORWARD.ordinal()] = true;
}
static Map<String, Object> getValuesMap() {
return valuesMap;
}
static ButtonFunction getEnumByOrdinal(int o) {
return reverseLookupTable[o];
}
boolean isEnabledWhilePausing() {
return enabledWhilePausing[ordinal()];
}
static boolean isEnabledWhilePausing(int o) {
return enabledWhilePausing[o];
}
}