@@ -22,13 +22,12 @@ public class InputMapScreen implements SolUiScreen {
2222 public final InputMapMixedScreen inputMapMixedScreen ;
2323
2424 private final List <SolUiControl > controls ;
25- private final SolUiControl myPrevCtrl ;
25+ private final SolUiControl prevCtrl ;
2626 private final SolUiControl nextCtrl ;
27- private final Rectangle myListArea ;
27+ private final Rectangle listArea ;
2828 private final SolUiControl [] itemCtrls ;
29- private final Rectangle myDetailArea ;
30- private final Rectangle myItemCtrlArea ;
31- private final Vector2 myDetailHeaderPos ;
29+ private final Rectangle detailArea ;
30+ private final Rectangle itemCtrlArea ;
3231 private final SolUiControl cancelCtrl ;
3332 private final SolUiControl saveCtrl ;
3433 private final SolUiControl defaultsCtrl ;
@@ -40,10 +39,10 @@ public class InputMapScreen implements SolUiScreen {
4039 private static final float PRICE_COL_PERC = .1f ;
4140 private static final float AMT_COL_PERC = .1f ;
4241
43- private InputMapOperations myOperations ;
44- private int myPage ;
42+ private InputMapOperations operations ;
43+ private int page ;
4544 private int selectedIndex ;
46- private final Vector2 myListHeaderPos ;
45+ private final Vector2 listHeaderPos ;
4746 private static final float SMALL_GAP = .004f ;
4847 private static final float HEADER_TEXT_OFFS = .005f ;
4948 private static final int BTN_ROWS = 4 ;
@@ -62,16 +61,16 @@ public InputMapScreen(float r, GameOptions gameOptions) {
6261
6362
6463 // list header & controls
65- myListHeaderPos = new Vector2 (col0 + HEADER_TEXT_OFFS , row + HEADER_TEXT_OFFS ); // offset hack
64+ listHeaderPos = new Vector2 (col0 + HEADER_TEXT_OFFS , row + HEADER_TEXT_OFFS ); // offset hack
6665 float listCtrlW = contentW * .15f ;
6766 Rectangle nextArea = new Rectangle (col0 + contentW - listCtrlW , row , listCtrlW , headerH );
6867 nextCtrl = new SolUiControl (nextArea , true , gameOptions .getKeyRight ());
6968 nextCtrl .setDisplayName (">" );
7069 controls .add (nextCtrl );
7170 Rectangle prevArea = new Rectangle (nextArea .x - SMALL_GAP - listCtrlW , row , listCtrlW , headerH );
72- myPrevCtrl = new SolUiControl (prevArea , true , gameOptions .getKeyLeft ());
73- myPrevCtrl .setDisplayName ("<" );
74- controls .add (myPrevCtrl );
71+ prevCtrl = new SolUiControl (prevArea , true , gameOptions .getKeyLeft ());
72+ prevCtrl .setDisplayName ("<" );
73+ controls .add (prevCtrl );
7574 row += headerH + SMALL_GAP ;
7675
7776 // list
@@ -85,16 +84,15 @@ public InputMapScreen(float r, GameOptions gameOptions) {
8584 controls .add (itemCtrl );
8685 row += itemRowH + SMALL_GAP ;
8786 }
88- myListArea = new Rectangle (col0 , row , contentW , row - SMALL_GAP - listRow0 );
87+ listArea = new Rectangle (col0 , row , contentW , row - SMALL_GAP - listRow0 );
8988 row += bigGap ;
9089
9190 // detail header & area
92- myDetailHeaderPos = new Vector2 (col0 + HEADER_TEXT_OFFS , row + HEADER_TEXT_OFFS ); // offset hack
9391 row += headerH + SMALL_GAP ;
9492 float itemCtrlAreaW = contentW * .4f ;
95- myItemCtrlArea = new Rectangle (col0 + contentW - itemCtrlAreaW , row , itemCtrlAreaW , .2f );
96- myDetailArea = new Rectangle (col0 , row , contentW - itemCtrlAreaW - SMALL_GAP , myItemCtrlArea .height );
97- row += myDetailArea .height ;
93+ itemCtrlArea = new Rectangle (col0 + contentW - itemCtrlAreaW , row , itemCtrlAreaW , .2f );
94+ detailArea = new Rectangle (col0 , row , contentW - itemCtrlAreaW - SMALL_GAP , itemCtrlArea .height );
95+ row += detailArea .height ;
9896
9997 // Add the buttons and controls
10098 cancelCtrl = new SolUiControl (itemCtrl (3 ), true , gameOptions .getKeyClose ());
@@ -133,7 +131,7 @@ public void updateCustom(SolApplication cmp, SolInputManager.Ptr[] ptrs, boolean
133131
134132 // Save - saves new settings and returns to the options screen
135133 if (saveCtrl .isJustOff ()) {
136- myOperations .save (gameOptions );
134+ operations .save (gameOptions );
137135 im .setScreen (cmp , screens .options );
138136 }
139137
@@ -143,24 +141,29 @@ public void updateCustom(SolApplication cmp, SolInputManager.Ptr[] ptrs, boolean
143141 }
144142
145143 // Disable handling of key inputs while entering a new input key
146- if (myOperations .isEnterNewKey ()) {
147- myPrevCtrl .setEnabled (false );
144+ if (operations .isEnterNewKey ()) {
145+ prevCtrl .setEnabled (false );
148146 nextCtrl .setEnabled (false );
147+ upCtrl .setEnabled (false );
148+ downCtrl .setEnabled (false );
149149 return ;
150+ } else {
151+ upCtrl .setEnabled (true );
152+ downCtrl .setEnabled (true );
150153 }
151154
152155 // Defaults - Reset the input keys back to their default values
153156 if (defaultsCtrl .isJustOff ()) {
154- myOperations .resetToDefaults (gameOptions );
157+ operations .resetToDefaults (gameOptions );
155158 }
156159
157160 // Selected Item Control
158- List <InputConfigItem > itemsList = myOperations .getItems (gameOptions );
161+ List <InputConfigItem > itemsList = operations .getItems (gameOptions );
159162 int groupCount = itemsList .size ();
160163 int pageCount = groupCount / Const .ITEM_GROUPS_PER_PAGE ;
161164
162165 // Select the item the mouse clicked
163- int offset = myPage * Const .ITEM_GROUPS_PER_PAGE ;
166+ int offset = page * Const .ITEM_GROUPS_PER_PAGE ;
164167 for (int i = 0 ; i < itemCtrls .length ; i ++) {
165168 SolUiControl itemCtrl = itemCtrls [i ];
166169 if (itemCtrl .isJustOff ()) {
@@ -169,13 +172,13 @@ public void updateCustom(SolApplication cmp, SolInputManager.Ptr[] ptrs, boolean
169172 }
170173
171174 // Left and Right Page Control
172- if (myPrevCtrl .isJustOff ()) myPage --;
173- if (nextCtrl .isJustOff ()) myPage ++;
175+ if (prevCtrl .isJustOff ()) page --;
176+ if (nextCtrl .isJustOff ()) page ++;
174177 if (pageCount == 0 || pageCount * Const .ITEM_GROUPS_PER_PAGE < groupCount ) pageCount += 1 ;
175- if (myPage < 0 ) myPage = 0 ;
176- if (myPage >= pageCount ) myPage = pageCount - 1 ;
177- myPrevCtrl .setEnabled (0 < myPage );
178- nextCtrl .setEnabled (myPage < pageCount - 1 );
178+ if (page < 0 ) page = 0 ;
179+ if (page >= pageCount ) page = pageCount - 1 ;
180+ prevCtrl .setEnabled (0 < page );
181+ nextCtrl .setEnabled (page < pageCount - 1 );
179182
180183 // Ensure Selected item is on page
181184 if (selectedIndex < offset || selectedIndex >= offset + Const .ITEM_GROUPS_PER_PAGE ) selectedIndex = offset ;
@@ -184,17 +187,17 @@ public void updateCustom(SolApplication cmp, SolInputManager.Ptr[] ptrs, boolean
184187 if (upCtrl .isJustOff ()) {
185188 selectedIndex --;
186189 if (selectedIndex < 0 ) selectedIndex = 0 ;
187- if (selectedIndex < offset ) myPage --;
190+ if (selectedIndex < offset ) page --;
188191 }
189192 if (downCtrl .isJustOff ()) {
190193 selectedIndex ++;
191194 if (selectedIndex >= groupCount ) selectedIndex = groupCount - 1 ;
192- if (selectedIndex >= offset + Const .ITEM_GROUPS_PER_PAGE ) myPage ++;
193- if (myPage >= pageCount ) myPage = pageCount - 1 ;
195+ if (selectedIndex >= offset + Const .ITEM_GROUPS_PER_PAGE ) page ++;
196+ if (page >= pageCount ) page = pageCount - 1 ;
194197 }
195198
196199 // Inform the input screen which item is selected
197- myOperations .setSelectedIndex (selectedIndex );
200+ operations .setSelectedIndex (selectedIndex );
198201 }
199202
200203 @ Override
@@ -210,17 +213,17 @@ public void drawImgs(UiDrawer uiDrawer, SolApplication cmp) {
210213 @ Override
211214 public void drawText (UiDrawer uiDrawer , SolApplication cmp ) {
212215 GameOptions gameOptions = cmp .getOptions ();
213- List <InputConfigItem > list = myOperations .getItems (gameOptions );
216+ List <InputConfigItem > list = operations .getItems (gameOptions );
214217
215- float imgColW = myListArea .width * IMG_COL_PERC ;
216- float equiColW = myListArea .width * EQUI_COL_PERC ;
217- float priceWidth = myListArea .width * PRICE_COL_PERC ;
218- float amtWidth = myListArea .width * AMT_COL_PERC ;
219- float nameWidth = myListArea .width - imgColW - equiColW - priceWidth - amtWidth ;
218+ float imgColW = listArea .width * IMG_COL_PERC ;
219+ float equiColW = listArea .width * EQUI_COL_PERC ;
220+ float priceWidth = listArea .width * PRICE_COL_PERC ;
221+ float amtWidth = listArea .width * AMT_COL_PERC ;
222+ float nameWidth = listArea .width - imgColW - equiColW - priceWidth - amtWidth ;
220223
221224 // Display the input mapping in the grid control
222225 for (int i = 0 ; i < itemCtrls .length ; i ++) {
223- int groupIdx = myPage * Const .ITEM_GROUPS_PER_PAGE + i ;
226+ int groupIdx = page * Const .ITEM_GROUPS_PER_PAGE + i ;
224227 int groupCount = list .size ();
225228 if (groupCount <= groupIdx ) continue ;
226229 SolUiControl itemCtrl = itemCtrls [i ];
@@ -235,10 +238,10 @@ public void drawText(UiDrawer uiDrawer, SolApplication cmp) {
235238 }
236239
237240 // Draw the header title
238- uiDrawer .drawString (myOperations .getHeader (), myListHeaderPos .x , myListHeaderPos .y , FontSize .WINDOW , false , SolColor .W );
241+ uiDrawer .drawString (operations .getHeader (), listHeaderPos .x , listHeaderPos .y , FontSize .WINDOW , false , SolColor .W );
239242
240243 // Draw the detail text
241- uiDrawer .drawString (myOperations .getDisplayDetail (), myDetailArea .x + .015f , myDetailArea .y + .015f , FontSize .WINDOW , false , SolColor .W );
244+ uiDrawer .drawString (operations .getDisplayDetail (), detailArea .x + .015f , detailArea .y + .015f , FontSize .WINDOW , false , SolColor .W );
242245 }
243246
244247 @ Override
@@ -254,11 +257,11 @@ public boolean isCursorOnBg(SolInputManager.Ptr ptr) {
254257 @ Override
255258 public void onAdd (SolApplication cmp ) {
256259 // Add any extra screen information as required by the input screens. E.g. buttons
257- if (myOperations != null ) {
258- cmp .getInputMan ().addScreen (cmp , myOperations );
260+ if (operations != null ) {
261+ cmp .getInputMan ().addScreen (cmp , operations );
259262 }
260263
261- myPage = 0 ;
264+ page = 0 ;
262265 selectedIndex = 0 ;
263266 }
264267
@@ -268,12 +271,12 @@ public void blurCustom(SolApplication cmp) {
268271 }
269272
270273 public Rectangle itemCtrl (int row ) {
271- float h = (myItemCtrlArea .height - SMALL_GAP * (BTN_ROWS - 1 )) / BTN_ROWS ;
272- return new Rectangle (myItemCtrlArea .x , myItemCtrlArea .y + (h + SMALL_GAP ) * row , myItemCtrlArea .width , h );
274+ float h = (itemCtrlArea .height - SMALL_GAP * (BTN_ROWS - 1 )) / BTN_ROWS ;
275+ return new Rectangle (itemCtrlArea .x , itemCtrlArea .y + (h + SMALL_GAP ) * row , itemCtrlArea .width , h );
273276 }
274277
275278 public void setOperations (InputMapOperations operations ) {
276- myOperations = operations ;
279+ this . operations = operations ;
277280 }
278281
279282}
0 commit comments