Skip to content

Commit 6548fd0

Browse files
committed
prepare for v.0.8.0
1 parent b0ad456 commit 6548fd0

File tree

5 files changed

+225
-16
lines changed

5 files changed

+225
-16
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
66

7+
## [0.8.0]
8+
### Added
9+
- Added a Tester Bot that plays the game randomly
10+
- Spine atlas in animations
11+
12+
### Fixed
13+
- COMPOSER: Dialog editing fix
14+
715
## [0.7.2]
816
### Added
917
- libgdx v1.5.6 update
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
package com.bladecoder.engineeditor.utils;
2+
3+
import java.io.IOException;
4+
import java.io.InputStream;
5+
import java.nio.IntBuffer;
6+
import java.util.Properties;
7+
8+
import com.bladecoder.engine.BladeEngine;
9+
import com.bladecoder.engine.assets.EngineAssetManager;
10+
import com.bladecoder.engine.util.Config;
11+
12+
import org.lwjgl.BufferUtils;
13+
import org.lwjgl.LWJGLException;
14+
import org.lwjgl.input.Cursor;
15+
import org.lwjgl.input.Mouse;
16+
17+
import com.badlogic.gdx.Files.FileType;
18+
import com.badlogic.gdx.Gdx;
19+
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
20+
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
21+
22+
public class DesktopLauncher extends BladeEngine {
23+
24+
private boolean fullscreen = true;
25+
private LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
26+
27+
DesktopLauncher() {
28+
Properties p = new Properties();
29+
30+
try {
31+
InputStream s = DesktopLauncher.class.getResourceAsStream(Config.PROPERTIES_FILENAME);
32+
if(s!=null)
33+
p.load(s);
34+
} catch (IOException e) {
35+
}
36+
37+
cfg.title = p.getProperty(Config.TITLE_PROP, "Blade Engine Adventure");
38+
// cfg.useGL30 = true;
39+
40+
// cfg.width = World.getInstance().getWidth();
41+
// cfg.height = World.getInstance().getHeight();
42+
43+
cfg.width = 1920 / 2;
44+
cfg.height = 1080 / 2;
45+
46+
cfg.resizable = true;
47+
//cfg.samples = 2;
48+
cfg.vSyncEnabled = true;
49+
}
50+
51+
public void run() {
52+
if(DesktopLauncher.class.getResource("/icons/icon128.png")!=null)
53+
cfg.addIcon("icons/icon128.png", FileType.Internal);
54+
55+
if(DesktopLauncher.class.getResource("/icons/icon32.png")!=null)
56+
cfg.addIcon("icons/icon32.png", FileType.Internal);
57+
58+
if(DesktopLauncher.class.getResource("/icons/icon16.png")!=null)
59+
cfg.addIcon("icons/icon16.png", FileType.Internal);
60+
61+
new LwjglApplication(this, cfg);
62+
}
63+
64+
public void parseParams(String[] args) {
65+
for (int i = 0; i < args.length; i++) {
66+
String s = args[i];
67+
if (s.equals("-t")) {
68+
if (i + 1 < args.length) {
69+
i++;
70+
setTestMode(args[i]);
71+
}
72+
} else if (s.equals("-p")) {
73+
if (i + 1 < args.length) {
74+
i++;
75+
setPlayMode(args[i]);
76+
}
77+
} else if (s.equals("-chapter")) {
78+
if (i + 1 < args.length) {
79+
i++;
80+
setChapter(args[i]);
81+
}
82+
} else if (s.equals("-f")) {
83+
fullscreen = true;
84+
85+
//cfg.fullscreen = true;
86+
} else if (s.equals("-d")) {
87+
setDebugMode();
88+
} else if (s.equals("-r")) {
89+
setRestart();
90+
} else if (s.equals("-res")) {
91+
if (i + 1 < args.length) {
92+
i++;
93+
forceResolution(args[i]);
94+
}
95+
} else if (s.equals("-adv-dir")) {
96+
if (i + 1 < args.length) {
97+
i++;
98+
EngineAssetManager.createEditInstance(args[i], 1920, 1080);
99+
}
100+
} else if (s.equals("-w")) {
101+
fullscreen = false;
102+
} else if (s.equals("-l")) {
103+
if (i + 1 < args.length) {
104+
i++;
105+
loadGameState(args[i]);
106+
}
107+
} else if (s.equals("-h")) {
108+
usage();
109+
} else {
110+
if(i == 0 && !s.startsWith("-")) continue; // When embeded JRE the 0 parameter is the app name
111+
System.out.println("Unrecognized parameter: " + s);
112+
usage();
113+
}
114+
}
115+
}
116+
117+
118+
public void usage() {
119+
System.out.println(
120+
"Usage:\n" +
121+
"-chapter chapter\tLoads the selected chapter\n" +
122+
"-t scene_name\tStart test mode for the scene\n" +
123+
"-p record_name\tPlay previusly recorded games\n" +
124+
"-f\tSet fullscreen mode\n" +
125+
"-w\tSet windowed mode\n" +
126+
"-d\tShow debug messages\n" +
127+
"-res width\tForce the resolution width\n" +
128+
"-l game_state\tLoad the previusly saved game state\n" +
129+
"-adv-dir game_folder\tSets the game folder\n" +
130+
"-r\tRun the game from the begining\n"
131+
);
132+
133+
System.exit(0);
134+
}
135+
136+
@Override
137+
public void create() {
138+
// Gdx.input.setCursorCatched(false);
139+
if (fullscreen)
140+
Gdx.graphics.setDisplayMode(Gdx.graphics.getDesktopDisplayMode());
141+
142+
hideCursor();
143+
144+
super.create();
145+
}
146+
147+
private void hideCursor() {
148+
Cursor emptyCursor;
149+
150+
int min = org.lwjgl.input.Cursor.getMinCursorSize();
151+
IntBuffer tmp = BufferUtils.createIntBuffer(min * min);
152+
try {
153+
emptyCursor = new org.lwjgl.input.Cursor(min, min, min / 2,
154+
min / 2, 1, tmp, null);
155+
156+
Mouse.setNativeCursor(emptyCursor);
157+
} catch (LWJGLException e) {
158+
e.printStackTrace();
159+
}
160+
161+
}
162+
163+
public static void main(String[] args) {
164+
DesktopLauncher game = new DesktopLauncher();
165+
game.parseParams(args);
166+
game.run();
167+
}
168+
}

