11/*
2- * Copyright 2018 MovingBlocks
2+ * Copyright 2020 MovingBlocks
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -41,34 +41,40 @@ public class OptionsScreen extends SolUiBaseScreen {
4141 private final SolUiControl musicVolumeControl ;
4242 private final SolUiControl mapScrollSpeedControl ;
4343
44- OptionsScreen (MenuLayout menuLayout , GameOptions gameOptions ) {
44+ OptionsScreen (boolean mobile , MenuLayout menuLayout , GameOptions gameOptions ) {
4545 displayDimensions = SolApplication .displayDimensions ;
46-
47- musicVolumeControl = new SolUiControl (menuLayout .buttonRect (-1 , - 2 ), true );
46+ int rowNo = mobile ? 0 : - 3 ;
47+ musicVolumeControl = new SolUiControl (menuLayout .buttonRect (-1 , rowNo ++ ), true );
4848 musicVolumeControl .setDisplayName ("Music Volume" );
4949 controls .add (musicVolumeControl );
5050
51- soundVolumeControl = new SolUiControl (menuLayout .buttonRect (-1 , - 1 ), true );
51+ soundVolumeControl = new SolUiControl (menuLayout .buttonRect (-1 , rowNo ++ ), true );
5252 soundVolumeControl .setDisplayName ("Sound Volume" );
5353 controls .add (soundVolumeControl );
5454
55- resolutionControl = new SolUiControl (menuLayout .buttonRect (-1 , 0 ), true );
55+ // Mobile platforms always run in fullscreen, so the resolution cannot be changed
56+ resolutionControl = new SolUiControl (mobile ? null : menuLayout .buttonRect (-1 , rowNo ++), true );
5657 resolutionControl .setDisplayName ("Resolution" );
5758 controls .add (resolutionControl );
5859
59- mapScrollSpeedControl = new SolUiControl (menuLayout .buttonRect (-1 , 1 ), true );
60+ mapScrollSpeedControl = new SolUiControl (menuLayout .buttonRect (-1 , rowNo ++ ), true );
6061 mapScrollSpeedControl .setDisplayName ("Map Pan Speed" );
6162 controls .add (mapScrollSpeedControl );
6263
63- inputTypeControl = new SolUiControl (menuLayout .buttonRect (-1 , 2 ), true , Input .Keys .C );
64+ // Mobile platforms always use the same input method: touchscreen controls
65+ // TODO: Would portable keyboards be supported
66+ inputTypeControl = new SolUiControl (mobile ? null : menuLayout .buttonRect (-1 , rowNo ++), true , Input .Keys .C );
6467 inputTypeControl .setDisplayName ("Control Type" );
6568 controls .add (inputTypeControl );
6669
67- inputMapControl = new SolUiControl (menuLayout .buttonRect (-1 , 3 ), true , Input .Keys .M );
70+ // The controls are not currently re-mappable on mobile platforms
71+ inputMapControl = new SolUiControl (mobile ? null : menuLayout .buttonRect (-1 , rowNo ++), true , Input .Keys .M );
6872 inputMapControl .setDisplayName ("Controls" );
6973 controls .add (inputMapControl );
7074
71- backControl = new SolUiControl (menuLayout .buttonRect (-1 , 4 ), true , gameOptions .getKeyEscape ());
75+ // Insert a space between the options and the back button
76+ rowNo ++;
77+ backControl = new SolUiControl (menuLayout .buttonRect (-1 , rowNo ++), true , gameOptions .getKeyEscape ());
7278 backControl .setDisplayName ("Back" );
7379 controls .add (backControl );
7480
@@ -132,4 +138,4 @@ public void drawBackground(UiDrawer uiDrawer, SolApplication solApplication) {
132138 uiDrawer .draw (backgroundTexture , displayDimensions .getRatio (), 1 , displayDimensions .getRatio () / 2 , 0.5f , displayDimensions .getRatio () / 2 , 0.5f , 0 , SolColor .WHITE );
133139 solApplication .getMenuBackgroundManager ().draw (uiDrawer );
134140 }
135- }
141+ }
0 commit comments