Revision 77e66c58
Added by Leszek Koltunski 11 months ago
src/main/java/org/distorted/examples/olimpic/OlimpicActivity.java | ||
---|---|---|
81 | 81 |
CheckBox box = (CheckBox)view; |
82 | 82 |
int id = box.getId(); |
83 | 83 |
boolean checked = box.isChecked(); |
84 |
OlimpicSurfaceView sView = findViewById(R.id.olimpicSurfaceView); |
|
85 |
|
|
86 |
switch(id) |
|
87 |
{ |
|
88 |
case R.id.olimpicCheckBoxBlue0 : sView.getRenderer().pressed(0,0,checked); mBlue[0] =checked; break; |
|
89 |
case R.id.olimpicCheckBoxBlue1 : sView.getRenderer().pressed(0,1,checked); mBlue[1] =checked; break; |
|
90 |
case R.id.olimpicCheckBoxBlue2 : sView.getRenderer().pressed(0,2,checked); mBlue[2] =checked; break; |
|
91 |
case R.id.olimpicCheckBoxBlue3 : sView.getRenderer().pressed(0,3,checked); mBlue[3] =checked; break; |
|
92 |
case R.id.olimpicCheckBoxBlue4 : sView.getRenderer().pressed(0,4,checked); mBlue[4] =checked; break; |
|
93 |
case R.id.olimpicCheckBoxBlue5 : sView.getRenderer().pressed(0,5,checked); mBlue[5] =checked; break; |
|
94 |
case R.id.olimpicCheckBoxBlue6 : sView.getRenderer().pressed(0,6,checked); mBlue[6] =checked; break; |
|
95 |
case R.id.olimpicCheckBoxBlue7 : sView.getRenderer().pressed(0,7,checked); mBlue[7] =checked; break; |
|
96 |
case R.id.olimpicCheckBoxBlue8 : sView.getRenderer().pressed(0,8,checked); mBlue[8] =checked; break; |
|
97 |
|
|
98 |
case R.id.olimpicCheckBoxBlack0 : sView.getRenderer().pressed(1,0,checked); mBlack[0] =checked; break; |
|
99 |
case R.id.olimpicCheckBoxBlack1 : sView.getRenderer().pressed(1,1,checked); mBlack[1] =checked; break; |
|
100 |
case R.id.olimpicCheckBoxBlack2 : sView.getRenderer().pressed(1,2,checked); mBlack[2] =checked; break; |
|
101 |
case R.id.olimpicCheckBoxBlack3 : sView.getRenderer().pressed(1,3,checked); mBlack[3] =checked; break; |
|
102 |
case R.id.olimpicCheckBoxBlack4 : sView.getRenderer().pressed(1,4,checked); mBlack[4] =checked; break; |
|
103 |
case R.id.olimpicCheckBoxBlack5 : sView.getRenderer().pressed(1,5,checked); mBlack[5] =checked; break; |
|
104 |
case R.id.olimpicCheckBoxBlack6 : sView.getRenderer().pressed(1,6,checked); mBlack[6] =checked; break; |
|
105 |
case R.id.olimpicCheckBoxBlack7 : sView.getRenderer().pressed(1,7,checked); mBlack[7] =checked; break; |
|
106 |
case R.id.olimpicCheckBoxBlack8 : sView.getRenderer().pressed(1,8,checked); mBlack[8] =checked; break; |
|
107 |
|
|
108 |
case R.id.olimpicCheckBoxRed0 : sView.getRenderer().pressed(2,0,checked); mRed[0] =checked; break; |
|
109 |
case R.id.olimpicCheckBoxRed1 : sView.getRenderer().pressed(2,1,checked); mRed[1] =checked; break; |
|
110 |
case R.id.olimpicCheckBoxRed2 : sView.getRenderer().pressed(2,2,checked); mRed[2] =checked; break; |
|
111 |
case R.id.olimpicCheckBoxRed3 : sView.getRenderer().pressed(2,3,checked); mRed[3] =checked; break; |
|
112 |
case R.id.olimpicCheckBoxRed4 : sView.getRenderer().pressed(2,4,checked); mRed[4] =checked; break; |
|
113 |
case R.id.olimpicCheckBoxRed5 : sView.getRenderer().pressed(2,5,checked); mRed[5] =checked; break; |
|
114 |
case R.id.olimpicCheckBoxRed6 : sView.getRenderer().pressed(2,6,checked); mRed[6] =checked; break; |
|
115 |
case R.id.olimpicCheckBoxRed7 : sView.getRenderer().pressed(2,7,checked); mRed[7] =checked; break; |
|
116 |
case R.id.olimpicCheckBoxRed8 : sView.getRenderer().pressed(2,8,checked); mRed[8] =checked; break; |
|
117 |
|
|
118 |
case R.id.olimpicCheckBoxYellow0: sView.getRenderer().pressed(3,0,checked); mYellow[0]=checked; break; |
|
119 |
case R.id.olimpicCheckBoxYellow1: sView.getRenderer().pressed(3,1,checked); mYellow[1]=checked; break; |
|
120 |
case R.id.olimpicCheckBoxYellow2: sView.getRenderer().pressed(3,2,checked); mYellow[2]=checked; break; |
|
121 |
case R.id.olimpicCheckBoxYellow3: sView.getRenderer().pressed(3,3,checked); mYellow[3]=checked; break; |
|
122 |
case R.id.olimpicCheckBoxYellow4: sView.getRenderer().pressed(3,4,checked); mYellow[4]=checked; break; |
|
123 |
case R.id.olimpicCheckBoxYellow5: sView.getRenderer().pressed(3,5,checked); mYellow[5]=checked; break; |
|
124 |
case R.id.olimpicCheckBoxYellow6: sView.getRenderer().pressed(3,6,checked); mYellow[6]=checked; break; |
|
125 |
case R.id.olimpicCheckBoxYellow7: sView.getRenderer().pressed(3,7,checked); mYellow[7]=checked; break; |
|
126 |
case R.id.olimpicCheckBoxYellow8: sView.getRenderer().pressed(3,8,checked); mYellow[8]=checked; break; |
|
127 |
|
|
128 |
case R.id.olimpicCheckBoxGreen0 : sView.getRenderer().pressed(4,0,checked); mGreen[0] =checked; break; |
|
129 |
case R.id.olimpicCheckBoxGreen1 : sView.getRenderer().pressed(4,1,checked); mGreen[1] =checked; break; |
|
130 |
case R.id.olimpicCheckBoxGreen2 : sView.getRenderer().pressed(4,2,checked); mGreen[2] =checked; break; |
|
131 |
case R.id.olimpicCheckBoxGreen3 : sView.getRenderer().pressed(4,3,checked); mGreen[3] =checked; break; |
|
132 |
case R.id.olimpicCheckBoxGreen4 : sView.getRenderer().pressed(4,4,checked); mGreen[4] =checked; break; |
|
133 |
case R.id.olimpicCheckBoxGreen5 : sView.getRenderer().pressed(4,5,checked); mGreen[5] =checked; break; |
|
134 |
case R.id.olimpicCheckBoxGreen6 : sView.getRenderer().pressed(4,6,checked); mGreen[6] =checked; break; |
|
135 |
case R.id.olimpicCheckBoxGreen7 : sView.getRenderer().pressed(4,7,checked); mGreen[7] =checked; break; |
|
136 |
case R.id.olimpicCheckBoxGreen8 : sView.getRenderer().pressed(4,8,checked); mGreen[8] =checked; break; |
|
137 |
} |
|
84 |
OlimpicSurfaceView v = findViewById(R.id.olimpicSurfaceView); |
|
85 |
OlimpicRenderer r = v.getRenderer(); |
|
86 |
|
|
87 |
if( id == R.id.olimpicCheckBoxBlue0 ) r.pressed(0,0,checked); mBlue[0] =checked; |
|
88 |
if( id == R.id.olimpicCheckBoxBlue1 ) r.pressed(0,1,checked); mBlue[1] =checked; |
|
89 |
if( id == R.id.olimpicCheckBoxBlue2 ) r.pressed(0,2,checked); mBlue[2] =checked; |
|
90 |
if( id == R.id.olimpicCheckBoxBlue3 ) r.pressed(0,3,checked); mBlue[3] =checked; |
|
91 |
if( id == R.id.olimpicCheckBoxBlue4 ) r.pressed(0,4,checked); mBlue[4] =checked; |
|
92 |
if( id == R.id.olimpicCheckBoxBlue5 ) r.pressed(0,5,checked); mBlue[5] =checked; |
|
93 |
if( id == R.id.olimpicCheckBoxBlue6 ) r.pressed(0,6,checked); mBlue[6] =checked; |
|
94 |
if( id == R.id.olimpicCheckBoxBlue7 ) r.pressed(0,7,checked); mBlue[7] =checked; |
|
95 |
if( id == R.id.olimpicCheckBoxBlue8 ) r.pressed(0,8,checked); mBlue[8] =checked; |
|
96 |
|
|
97 |
if( id == R.id.olimpicCheckBoxBlack0 ) r.pressed(1,0,checked); mBlack[0] =checked; |
|
98 |
if( id == R.id.olimpicCheckBoxBlack1 ) r.pressed(1,1,checked); mBlack[1] =checked; |
|
99 |
if( id == R.id.olimpicCheckBoxBlack2 ) r.pressed(1,2,checked); mBlack[2] =checked; |
|
100 |
if( id == R.id.olimpicCheckBoxBlack3 ) r.pressed(1,3,checked); mBlack[3] =checked; |
|
101 |
if( id == R.id.olimpicCheckBoxBlack4 ) r.pressed(1,4,checked); mBlack[4] =checked; |
|
102 |
if( id == R.id.olimpicCheckBoxBlack5 ) r.pressed(1,5,checked); mBlack[5] =checked; |
|
103 |
if( id == R.id.olimpicCheckBoxBlack6 ) r.pressed(1,6,checked); mBlack[6] =checked; |
|
104 |
if( id == R.id.olimpicCheckBoxBlack7 ) r.pressed(1,7,checked); mBlack[7] =checked; |
|
105 |
if( id == R.id.olimpicCheckBoxBlack8 ) r.pressed(1,8,checked); mBlack[8] =checked; |
|
106 |
|
|
107 |
if( id == R.id.olimpicCheckBoxRed0 ) r.pressed(2,0,checked); mRed[0] =checked; |
|
108 |
if( id == R.id.olimpicCheckBoxRed1 ) r.pressed(2,1,checked); mRed[1] =checked; |
|
109 |
if( id == R.id.olimpicCheckBoxRed2 ) r.pressed(2,2,checked); mRed[2] =checked; |
|
110 |
if( id == R.id.olimpicCheckBoxRed3 ) r.pressed(2,3,checked); mRed[3] =checked; |
|
111 |
if( id == R.id.olimpicCheckBoxRed4 ) r.pressed(2,4,checked); mRed[4] =checked; |
|
112 |
if( id == R.id.olimpicCheckBoxRed5 ) r.pressed(2,5,checked); mRed[5] =checked; |
|
113 |
if( id == R.id.olimpicCheckBoxRed6 ) r.pressed(2,6,checked); mRed[6] =checked; |
|
114 |
if( id == R.id.olimpicCheckBoxRed7 ) r.pressed(2,7,checked); mRed[7] =checked; |
|
115 |
if( id == R.id.olimpicCheckBoxRed8 ) r.pressed(2,8,checked); mRed[8] =checked; |
|
116 |
|
|
117 |
if( id == R.id.olimpicCheckBoxYellow0) r.pressed(3,0,checked); mYellow[0]=checked; |
|
118 |
if( id == R.id.olimpicCheckBoxYellow1) r.pressed(3,1,checked); mYellow[1]=checked; |
|
119 |
if( id == R.id.olimpicCheckBoxYellow2) r.pressed(3,2,checked); mYellow[2]=checked; |
|
120 |
if( id == R.id.olimpicCheckBoxYellow3) r.pressed(3,3,checked); mYellow[3]=checked; |
|
121 |
if( id == R.id.olimpicCheckBoxYellow4) r.pressed(3,4,checked); mYellow[4]=checked; |
|
122 |
if( id == R.id.olimpicCheckBoxYellow5) r.pressed(3,5,checked); mYellow[5]=checked; |
|
123 |
if( id == R.id.olimpicCheckBoxYellow6) r.pressed(3,6,checked); mYellow[6]=checked; |
|
124 |
if( id == R.id.olimpicCheckBoxYellow7) r.pressed(3,7,checked); mYellow[7]=checked; |
|
125 |
if( id == R.id.olimpicCheckBoxYellow8) r.pressed(3,8,checked); mYellow[8]=checked; |
|
126 |
|
|
127 |
if( id == R.id.olimpicCheckBoxGreen0 ) r.pressed(4,0,checked); mGreen[0] =checked; |
|
128 |
if( id == R.id.olimpicCheckBoxGreen1 ) r.pressed(4,1,checked); mGreen[1] =checked; |
|
129 |
if( id == R.id.olimpicCheckBoxGreen2 ) r.pressed(4,2,checked); mGreen[2] =checked; |
|
130 |
if( id == R.id.olimpicCheckBoxGreen3 ) r.pressed(4,3,checked); mGreen[3] =checked; |
|
131 |
if( id == R.id.olimpicCheckBoxGreen4 ) r.pressed(4,4,checked); mGreen[4] =checked; |
|
132 |
if( id == R.id.olimpicCheckBoxGreen5 ) r.pressed(4,5,checked); mGreen[5] =checked; |
|
133 |
if( id == R.id.olimpicCheckBoxGreen6 ) r.pressed(4,6,checked); mGreen[6] =checked; |
|
134 |
if( id == R.id.olimpicCheckBoxGreen7 ) r.pressed(4,7,checked); mGreen[7] =checked; |
|
135 |
if( id == R.id.olimpicCheckBoxGreen8 ) r.pressed(4,8,checked); mGreen[8] =checked; |
|
138 | 136 |
} |
139 | 137 |
|
140 | 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
in API 34 R.id. things are no loger constants and cannot be used in switches.