adventure-composer/src/main/java/com/bladecoder/engineeditor/utils/RunProccess.java

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ private static String getClasspath(List<String> classpathEntries) {
4545
return builder.toString();
4646
}
4747

48-
public static boolean runBladeEngine(File prjFolder, String chapter, String scene) throws IOException {
48+
public static boolean runBladeEngine(File prjFolder, String chapter,
49+
String scene) throws IOException {
4950
String args = ":desktop:run -PappArgs=['-w'";
5051

5152
if (chapter != null) {
@@ -61,16 +62,44 @@ public static boolean runBladeEngine(File prjFolder, String chapter, String scen
6162
return runGradle(prjFolder, args);
6263
}
6364

64-
public static void runAnt(String buildFile, String target, String distDir, String projectDir, Properties props)
65+
public static boolean runBladeEngineInternal(File prjFolder, String chapter,
66+
String scene)
6567
throws IOException {
68+
List<String> args = new ArrayList<String>();
69+
args.add("-w");
70+
args.add("-adv-dir");
71+
args.add(prjFolder.getAbsolutePath());
72+
73+
if(scene != null) {
74+
args.add("-t");
75+
args.add(scene);
76+
}
77+
78+
if (chapter != null) {
79+
args.add("-chapter");
80+
args.add(chapter);
81+
}
82+
83+
List<String> cp = new ArrayList<String>();
84+
cp.add(System.getProperty("java.class.path"));
85+
86+
runJavaProccess("com.bladecoder.engineeditor.utils.DesktopLauncher", cp, args);
87+
88+
return true;
89+
}
90+
91+
public static void runAnt(String buildFile, String target, String distDir,
92+
String projectDir, Properties props) throws IOException {
6693
String packageFilesDir = "package-files/";
6794

6895
if (!new File(packageFilesDir).exists()) {
69-
EditorLogger.error("package-files folder not found. Searching folder for IDE mode.");
96+
EditorLogger
97+
.error("package-files folder not found. Searching folder for IDE mode.");
7098

7199
packageFilesDir = "src/dist/package-files/";
72100
if (!new File(packageFilesDir).exists()) {
73-
EditorLogger.error(new File(packageFilesDir).getAbsolutePath() + " folder not found in IDE mode.");
101+
EditorLogger.error(new File(packageFilesDir).getAbsolutePath()
102+
+ " folder not found in IDE mode.");
74103
return;
75104
}
76105
}
@@ -110,7 +139,8 @@ public static void runAnt(String buildFile, String target, String distDir, Strin
110139
}
111140
}
112141

113-
public static Process runJavaProccess(String mainClass, List<String> classpathEntries, List<String> args)
142+
public static Process runJavaProccess(String mainClass,
143+
List<String> classpathEntries, List<String> args)
114144
throws IOException {
115145
String javaRT = System.getProperty("java.home") + "/bin/java";
116146
String workingDirectory = ".";
@@ -128,7 +158,8 @@ public static Process runJavaProccess(String mainClass, List<String> classpathEn
128158
if (args != null)
129159
argumentsList.addAll(args);
130160

131-
ProcessBuilder processBuilder = new ProcessBuilder(argumentsList.toArray(new String[argumentsList.size()]));
161+
ProcessBuilder processBuilder = new ProcessBuilder(
162+
argumentsList.toArray(new String[argumentsList.size()]));
132163
// processBuilder.redirectErrorStream(true);
133164
processBuilder.directory(new File(workingDirectory));
134165
processBuilder.inheritIO();
@@ -137,26 +168,28 @@ public static Process runJavaProccess(String mainClass, List<String> classpathEn
137168
}
138169

139170
public static boolean runGradle(File workingDir, String parameters) {
140-
String exec = workingDir.getAbsolutePath() + "/"
141-
+ (System.getProperty("os.name").contains("Windows") ? "gradlew.bat" : "gradlew");
171+
String exec = workingDir.getAbsolutePath()
172+
+ "/"
173+
+ (System.getProperty("os.name").contains("Windows") ? "gradlew.bat"
174+
: "gradlew");
142175
String command = "gradlew" + " " + parameters;
143176
String[] split = command.split(" ");
144177
split[0] = exec;
145178

146179
EditorLogger.debug("Executing '" + command + "'");
147180

148181
try {
149-
final ProcessBuilder pb = new ProcessBuilder(split).directory(workingDir).redirectErrorStream(
150-
true);
151-
;
182+
final ProcessBuilder pb = new ProcessBuilder(split).directory(
183+
workingDir).redirectErrorStream(true);
152184

153185
// TODO: READ OUTPUT FROM pb AND print in output stream
154-
// if (System.console() != null)
155-
// pb.inheritIO();
186+
// if (System.console() != null)
187+
// pb.inheritIO();
156188

157189
final Process process = pb.start();
158190

159-
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
191+
BufferedReader in = new BufferedReader(new InputStreamReader(
192+
process.getInputStream()));
160193
String line;
161194
while ((line = in.readLine()) != null) {
162195
EditorLogger.debug(line);

adventure-composer/src/main/resources/versions.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=0.7.2
1+
version=0.8.0
22
libgdxVersion=1.6.0
33
roboVMVersion=1.2.0
44
roboVMGradlePluginVersion=1.2.0

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ allprojects {
22
apply plugin: "eclipse"
33
apply plugin: "idea"
44

5-
version = '0.7.2'
5+
version = '0.8.0'
66

77
ext {
88
gdxVersion = '1.6.0'

0 commit comments

Comments
 (0)