-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonEvent.java
More file actions
103 lines (101 loc) · 2.7 KB
/
Copy pathButtonEvent.java
File metadata and controls
103 lines (101 loc) · 2.7 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package com.walnuthillseagles.walnutlibrary;
//Beta is Beta
/**
* Created by Yan Vologzhanin on 1/6/2016.
*/
public class ButtonEvent {
private int tablePos;
private double val;
private boolean isToggle;
public enum digValues{
A1, B1, X1, Y1, BACK1, START1, GUIDE1, LEFT1,RIGHT1,
DOWN1, UP1, LBUMP1,RBUMP1, LSTICK1, RSTICK1,
A2, B2, X2, Y2, BACK2, START2, GUIDE2, LEFT2, RIGHT2,
DOWN2, UP2,LBUMP2, RBUMP2, LSTICK2, RSTICK2;
}
//Construcor
public ButtonEvent(String daButton, double myVal){
//Get table position from noncase sensitive button name
tablePos = findTablePos(digValues.valueOf(daButton.toUpperCase()));
val = myVal;
//Congradulatiionsns, you found a secret :D
isToggle = true;
}
//Getters
public double getVal(){
return val;
}
public boolean checkToggle(){
return isToggle;
}
public int getPos(){
return tablePos;
}
//Utility Methods
private int findTablePos(digValues daButton){
switch(daButton){
case A1:
return 0;
case B1:
return 1;
case X1:
return 2;
case Y1:
return 3;
case BACK1:
return 4;
case START1:
return 5;
case GUIDE1:
return 6;
case LEFT1:
return 7;
case RIGHT1:
return 8;
case DOWN1:
return 9;
case UP1:
return 10;
case LBUMP1:
return 11;
case RBUMP1:
return 12;
case LSTICK1:
return 13;
case RSTICK1:
return 14;
case A2:
return 15;
case B2:
return 16;
case X2:
return 17;
case Y2:
return 18;
case BACK2:
return 19;
case START2:
return 20;
case GUIDE2:
return 21;
case LEFT2:
return 22;
case RIGHT2:
return 23;
case DOWN2:
return 24;
case UP2:
return 25;
case LBUMP2:
return 26;
case RBUMP2:
return 27;
case LSTICK2:
return 28;
case RSTICK2:
return 29;
default:
return 0;
}
}
}