Skip to content

Commit b64bb1b

Browse files
committed
Add -s parameter to DestkopLauncher.
1 parent 739eec9 commit b64bb1b

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

adventure-editor/src/main/resources/projectTmpl/desktop/src/DesktopLauncher

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import java.util.Properties;
77

88
import com.bladecoder.engine.BladeEngine;
99
import com.bladecoder.engine.util.Config;
10+
import com.bladecoder.engine.ui.UI.Screens;
11+
import com.bladecoder.engine.ui.defaults.DefaultSceneScreen;
1012
import org.lwjgl.BufferUtils;
1113
import org.lwjgl.LWJGLException;
1214
import org.lwjgl.input.Cursor;
@@ -21,6 +23,8 @@ public class DesktopLauncher extends BladeEngine {
2123

2224
private boolean fullscreen = true;
2325
private LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
26+
27+
private float speed = 1.0f;
2428

2529
DesktopLauncher() {
2630
Properties p = new Properties();
@@ -70,6 +74,11 @@ public class DesktopLauncher extends BladeEngine {
7074
i++;
7175
setPlayMode(args[i]);
7276
}
77+
} else if (s.equals("-s")) {
78+
if (i + 1 < args.length) {
79+
i++;
80+
speed = Float.parseFloat(args[i]);
81+
}
7382
} else if (s.equals("-chapter")) {
7483
if (i + 1 < args.length) {
7584
i++;
@@ -116,23 +125,21 @@ public class DesktopLauncher extends BladeEngine {
116125
}
117126
}
118127
}
119-
120128

121129
public void usage() {
122-
System.out.println(
123-
"Usage:\n" +
124-
"-chapter chapter\tLoads the selected chapter\n" +
125-
"-t scene_name\tStart test mode for the scene\n" +
126-
"-p record_name\tPlay previusly recorded games\n" +
127-
"-f\tSet fullscreen mode\n" +
128-
"-w\tSet windowed mode\n" +
129-
"-d\tShow debug messages\n" +
130-
"-res width\tForce the resolution width\n" +
131-
"-l game_state\tLoad the previusly saved game state\n" +
132-
"-r\tRun the game from the begining\n" +
133-
"-aspect aspect_ratio\tSets the specified screen aspect (16:9, 4:3, 16:10)\n"
134-
);
135-
130+
System.out.println("Usage:\n"
131+
+ "-chapter chapter\tLoads the selected chapter\n"
132+
+ "-t scene_name\tStart test mode for the scene\n"
133+
+ "-p record_name\tPlay previusly recorded games\n"
134+
+ "-f\tSet fullscreen mode\n"
135+
+ "-w\tSet windowed mode\n"
136+
+ "-d\tShow debug messages\n"
137+
+ "-res width\tForce the resolution width\n"
138+
+ "-l game_state\tLoad the previusly saved game state\n"
139+
+ "-r\tRun the game from the begining\n"
140+
+ "-s speed\tSets the game speed\n"
141+
+ "-aspect aspect_ratio\tSets the specified screen aspect (16:9, 4:3, 16:10)\n");
142+
136143
System.exit(0);
137144
}
138145

@@ -145,6 +152,9 @@ public class DesktopLauncher extends BladeEngine {
145152
hideCursor();
146153

147154
super.create();
155+
156+
if(getUI().getScreen(Screens.SCENE_SCREEN) instanceof DefaultSceneScreen)
157+
((DefaultSceneScreen) getUI().getScreen(Screens.SCENE_SCREEN)).setSpeed(speed);
148158
}
149159

150160
private void hideCursor() {

0 commit comments

Comments
 (0)