Fixed some issues
This commit is contained in:
parent
8ba4bb9233
commit
75d65dbaf7
@ -20,7 +20,8 @@
|
||||
package com.openeggbert.entity.common;
|
||||
|
||||
import com.openeggbert.utils.OpenEggbertUtils;
|
||||
import java.util.Properties;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
@ -30,7 +31,7 @@ import lombok.ToString;
|
||||
@ToString
|
||||
public class ConfigDef {
|
||||
|
||||
private Properties properties = new Properties();
|
||||
private Map<String,String> map = new HashMap<>();
|
||||
|
||||
public ConfigDef(String textContentofConfigDefFile) {
|
||||
OpenEggbertUtils
|
||||
@ -42,7 +43,7 @@ public class ConfigDef {
|
||||
String[] array = line.split("=");
|
||||
String key = array[0];
|
||||
String value = array[1];
|
||||
properties.put(key, value);
|
||||
map.put(key, value);
|
||||
});
|
||||
}
|
||||
private static final String HASH_CHARACTER = "#";
|
||||
@ -59,15 +60,15 @@ public class ConfigDef {
|
||||
}
|
||||
private boolean getMandatoryBooleanProperty(ConfigDefKey configDefKey) {
|
||||
String key = configDefKey.getKey();
|
||||
if (!properties.containsKey(key)) {
|
||||
if (!map.containsKey(key)) {
|
||||
throw new OpenEggbertException("Fatal error: CONFIG.DEF is missing key: " + key);
|
||||
}
|
||||
return convertStringToBoolean(properties.getProperty(configDefKey.getKey()));
|
||||
return convertStringToBoolean(map.get(configDefKey.getKey()));
|
||||
}
|
||||
|
||||
private boolean getOptionalBooleanProperty(ConfigDefKey configDefKey, boolean defaultValue) {
|
||||
String key = configDefKey.getKey();
|
||||
if (!properties.containsKey(key)) {
|
||||
if (!map.containsKey(key)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return getMandatoryBooleanProperty(configDefKey);
|
||||
|
@ -28,9 +28,9 @@ import lombok.Getter;
|
||||
* @author robertvokac
|
||||
*/
|
||||
public enum OpenEggbertScreenType {
|
||||
INIT("INIT.BLP"),
|
||||
INIT("INIT.BMP"),
|
||||
GAMER("GAMER.BLP"),
|
||||
DEMO("DECOR016.BLP");
|
||||
DEMO("DECOR016.BMP");
|
||||
@Getter
|
||||
private String fileName;
|
||||
OpenEggbertScreenType(String fileName) {
|
||||
|
@ -21,7 +21,6 @@ package com.openeggbert.main;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Graphics;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Camera;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.openeggbert.screens;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import static com.badlogic.gdx.Application.LOG_INFO;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
@ -46,6 +47,7 @@ public abstract class AbstractOpenEggbertScreen extends ScreenAdapter {
|
||||
}
|
||||
|
||||
private final String getBackgroundFileName() {
|
||||
//return "INIT.BLP.BMP";
|
||||
return getScreenType().isPresent() ? getScreenType().get().getFileName() : "";
|
||||
}
|
||||
|
||||
@ -64,35 +66,40 @@ public abstract class AbstractOpenEggbertScreen extends ScreenAdapter {
|
||||
if (getBackgroundFileName().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String fileName = getBackgroundFileName();
|
||||
if (!game.existsImageTexture(fileName)) {
|
||||
String nameUpperCase = game.getGameSpace().getImage08Directory() + "/" + fileName;
|
||||
String nameLowerCase = game.getGameSpace().getImage08Directory() + "/" + fileName.toLowerCase();
|
||||
System.out.println("nameUpperCase=" + nameUpperCase);
|
||||
System.out.println("nameLowerCase=" + nameLowerCase);
|
||||
Gdx.app.setLogLevel(LOG_INFO);
|
||||
Gdx.app.log("screen","nameUpperCase=" + nameUpperCase);
|
||||
Gdx.app.log("screen","nameLowerCase=" + nameLowerCase);
|
||||
FileHandle fileHandleUpperCase = null;
|
||||
FileHandle fileHandleLowerCase = null;
|
||||
if (game.getGameSpace().isEmbeddedAssets()) {
|
||||
|
||||
if (Gdx.app.getType() == Application.ApplicationType.Android || Gdx.app.getType() == Application.ApplicationType.WebGL) {
|
||||
System.out.println("loading from internal");
|
||||
Gdx.app.log("screen","loading from internal");
|
||||
fileHandleUpperCase = Gdx.files.internal(nameUpperCase);
|
||||
fileHandleLowerCase = Gdx.files.internal(nameLowerCase);
|
||||
} else {
|
||||
|
||||
System.out.println("loading from classpath");
|
||||
Gdx.app.log("screen","loading from classpath");
|
||||
fileHandleUpperCase = Gdx.files.classpath(nameUpperCase);
|
||||
fileHandleLowerCase = Gdx.files.classpath(nameLowerCase);
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
System.out.println("loading from absolute");
|
||||
Gdx.app.log("screen","loading from absolute");
|
||||
|
||||
fileHandleUpperCase = Gdx.files.absolute(nameUpperCase);
|
||||
fileHandleLowerCase = Gdx.files.absolute(nameLowerCase);
|
||||
}
|
||||
|
||||
Gdx.app.log("screen", "fileHandleUpperCase.exists()=" + fileHandleUpperCase.exists());
|
||||
Gdx.app.log("screen", "fileHandleLowerCase.exists()=" + fileHandleLowerCase.exists());
|
||||
|
||||
if (fileHandleUpperCase.exists()) {
|
||||
game.loadImageTexture(fileHandleUpperCase);
|
||||
} else {
|
||||
|
@ -13,10 +13,10 @@ public class GwtLauncher extends GwtApplication {
|
||||
GwtApplicationConfiguration cfg = new GwtApplicationConfiguration(true);
|
||||
cfg.padVertical = 0;
|
||||
cfg.padHorizontal = 0;
|
||||
return cfg;
|
||||
//return cfg;
|
||||
// If you want a fixed size application, comment out the above resizable section,
|
||||
// and uncomment below:
|
||||
//return new GwtApplicationConfiguration(640, 480);
|
||||
return new GwtApplicationConfiguration(640, 480);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user