@@ -22,25 +22,9 @@ const sub = document.getElementById('sub');
2222
2323sub . rotation = 0 ; // rotation holder
2424
25-
26- // function printImages(imgs){
27- // for (let key in imgs){
28- // const item = imgs[key];
29- // if(typeof item === 'object'){
30- // printImages(item)
31- // continue
32- // }
33- // console.log(item);
34-
35- // }
36- // }
37- // printImages(imgs)
38-
3925const cache = { }
4026function loadImage ( url ) {
4127 let img = cache [ url ] ;
42- // console.log(img);
43-
4428 if ( ! img ) {
4529 img = new Image ( ) ;
4630 img . src = url ;
@@ -49,8 +33,6 @@ function loadImage(url) {
4933 return img
5034}
5135
52-
53-
5436function addHistory ( v ) {
5537 history . innerText = v + '\n' + history . innerText ;
5638}
@@ -136,8 +118,6 @@ g.onConnected(e => {
136118 Y . onReleased ( e => buttonsEl . Y . src = loadImage ( imgs . Y . RELEASED ) . src ) ;
137119
138120 // colors
139-
140-
141121 A . onPushed ( e => sub . style . filter = `hue-rotate(55deg)` ) ;
142122 B . onPushed ( e => sub . style . filter = `hue-rotate(315deg)` ) ;
143123 X . onPushed ( e => sub . style . filter = `hue-rotate(170deg)` ) ;
@@ -168,7 +148,7 @@ g.onConnected(e => {
168148 RB . onReleased ( e => topButtonsEl . RIGHT . src = loadImage ( imgs . TOPBUTTONS . RIGHT . RELEASED ) . src ) ;
169149
170150 const rect = connectedMessage . getBoundingClientRect ( ) ;
171- const { left, top } = rect
151+ const { left, top } = rect ;
172152 sub . style . left = `${ left } px` ;
173153 sub . style . top = `${ top - rect . height - sub . height * .5 } px` ;
174154 sub . classList . remove ( 'hide' ) ;
@@ -197,74 +177,74 @@ function update() {
197177 const { LJX , RJX } = buttons ;
198178
199179 if ( A . touched ) {
200- output . innerText += 'A PRESSED\n'
180+ output . innerText += 'A PRESSED\n' ;
201181 }
202182
203183 if ( B . touched ) {
204- output . innerText += 'B PRESSED\n'
184+ output . innerText += 'B PRESSED\n' ;
205185 }
206186
207187 sub . shake = false ;
208188 if ( A . touched && B . touched ) {
209- control0 . vibrate ( 100 )
189+ control0 . vibrate ( 100 ) ;
210190 sub . shake = true ;
211191 }
212192
213193 if ( Y . touched ) {
214- output . innerText += `Y PRESSED\n`
194+ output . innerText += `Y PRESSED\n` ;
215195 }
216196
217197 if ( X . touched ) {
218- output . innerText += `X PRESSED\n`
198+ output . innerText += `X PRESSED\n` ;
219199 }
220200
221201 if ( LB . touched ) {
222- output . innerText += 'LB PRESSED\n'
202+ output . innerText += 'LB PRESSED\n' ;
223203 }
224204 if ( RB . touched ) {
225- output . innerText += 'RB PRESSED\n'
205+ output . innerText += 'RB PRESSED\n' ;
226206 }
227207
228208 if ( LT . touched ) {
229209 output . innerText += `LT PRESSED\n\tValue: ${ LT . value } \n` ;
230- control0 . vibrate ( 100 , LT . value )
210+ control0 . vibrate ( 100 , LT . value ) ;
231211 sub . shake = true ;
232212 }
233213 if ( RT . touched ) {
234214 output . innerText += `RT PRESSED\n\tValue: ${ RT . value } \n` ;
235- control0 . vibrate ( 100 , RT . value )
215+ control0 . vibrate ( 100 , RT . value ) ;
236216 sub . shake = true ;
237217 }
238218
239219 if ( VIEW . touched ) {
240- output . innerText += 'VIEW PRESSED\n'
220+ output . innerText += 'VIEW PRESSED\n' ;
241221 }
242222 if ( MENU . touched ) {
243- output . innerText += 'MENU PRESSED\n'
223+ output . innerText += 'MENU PRESSED\n' ;
244224 }
245225 // LJB, RJB, UP, DOWN, LEFT, RIGHT
246226 if ( LJB . touched ) {
247- output . innerText += 'LJB PRESSED\n'
227+ output . innerText += 'LJB PRESSED\n' ;
248228 }
249229
250230 if ( RJB . touched ) {
251- output . innerText += 'RJB PRESSED\n'
231+ output . innerText += 'RJB PRESSED\n' ;
252232 }
253233
254234 if ( UP . touched ) {
255- output . innerText += 'UP PRESSED\n'
235+ output . innerText += 'UP PRESSED\n' ;
256236 }
257237
258238 if ( DOWN . touched ) {
259- output . innerText += 'DOWN PRESSED\n'
239+ output . innerText += 'DOWN PRESSED\n' ;
260240 }
261241
262242 if ( LEFT . touched ) {
263- output . innerText += 'LEFT PRESSED\n'
243+ output . innerText += 'LEFT PRESSED\n' ;
264244 }
265245
266246 if ( RIGHT . touched ) {
267- output . innerText += 'RIGHT PRESSED\n'
247+ output . innerText += 'RIGHT PRESSED\n' ;
268248 }
269249
270250 // const {LJX, RJX} = axes;
0 commit comments