Many changes
This commit is contained in:
parent
65d6bdcdc9
commit
d224787c99
3
android/proguard-rules.pro
vendored
3
android/proguard-rules.pro
vendored
@ -49,3 +49,6 @@
|
||||
# These two lines are used with mapping files; see https://developer.android.com/build/shrink-code#retracing
|
||||
-keepattributes LineNumberTable,SourceFile
|
||||
-renamesourcefileattribute SourceFile
|
||||
|
||||
#Lombok
|
||||
-dontwarn lombok.Generated
|
||||
|
@ -4,7 +4,7 @@ import android.os.Bundle;
|
||||
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||
import com.openeggbert.OpenEggbertMainClass;
|
||||
import com.openeggbert.main.OpenEggbertGame;
|
||||
|
||||
/** Launches the Android application. */
|
||||
public class AndroidLauncher extends AndroidApplication {
|
||||
@ -13,6 +13,6 @@ public class AndroidLauncher extends AndroidApplication {
|
||||
super.onCreate(savedInstanceState);
|
||||
AndroidApplicationConfiguration configuration = new AndroidApplicationConfiguration();
|
||||
configuration.useImmersiveMode = true; // Recommended, but not required.
|
||||
initialize(new OpenEggbertMainClass(), configuration);
|
||||
initialize(new OpenEggbertGame(), configuration);
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
Subproject commit 1263d7036ff848afd546b644c91dd80ca9f94b59
|
@ -1,96 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.utils.ScreenUtils;
|
||||
import com.openeggbert.entity.common.GameSpace;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* {@link com.badlogic.gdx.ApplicationListener} implementation shared by all
|
||||
* platforms.
|
||||
*/
|
||||
public class OpenEggbertMainClass extends ApplicationAdapter {
|
||||
|
||||
private SpriteBatch batch;
|
||||
private Texture image;
|
||||
private GameSpace gameSpace = null;
|
||||
private String currentDirectory;
|
||||
|
||||
public OpenEggbertMainClass() {
|
||||
|
||||
}
|
||||
|
||||
public OpenEggbertMainClass(GameSpace gameSpace, String currentDirectory) {
|
||||
this.gameSpace = gameSpace;
|
||||
this.currentDirectory = currentDirectory;
|
||||
}
|
||||
|
||||
public OpenEggbertMainClass(String currentDirectory) {
|
||||
this.gameSpace = null;
|
||||
this.currentDirectory = currentDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
batch = new SpriteBatch();
|
||||
image = new Texture("libgdx.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
ScreenUtils.clear(0.15f, 0.15f, 0.2f, 1f);
|
||||
batch.begin();
|
||||
Function<String, String> removeCurrentDir = i -> i == null ? null : i.replace(currentDirectory + "/", "");
|
||||
if (Gdx.app.getType() == Application.ApplicationType.Desktop && gameSpace != null) {
|
||||
BitmapFont font;
|
||||
font = new BitmapFont();
|
||||
int x = 140;
|
||||
font.draw(batch, "getFeatureLevel=" + gameSpace.getFeatureLevel(), 40, x);x+=25;
|
||||
font.draw(batch, "getDataDirectory=" + removeCurrentDir.apply(gameSpace.getDataDirectory()), 40, x);x+=25;
|
||||
font.draw(batch, "getImage08Directory=" + removeCurrentDir.apply(gameSpace.getImage08Directory()), 40, x);x+=25;
|
||||
font.draw(batch, "getImage16Directory=" + removeCurrentDir.apply(gameSpace.getImage16Directory()), 40, x);x+=25;
|
||||
font.draw(batch, "getImage24Directory=" + removeCurrentDir.apply(gameSpace.getImage24Directory()), 40, x);x+=25;
|
||||
font.draw(batch, "getImage24x2Directory=" + removeCurrentDir.apply(gameSpace.getImage24x2Directory()), 40, x);x+=25;
|
||||
font.draw(batch, "getSoundDirectory=" + removeCurrentDir.apply(gameSpace.getSoundDirectory()), 40, x);x+=25;
|
||||
}
|
||||
|
||||
if (currentDirectory != null) {
|
||||
BitmapFont font;
|
||||
font = new BitmapFont();
|
||||
font.draw(batch, currentDirectory, 40, 340);
|
||||
}
|
||||
//batch.draw(image, 140, 210);
|
||||
batch.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
batch.dispose();
|
||||
image.dispose();
|
||||
}
|
||||
}
|
@ -29,5 +29,5 @@ public enum ResolutionMode {
|
||||
RESOLUTION_640_480,
|
||||
RESOLUTION_1280_960,
|
||||
RESOLUTION_SCALED,
|
||||
RESOLUTION_KEEP;
|
||||
RESOLUTION_CURRENT;
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
package com.openeggbert.entity.common;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public enum OpenEggbertScreenType {
|
||||
INIT("INIT.BLP");
|
||||
@Getter
|
||||
private String fileName;
|
||||
OpenEggbertScreenType(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
}
|
159
core/src/main/java/com/openeggbert/main/OpenEggbertGame.java
Normal file
159
core/src/main/java/com/openeggbert/main/OpenEggbertGame.java
Normal file
@ -0,0 +1,159 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert.main;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.openeggbert.entity.common.GameSpace;
|
||||
import com.openeggbert.mods.Mod;
|
||||
import com.openeggbert.screens.GameSpaceListScreen;
|
||||
import com.openeggbert.screens.InitScreen;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* {@link com.badlogic.gdx.ApplicationListener} implementation shared by all
|
||||
* platforms.
|
||||
*/
|
||||
@Data
|
||||
public class OpenEggbertGame extends Game {
|
||||
|
||||
private Texture image;
|
||||
private GameSpace gameSpace = null;
|
||||
private String currentDirectory;
|
||||
|
||||
private SpriteBatch batch;
|
||||
private ShapeRenderer shapeRenderer;
|
||||
private BitmapFont font;
|
||||
private ObjectMap<String, Texture> imageTextures = new ObjectMap<>();
|
||||
private List<Mod> embeddedMods = new ArrayList<>();
|
||||
private int heightInPixels = 480;
|
||||
private int widthInPixels = 640;
|
||||
|
||||
public OpenEggbertGame() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
public OpenEggbertGame(String currentDirectory) {
|
||||
this(null, currentDirectory);
|
||||
}
|
||||
|
||||
public OpenEggbertGame(GameSpace gameSpace, String currentDirectory) {
|
||||
this.gameSpace = gameSpace;
|
||||
this.currentDirectory = currentDirectory;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
System.out.println("Searching mods");
|
||||
|
||||
FileHandle embeddedModsDirectory = Gdx.files.internal("embedded_mods");
|
||||
System.out.println("embeddedModsDirectory.list().length=" + embeddedModsDirectory.list().length);
|
||||
for (FileHandle embeddedModGroup : embeddedModsDirectory.list()) {
|
||||
if (!embeddedModGroup.isDirectory()) {
|
||||
System.out.println("embedded_mods directory is missing");
|
||||
continue;
|
||||
}
|
||||
System.out.println("Found group " + embeddedModGroup.name());
|
||||
for (FileHandle embeddedMod : embeddedModGroup.list()) {
|
||||
System.out.println("Found mod " + embeddedMod.name());
|
||||
|
||||
FileHandle modXml = null;
|
||||
for(FileHandle file: embeddedMod.list()) {
|
||||
if(file.name().equals("mod.xml")) {
|
||||
modXml = file;
|
||||
}
|
||||
}
|
||||
|
||||
if (modXml == null) {
|
||||
continue;
|
||||
}
|
||||
System.out.println("Found mod: " + embeddedMod.name());
|
||||
Mod mod = new Mod(modXml.readString());
|
||||
embeddedMods.add(mod);
|
||||
System.out.println("embeddedMods.size(): " + embeddedMods.size());
|
||||
for (int i = 0; i < 42; i++) {
|
||||
embeddedMods.add(mod);//for testing purposes
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
////
|
||||
batch = new SpriteBatch();
|
||||
image = new Texture("libgdx.png");
|
||||
shapeRenderer = new ShapeRenderer();
|
||||
font = new BitmapFont();
|
||||
setScreen(gameSpace == null ? new GameSpaceListScreen(this) : new InitScreen(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
batch.dispose();
|
||||
image.dispose();
|
||||
|
||||
shapeRenderer.dispose();
|
||||
font.dispose();
|
||||
for (String key : imageTextures.keys()) {
|
||||
imageTextures.get(key).dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadImageTexture(FileHandle fileHandle) {
|
||||
Texture texture = new Texture(fileHandle);
|
||||
imageTextures.put(fileHandle.name().toUpperCase(), texture);
|
||||
}
|
||||
|
||||
public boolean existsImageTexture(String key) {
|
||||
return imageTextures.containsKey(key);
|
||||
}
|
||||
|
||||
public void disposeImageTexture(String key) {
|
||||
if (imageTextures.containsKey(key)) {
|
||||
imageTextures.get(key).dispose();
|
||||
imageTextures.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public void disposeImageTextures() {
|
||||
for (String key : imageTextures.keys()) {
|
||||
imageTextures.get(key).dispose();
|
||||
imageTextures.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public Optional<Texture> getImageTexture(String key) {
|
||||
if (imageTextures.containsKey(key)) {
|
||||
return Optional.of(imageTextures.get(key));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
85
core/src/main/java/com/openeggbert/mods/Mod.java
Normal file
85
core/src/main/java/com/openeggbert/mods/Mod.java
Normal file
@ -0,0 +1,85 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert.mods;
|
||||
|
||||
import com.badlogic.gdx.utils.XmlReader;
|
||||
import com.badlogic.gdx.utils.XmlReader.Element;
|
||||
import com.openeggbert.compatibility.FeatureLevel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
@Data
|
||||
public class Mod {
|
||||
|
||||
public Mod(String xml) {
|
||||
Element root = new XmlReader().parse(xml);
|
||||
Element parentElement = root.getChildByName("parent");
|
||||
if (parentElement != null) {
|
||||
parent = new ModIdentification(parentElement);
|
||||
}
|
||||
identification = new ModIdentification(
|
||||
root.get("groupId"),
|
||||
root.get("modId"),
|
||||
root.get("version"));
|
||||
modPackaging = ModPackaging.valueOf(root.get("packaging"));
|
||||
modType = ModType.valueOf(root.get("type"));
|
||||
featureLevel = FeatureLevel.valueOf(root.get("featureLevel"));
|
||||
name = root.get("name");
|
||||
description = root.get("description");
|
||||
Element imports = root.getChildByName("imports");
|
||||
if (imports != null) {
|
||||
for (int i = 0; i < imports.getChildCount(); i++) {
|
||||
Element import_ = imports.getChild(i);
|
||||
importedMods.add(new ModIdentification(import_));
|
||||
}
|
||||
}
|
||||
Element files_ = root.getChildByName("files");
|
||||
if (files_ != null) {
|
||||
for (int i = 0; i < files_.getChildCount(); i++) {
|
||||
Element file = files_.getChild(i);
|
||||
files.add(file.getText());
|
||||
}
|
||||
}
|
||||
|
||||
Element stores_ = root.getChildByName("stores");
|
||||
if (stores_ != null) {
|
||||
for (int i = 0; i < stores_.getChildCount(); i++) {
|
||||
Element store = stores_.getChild(i);
|
||||
stores.add(new Store(store));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private ModIdentification parent;
|
||||
private ModIdentification identification;
|
||||
private ModPackaging modPackaging;
|
||||
private ModType modType;
|
||||
private FeatureLevel featureLevel;
|
||||
private String name;
|
||||
private String description;
|
||||
private List<ModIdentification> importedMods = new ArrayList<>();
|
||||
private List<String> files = new ArrayList<>();
|
||||
private List<Store> stores = new ArrayList<>();
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert.mods;
|
||||
|
||||
import com.badlogic.gdx.utils.XmlReader.Element;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ModIdentification {
|
||||
|
||||
private final String groupId;
|
||||
private final String modId;
|
||||
private final String version;
|
||||
|
||||
public ModIdentification(Element element) {
|
||||
groupId = element.get("groupId");
|
||||
modId = element.get("modId");
|
||||
version = element.get("version");
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
|
||||
return groupId + DOT + modId + DOT + version;
|
||||
}
|
||||
private static final String DOT = ".";
|
||||
|
||||
}
|
@ -18,14 +18,12 @@
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
package com.openeggbert.entity.common;
|
||||
package com.openeggbert.mods;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public enum OpenEggbertScreen {
|
||||
MAIN
|
||||
|
||||
public enum ModPackaging {
|
||||
EGM, XML;
|
||||
}
|
29
core/src/main/java/com/openeggbert/mods/ModType.java
Normal file
29
core/src/main/java/com/openeggbert/mods/ModType.java
Normal file
@ -0,0 +1,29 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.openeggbert.mods;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public enum ModType {
|
||||
FULL, LEVEL, SOUND, MUSIC, IMAGE08, IMAGE16, IMAGE24,IMAGE24X2, PARTIAL;
|
||||
}
|
40
core/src/main/java/com/openeggbert/mods/Store.java
Normal file
40
core/src/main/java/com/openeggbert/mods/Store.java
Normal file
@ -0,0 +1,40 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert.mods;
|
||||
|
||||
import com.badlogic.gdx.utils.XmlReader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public class Store {
|
||||
|
||||
String id;
|
||||
String name;
|
||||
String url;
|
||||
|
||||
Store(XmlReader.Element store) {
|
||||
id = store.get("id");
|
||||
name = store.get("name");
|
||||
url = store.get("url");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert.screens;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.openeggbert.entity.common.OpenEggbertException;
|
||||
import com.openeggbert.entity.common.OpenEggbertScreenType;
|
||||
import com.openeggbert.main.OpenEggbertGame;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public abstract class AbstractOpenEggbertScreen extends ScreenAdapter {
|
||||
|
||||
protected OpenEggbertGame game;
|
||||
protected SpriteBatch batch;
|
||||
|
||||
public AbstractOpenEggbertScreen(OpenEggbertGame openEggbertGame) {
|
||||
this.game = openEggbertGame;
|
||||
this.batch = openEggbertGame.getBatch();
|
||||
loadBackgroundTextureIfNeeded();
|
||||
}
|
||||
|
||||
private final String getBackgroundFileName() {
|
||||
return getScreenType().isPresent() ? getScreenType().get().getFileName() : "";
|
||||
}
|
||||
|
||||
protected Optional<OpenEggbertScreenType> getScreenType() {
|
||||
return Optional.empty();
|
||||
}
|
||||
protected Optional<Texture> getBackgroundTexture() {
|
||||
if (getBackgroundFileName().isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return game.getImageTexture(getBackgroundFileName());
|
||||
}
|
||||
|
||||
private void loadBackgroundTextureIfNeeded() {
|
||||
if (getBackgroundFileName().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String fileName = getBackgroundFileName();
|
||||
if (!game.existsImageTexture(fileName)) {
|
||||
FileHandle fileHandleUpperCase = Gdx.files.absolute(game.getGameSpace().getImage08Directory() + "/" + fileName);
|
||||
FileHandle fileHandleLowerCase = Gdx.files.absolute(game.getGameSpace().getImage08Directory() + "/" + fileName.toLowerCase());
|
||||
if (fileHandleUpperCase.exists()) {
|
||||
game.loadImageTexture(fileHandleUpperCase);
|
||||
} else {
|
||||
if (!fileHandleLowerCase.exists()) {
|
||||
throw new OpenEggbertException("Could not load file: " + fileName);
|
||||
}
|
||||
game.loadImageTexture(fileHandleLowerCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert.screens;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.utils.ScreenUtils;
|
||||
import com.openeggbert.main.OpenEggbertGame;
|
||||
import com.openeggbert.mods.Mod;
|
||||
import com.openeggbert.mods.ModType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public class GameSpaceListScreen extends AbstractOpenEggbertScreen {
|
||||
|
||||
private int pageNumber = 1;
|
||||
private final int pageSize = 5;
|
||||
private final List<Mod> fullEmbeddedMods;
|
||||
@ToString
|
||||
class Four {
|
||||
float x,y,width, height;
|
||||
}
|
||||
Four[] fourArray = new Four[5];
|
||||
|
||||
public GameSpaceListScreen(OpenEggbertGame openEggbertGame) {
|
||||
super(openEggbertGame);
|
||||
this.fullEmbeddedMods = openEggbertGame.getEmbeddedMods().stream().filter(m -> m.getModType() == ModType.FULL).collect(Collectors.toList());
|
||||
Gdx.app.log("fullEmbeddedMods: ", String.valueOf(fullEmbeddedMods.size()));
|
||||
Gdx.app.log("openEggbertGame.getEmbeddedMods(): ", String.valueOf(openEggbertGame.getEmbeddedMods().size()));
|
||||
|
||||
if (Gdx.app.getType() == Application.ApplicationType.Android) {
|
||||
game.setHeightInPixels(Gdx.app.getGraphics().getHeight());
|
||||
game.setWidthInPixels(Gdx.app.getGraphics().getWidth());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
Gdx.input.setInputProcessor(new InputAdapter() {
|
||||
@Override
|
||||
public boolean keyDown(int keyCode) {
|
||||
if (keyCode == Input.Keys.SPACE) {
|
||||
game.setScreen(new TestScreen(game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int x, int y, int pointer, int button) {
|
||||
Gdx.app.log("touchDown: ", "x=" + x + " " + "y=" + y);
|
||||
if (x <= game.getWidthInPixels() / 3f && y >= (game.getHeightInPixels() * 0.92f) && pageNumber > 1) {
|
||||
pageNumber--;
|
||||
}
|
||||
if (x >= game.getWidthInPixels() * 2f / 3f && y >= (game.getHeightInPixels() * 0.92f) && (pageNumber * pageSize) < fullEmbeddedMods.size()) {
|
||||
pageNumber++;
|
||||
}
|
||||
for(int i = 0;i<5;i++) {
|
||||
System.out.println(fourArray[i].toString());
|
||||
}
|
||||
for(int i = 0;i<5;i++) {
|
||||
if(
|
||||
x > fourArray[i].x && x < (fourArray[i].x + fourArray[i].width)
|
||||
&&
|
||||
y > fourArray[i].y && y < (fourArray[i].y + fourArray[i].height)
|
||||
) {
|
||||
System.out.println("button " + i);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
ScreenUtils.clear(1f, 1f, 0.6f, 0.5f);
|
||||
batch.begin();
|
||||
|
||||
BitmapFont font;
|
||||
font = new BitmapFont();
|
||||
font.getData().setScale(4.0f);
|
||||
font.setColor(Color.BLACK);
|
||||
int x = (int) (game.getWidthInPixels() * 0.1875f);
|
||||
int y = (int) (game.getHeightInPixels() * 0.9f);
|
||||
font.draw(batch, "Open Eggbert", x, y);
|
||||
List<Mod> modsForPage = fullEmbeddedMods.stream().skip(pageSize * (pageNumber - 1)).limit(5).collect(Collectors.toList());
|
||||
|
||||
y = (int) (game.getHeightInPixels() * 0.75f);
|
||||
font.getData().setScale(2.0f);
|
||||
List<Integer> yS = new ArrayList<>();
|
||||
for (int i = 0; i < modsForPage.size(); i++) {
|
||||
yS.add(y);
|
||||
|
||||
y = y - 60;
|
||||
}
|
||||
|
||||
float margin = 0.0625f * game.getWidthInPixels();
|
||||
batch.end();
|
||||
|
||||
final boolean isLastPage = !(pageNumber * pageSize < fullEmbeddedMods.size());
|
||||
|
||||
int buttonHeight = (int) (game.getHeightInPixels() * 0.1f);
|
||||
final ShapeRenderer shapeRenderer = game.getShapeRenderer();
|
||||
shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
|
||||
shapeRenderer.setColor(1f, 1f, 0.8f, 0.5f);
|
||||
int z = 0;
|
||||
for (int e : yS) {
|
||||
Four four = new Four();
|
||||
four.x = margin;
|
||||
four.y = e-margin;
|
||||
four.width = game.getWidthInPixels() * 0.9f;
|
||||
four.height = buttonHeight;
|
||||
fourArray[z] = four;
|
||||
shapeRenderer.rect(four.x, four.y, four.width, four.height);
|
||||
z++;
|
||||
}
|
||||
if (pageNumber > 1) {
|
||||
shapeRenderer.rect(margin, margin / 4f, game.getWidthInPixels() * 0.3f, buttonHeight);
|
||||
}
|
||||
if (!isLastPage) {
|
||||
shapeRenderer.rect(game.getWidthInPixels() * 0.66f, margin / 4f, game.getWidthInPixels() * 0.3f, buttonHeight);
|
||||
}
|
||||
shapeRenderer.end();
|
||||
batch.begin();
|
||||
font.setColor(0f, 0f, 1f, 1f);
|
||||
|
||||
for (int i = 0; i < modsForPage.size(); i++) {
|
||||
Mod mod = modsForPage.get(i);
|
||||
String name = mod.getName() == null || mod.getName().isEmpty() ? mod.getIdentification().asString() : mod.getName();
|
||||
name = "#" + ((pageNumber - 1) * pageSize + (i + 1)) + " " + name;
|
||||
font.draw(batch, name, 40, yS.get(i));
|
||||
}
|
||||
font.getData().setScale(1.5f);
|
||||
font.setColor(0f, 0f, 1f, 1f);
|
||||
|
||||
float lastRowHeight = game.getHeightInPixels() * 0.08f;
|
||||
if (pageNumber > 1) {
|
||||
font.draw(batch, "Previous page", margin, lastRowHeight);
|
||||
}
|
||||
|
||||
if (!isLastPage) {
|
||||
font.draw(batch, "Next page", game.getWidthInPixels() * 0.765625f, lastRowHeight);
|
||||
}
|
||||
font.setColor(0f, 0f, 0f, 1f);
|
||||
int pageCount = fullEmbeddedMods.size() / 5;
|
||||
if (fullEmbeddedMods.size() > pageCount * pageSize) {
|
||||
pageCount++;
|
||||
}
|
||||
font.draw(batch, "Page " + pageNumber + " from " + pageCount, game.getWidthInPixels() / 2 - 80, lastRowHeight);
|
||||
|
||||
batch.end();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
Gdx.input.setInputProcessor(null);
|
||||
}
|
||||
}
|
73
core/src/main/java/com/openeggbert/screens/InitScreen.java
Normal file
73
core/src/main/java/com/openeggbert/screens/InitScreen.java
Normal file
@ -0,0 +1,73 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert.screens;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.utils.ScreenUtils;
|
||||
import com.openeggbert.entity.common.OpenEggbertScreenType;
|
||||
import com.openeggbert.main.OpenEggbertGame;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public class InitScreen extends AbstractOpenEggbertScreen {
|
||||
|
||||
public InitScreen(OpenEggbertGame openEggbertGame) {
|
||||
super(openEggbertGame);
|
||||
|
||||
}
|
||||
|
||||
protected final Optional<OpenEggbertScreenType> getScreenType() {
|
||||
return Optional.of(OpenEggbertScreenType.INIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
Gdx.input.setInputProcessor(new InputAdapter() {
|
||||
@Override
|
||||
public boolean keyDown(int keyCode) {
|
||||
if (keyCode == Input.Keys.SPACE) {
|
||||
game.setScreen(new GameSpaceListScreen(game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
ScreenUtils.clear(0f, 0f, 0f, 1f);
|
||||
batch.begin();
|
||||
if (getBackgroundTexture().isPresent()) {
|
||||
batch.draw(getBackgroundTexture().get(), 0, 0);
|
||||
}
|
||||
|
||||
batch.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
Gdx.input.setInputProcessor(null);
|
||||
}
|
||||
}
|
90
core/src/main/java/com/openeggbert/screens/TestScreen.java
Normal file
90
core/src/main/java/com/openeggbert/screens/TestScreen.java
Normal file
@ -0,0 +1,90 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||
// Copyright (C) 2024 the original author or authors.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see
|
||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.openeggbert.screens;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.utils.ScreenUtils;
|
||||
import com.openeggbert.main.OpenEggbertGame;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public class TestScreen extends AbstractOpenEggbertScreen {
|
||||
|
||||
public TestScreen(OpenEggbertGame openEggbertGame) {
|
||||
super(openEggbertGame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
Gdx.input.setInputProcessor(new InputAdapter() {
|
||||
@Override
|
||||
public boolean keyDown(int keyCode) {
|
||||
if (keyCode == Input.Keys.SPACE) {
|
||||
game.setScreen(new GameSpaceListScreen(game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
ScreenUtils.clear(0.15f, 0.15f, 0.2f, 1f);
|
||||
game.getBatch().begin();
|
||||
Function<String, String> removeCurrentDir = i -> i == null ? null : i.replace(game.getCurrentDirectory() + "/", "");
|
||||
if (Gdx.app.getType() == Application.ApplicationType.Desktop && game.getGameSpace() != null) {
|
||||
BitmapFont font;
|
||||
font = new BitmapFont();
|
||||
int x = 140;
|
||||
font.draw(game.getBatch(), "getFeatureLevel=" + game.getGameSpace().getFeatureLevel(), 40, x);
|
||||
x += 25;
|
||||
font.draw(game.getBatch(), "getDataDirectory=" + removeCurrentDir.apply(game.getGameSpace().getDataDirectory()), 40, x);
|
||||
x += 25;
|
||||
font.draw(game.getBatch(), "getImage08Directory=" + removeCurrentDir.apply(game.getGameSpace().getImage08Directory()), 40, x);
|
||||
x += 25;
|
||||
font.draw(game.getBatch(), "getImage16Directory=" + removeCurrentDir.apply(game.getGameSpace().getImage16Directory()), 40, x);
|
||||
x += 25;
|
||||
font.draw(game.getBatch(), "getImage24Directory=" + removeCurrentDir.apply(game.getGameSpace().getImage24Directory()), 40, x);
|
||||
x += 25;
|
||||
font.draw(game.getBatch(), "getImage24x2Directory=" + removeCurrentDir.apply(game.getGameSpace().getImage24x2Directory()), 40, x);
|
||||
x += 25;
|
||||
font.draw(game.getBatch(), "getSoundDirectory=" + removeCurrentDir.apply(game.getGameSpace().getSoundDirectory()), 40, x);
|
||||
}
|
||||
|
||||
if (game.getCurrentDirectory() != null) {
|
||||
BitmapFont font;
|
||||
font = new BitmapFont();
|
||||
font.draw(game.getBatch(), game.getCurrentDirectory(), 40, 340);
|
||||
}
|
||||
game.getBatch().end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
Gdx.input.setInputProcessor(null);
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
<inherits name="com.github.czyzby.websocket.GdxWebSocket" />
|
||||
<inherits name="com.github.czyzby.websocket.GdxWebSocketGwt" />
|
||||
<inherits name="com.github.czyzby.websocket.GdxWebSocketSerialization" />
|
||||
<inherits name="com.openeggbert.OpenEggbertMainClass" />
|
||||
<inherits name="com.openeggbert.main.OpenEggbertGame" />
|
||||
<inherits name="formic" />
|
||||
<inherits name="guacamole_gdx_gwt" />
|
||||
<inherits name="libgdx-utils" />
|
||||
|
@ -3,7 +3,7 @@ package com.openeggbert.gwt;
|
||||
import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.backends.gwt.GwtApplication;
|
||||
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
|
||||
import com.openeggbert.OpenEggbertMainClass;
|
||||
import com.openeggbert.main.OpenEggbertGame;
|
||||
|
||||
/** Launches the GWT application. */
|
||||
public class GwtLauncher extends GwtApplication {
|
||||
@ -21,6 +21,6 @@ public class GwtLauncher extends GwtApplication {
|
||||
|
||||
@Override
|
||||
public ApplicationListener createApplicationListener () {
|
||||
return new OpenEggbertMainClass();
|
||||
return new OpenEggbertGame();
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,13 @@ public class DesktopUtils {
|
||||
|
||||
public static Optional<GameSpace> tryToLoadGameSpace() {
|
||||
String gameSpaceDirectoryFromEnvironmentVariable = System.getenv().getOrDefault("GAME_SPACE_DIRECTORY", "");
|
||||
String gameSpaceDirectoryFromSystemProperty = System.getProperty("GAME_SPACE_DIRECTORY", "");
|
||||
|
||||
if (!gameSpaceDirectoryFromEnvironmentVariable.isBlank()) {
|
||||
return tryToLoadGameSpaceFromEnvironmentVariable(gameSpaceDirectoryFromEnvironmentVariable);
|
||||
}
|
||||
if (!gameSpaceDirectoryFromSystemProperty.isBlank()) {
|
||||
return tryToLoadGameSpaceFromEnvironmentVariable(gameSpaceDirectoryFromSystemProperty);
|
||||
}
|
||||
Optional<GameSpace> gameOptional = tryToLoadGameSpaceFromCurrentDirectory();
|
||||
return gameOptional;
|
||||
|
@ -22,7 +22,7 @@ package com.openeggbert.lwjgl3;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||
import com.openeggbert.OpenEggbertMainClass;
|
||||
import com.openeggbert.main.OpenEggbertGame;
|
||||
import com.openeggbert.entity.common.GameSpace;
|
||||
import java.util.Optional;
|
||||
|
||||
@ -34,10 +34,12 @@ public class Lwjgl3Launcher {
|
||||
}
|
||||
|
||||
private static Lwjgl3Application createApplication() {
|
||||
//System.getProperties().put("GAME_SPACE_DIRECTORY", "/rv/data/desktop/code/code.nanoboot.org/nanoboot/open-eggbert/assets/open-eggbert-legacy-assets/speedy_blupi_I");
|
||||
|
||||
Optional<GameSpace> gameSpace = DesktopUtils.tryToLoadGameSpace();
|
||||
String currentDirectory = DesktopUtils.getPathToDirectoryWhereJarIsRunning();
|
||||
final OpenEggbertMainClass openEggbertMainClass = gameSpace.isPresent() ? new OpenEggbertMainClass(gameSpace.get(), currentDirectory) : new OpenEggbertMainClass(currentDirectory);
|
||||
return new Lwjgl3Application(openEggbertMainClass, getDefaultConfiguration());
|
||||
final OpenEggbertGame openEggbertGame = gameSpace.isPresent() ? new OpenEggbertGame(gameSpace.get(), currentDirectory) : new OpenEggbertGame(currentDirectory);
|
||||
return new Lwjgl3Application(openEggbertGame, getDefaultConfiguration());
|
||||
}
|
||||
|
||||
private static Lwjgl3ApplicationConfiguration getDefaultConfiguration() {
|
||||
@ -49,7 +51,7 @@ public class Lwjgl3Launcher {
|
||||
//// If you remove the above line and set Vsync to false, you can get unlimited FPS, which can be
|
||||
//// useful for testing performance, but can also be very stressful to some hardware.
|
||||
//// You may also need to configure GPU drivers to fully disable Vsync; this can cause screen tearing.
|
||||
configuration.setWindowedMode(840, 480);
|
||||
configuration.setWindowedMode(640, 480);
|
||||
configuration.setWindowIcon("libgdx128.png", "libgdx64.png", "libgdx32.png", "libgdx16.png");
|
||||
return configuration;
|
||||
}
|
||||
|
Reference in New Issue
Block a user