diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..6d14f72 --- /dev/null +++ b/clean.sh @@ -0,0 +1 @@ +./gradlew clean $1 diff --git a/core/src/main/java/com/openeggbert/entity/common/GameFile.java b/core/src/main/java/com/openeggbert/compatibility/ImageFormats.java similarity index 68% rename from core/src/main/java/com/openeggbert/entity/common/GameFile.java rename to core/src/main/java/com/openeggbert/compatibility/ImageFormats.java index 99c4597..c9c586b 100644 --- a/core/src/main/java/com/openeggbert/entity/common/GameFile.java +++ b/core/src/main/java/com/openeggbert/compatibility/ImageFormats.java @@ -17,20 +17,29 @@ // or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// +package com.openeggbert.compatibility; -package com.openeggbert.entity.common; - -import com.openeggbert.compatibility.FeatureLevel; +import lombok.Getter; /** * * @author robertvokac */ -public class GameFile { - - private FeatureLevel compatibilityMode; - private GameFileType gameFileType; - private String path; - private String name; - private String originalSha512Sum; +public enum ImageFormats { + BMP("blp", "bmp"), + PNG("png"), + JPEG("jpeg") + ; + @Getter + private String[] fileExtensions; + @Getter + private boolean openEggbertOnly; + ImageFormats(String... fileExtensionsIn) { + this(true, fileExtensionsIn); + } + ImageFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) { + this.fileExtensions = fileExtensionsIn; + this.openEggbertOnly = openEggbertOnlyIn; + } + } diff --git a/core/src/main/java/com/openeggbert/entity/common/GameFiles.java b/core/src/main/java/com/openeggbert/compatibility/ImageResolution.java similarity index 92% rename from core/src/main/java/com/openeggbert/entity/common/GameFiles.java rename to core/src/main/java/com/openeggbert/compatibility/ImageResolution.java index f84270b..9baebba 100644 --- a/core/src/main/java/com/openeggbert/entity/common/GameFiles.java +++ b/core/src/main/java/com/openeggbert/compatibility/ImageResolution.java @@ -17,13 +17,13 @@ // or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// - -package com.openeggbert.entity.common; +package com.openeggbert.compatibility; /** * * @author robertvokac */ -public class GameFiles { +public enum ImageResolution { + NORMAL, DOUBLE; } diff --git a/core/src/main/java/com/openeggbert/compatibility/MusicFormats.java b/core/src/main/java/com/openeggbert/compatibility/MusicFormats.java new file mode 100644 index 0000000..ea12f3d --- /dev/null +++ b/core/src/main/java/com/openeggbert/compatibility/MusicFormats.java @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// 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 +// or write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +/////////////////////////////////////////////////////////////////////////////////////////////// +package com.openeggbert.compatibility; + +import lombok.Getter; + +/** + * + * @author robertvokac + */ +public enum MusicFormats { + MIDI("blp", "mid"), + MP3("mp3"), + OGG("ogg"), + WAV("wav") + ; + @Getter + private String[] fileExtensions; + @Getter + private boolean openEggbertOnly; + MusicFormats(String... fileExtensionsIn) { + this(true, fileExtensionsIn); + } + MusicFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) { + this.fileExtensions = fileExtensionsIn; + this.openEggbertOnly = openEggbertOnlyIn; + } + +} diff --git a/core/src/main/java/com/openeggbert/entity/common/GameExecution.java b/core/src/main/java/com/openeggbert/compatibility/SoundFormats.java similarity index 68% rename from core/src/main/java/com/openeggbert/entity/common/GameExecution.java rename to core/src/main/java/com/openeggbert/compatibility/SoundFormats.java index e7f78f5..a215f48 100644 --- a/core/src/main/java/com/openeggbert/entity/common/GameExecution.java +++ b/core/src/main/java/com/openeggbert/compatibility/SoundFormats.java @@ -17,22 +17,29 @@ // or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// +package com.openeggbert.compatibility; - -package com.openeggbert.entity.common; - -import com.openeggbert.compatibility.FeatureLevel; -import com.openeggbert.compatibility.ResolutionMode; -import lombok.Data; +import lombok.Getter; /** * * @author robertvokac */ -@Data -public class GameExecution { - private FeatureLevel compatibilityMode; - private ResolutionMode resolutionMode = ResolutionMode.RESOLUTION_640_480; - private Boolean cheatsEnabled = true; +public enum SoundFormats { + WAV("blp", "wav"), + MP3("mp3"), + OGG("ogg") + ; + @Getter + private String[] fileExtensions; + @Getter + private boolean openEggbertOnly; + SoundFormats(String... fileExtensionsIn) { + this(true, fileExtensionsIn); + } + SoundFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) { + this.fileExtensions = fileExtensionsIn; + this.openEggbertOnly = openEggbertOnlyIn; + } } diff --git a/core/src/main/java/com/openeggbert/entity/common/OpenEggbertScreenType.java b/core/src/main/java/com/openeggbert/entity/common/OpenEggbertScreenType.java index 4985565..2077383 100644 --- a/core/src/main/java/com/openeggbert/entity/common/OpenEggbertScreenType.java +++ b/core/src/main/java/com/openeggbert/entity/common/OpenEggbertScreenType.java @@ -28,13 +28,22 @@ import lombok.Getter; * @author robertvokac */ public enum OpenEggbertScreenType { - INIT("INIT.BMP"), - GAMER("GAMER.BLP"), - DEMO("DECOR016.BMP"); + INIT("INIT"), + GAMER("GAMER"), + MAIN_HUB(""), + SUB_HUB(""), + GAME(""), + DEMO("DECOR016"),//todo fix me + ; + @Getter - private String fileName; + private String fileNameWithoutExtension; + + OpenEggbertScreenType() { + this.fileNameWithoutExtension = ""; + } OpenEggbertScreenType(String fileName) { - this.fileName = fileName; + this.fileNameWithoutExtension = fileName; } } diff --git a/core/src/main/java/com/openeggbert/screens/AbstractGameScreen.java b/core/src/main/java/com/openeggbert/screens/AbstractGameScreen.java new file mode 100644 index 0000000..7558ca9 --- /dev/null +++ b/core/src/main/java/com/openeggbert/screens/AbstractGameScreen.java @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// 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 +// 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.InputAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.utils.ScreenUtils; +import com.openeggbert.main.OpenEggbertGame; + +/** + * + * @author robertvokac + */ +public class AbstractGameScreen extends AbstractOpenEggbertScreen { + + public AbstractGameScreen(OpenEggbertGame openEggbertGame) { + super(openEggbertGame); + + } + + @Override + public void show() { + Gdx.input.setInputProcessor(new InputAdapter() { + @Override + public boolean keyDown(int keyCode) { + game.setScreen(new InitScreen(game)); + return true; + } + + public boolean touchDown(int screenX, int screenY, int pointer, int button) { + game.setScreen(new InitScreen(game)); + return true; + } + }); + } + + @Override + public void renderOpenEggbertScreen(float delta) { + ScreenUtils.clear(0f, 0f, 0f, 1f); + batch.begin(); + drawBackgroundIfAvailable(); + + BitmapFont font; + font = new BitmapFont(); + font.getData().setScale(2.0f); + font.setColor(Color.RED); + + font.draw(batch, "Sorry, game is not yet implemented", 40, 400); + font.draw(batch, "Please, press any key", 40, 300); + font.draw(batch, "to return to the main screen", 40, 250); + + + batch.end(); + } + + @Override + public void hide() { + Gdx.input.setInputProcessor(null); + } +} diff --git a/core/src/main/java/com/openeggbert/screens/AbstractOpenEggbertScreen.java b/core/src/main/java/com/openeggbert/screens/AbstractOpenEggbertScreen.java index 8cec50e..3a54150 100644 --- a/core/src/main/java/com/openeggbert/screens/AbstractOpenEggbertScreen.java +++ b/core/src/main/java/com/openeggbert/screens/AbstractOpenEggbertScreen.java @@ -48,7 +48,7 @@ public abstract class AbstractOpenEggbertScreen extends ScreenAdapter { private final String getBackgroundFileName() { //return "INIT.BLP.BMP"; - return getScreenType().isPresent() ? getScreenType().get().getFileName() : ""; + return getScreenType().isPresent() ? getScreenType().get().getFileNameWithoutExtension(): ""; } protected Optional getScreenType() { diff --git a/core/src/main/java/com/openeggbert/screens/GameScreen.java b/core/src/main/java/com/openeggbert/screens/GameScreen.java new file mode 100644 index 0000000..b3162b2 --- /dev/null +++ b/core/src/main/java/com/openeggbert/screens/GameScreen.java @@ -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 +// 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.InputAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +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 GameScreen extends AbstractGameScreen { + + public GameScreen(OpenEggbertGame openEggbertGame) { + super(openEggbertGame); + + } + + protected final Optional getScreenType() { + return Optional.of(OpenEggbertScreenType.GAME); + } + + @Override + public void show() { + Gdx.input.setInputProcessor(new InputAdapter() { + @Override + public boolean keyDown(int keyCode) { + game.setScreen(new InitScreen(game)); + return true; + } + + public boolean touchDown(int screenX, int screenY, int pointer, int button) { + game.setScreen(new InitScreen(game)); + return true; + } + }); + } + + @Override + public void renderOpenEggbertScreen(float delta) { + ScreenUtils.clear(0f, 0f, 0f, 1f); + batch.begin(); + drawBackgroundIfAvailable(); + + BitmapFont font; + font = new BitmapFont(); + font.getData().setScale(2.0f); + font.setColor(Color.RED); + + font.draw(batch, "Sorry, demo is not yet implemented", 40, 400); + font.draw(batch, "Please, press any key", 40, 300); + font.draw(batch, "to return to the main screen", 40, 250); + + + batch.end(); + } + + @Override + public void hide() { + Gdx.input.setInputProcessor(null); + } +} diff --git a/core/src/main/java/com/openeggbert/screens/MainHubScreen.java b/core/src/main/java/com/openeggbert/screens/MainHubScreen.java new file mode 100644 index 0000000..c2afcef --- /dev/null +++ b/core/src/main/java/com/openeggbert/screens/MainHubScreen.java @@ -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 +// 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.InputAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +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 MainHubScreen extends AbstractGameScreen { + + public MainHubScreen(OpenEggbertGame openEggbertGame) { + super(openEggbertGame); + + } + + protected final Optional getScreenType() { + return Optional.of(OpenEggbertScreenType.MAIN_HUB); + } + + @Override + public void show() { + Gdx.input.setInputProcessor(new InputAdapter() { + @Override + public boolean keyDown(int keyCode) { + game.setScreen(new InitScreen(game)); + return true; + } + + public boolean touchDown(int screenX, int screenY, int pointer, int button) { + game.setScreen(new InitScreen(game)); + return true; + } + }); + } + + @Override + public void renderOpenEggbertScreen(float delta) { + ScreenUtils.clear(0f, 0f, 0f, 1f); + batch.begin(); + drawBackgroundIfAvailable(); + + BitmapFont font; + font = new BitmapFont(); + font.getData().setScale(2.0f); + font.setColor(Color.RED); + + font.draw(batch, "Sorry, demo is not yet implemented", 40, 400); + font.draw(batch, "Please, press any key", 40, 300); + font.draw(batch, "to return to the main screen", 40, 250); + + + batch.end(); + } + + @Override + public void hide() { + Gdx.input.setInputProcessor(null); + } +} diff --git a/core/src/main/java/com/openeggbert/screens/SubHubScreen.java b/core/src/main/java/com/openeggbert/screens/SubHubScreen.java new file mode 100644 index 0000000..4333b49 --- /dev/null +++ b/core/src/main/java/com/openeggbert/screens/SubHubScreen.java @@ -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 +// 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.InputAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +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 SubHubScreen extends AbstractGameScreen { + + public SubHubScreen(OpenEggbertGame openEggbertGame) { + super(openEggbertGame); + + } + + protected final Optional getScreenType() { + return Optional.of(OpenEggbertScreenType.SUB_HUB); + } + + @Override + public void show() { + Gdx.input.setInputProcessor(new InputAdapter() { + @Override + public boolean keyDown(int keyCode) { + game.setScreen(new InitScreen(game)); + return true; + } + + public boolean touchDown(int screenX, int screenY, int pointer, int button) { + game.setScreen(new InitScreen(game)); + return true; + } + }); + } + + @Override + public void renderOpenEggbertScreen(float delta) { + ScreenUtils.clear(0f, 0f, 0f, 1f); + batch.begin(); + drawBackgroundIfAvailable(); + + BitmapFont font; + font = new BitmapFont(); + font.getData().setScale(2.0f); + font.setColor(Color.RED); + + font.draw(batch, "Sorry, demo is not yet implemented", 40, 400); + font.draw(batch, "Please, press any key", 40, 300); + font.draw(batch, "to return to the main screen", 40, 250); + + + batch.end(); + } + + @Override + public void hide() { + Gdx.input.setInputProcessor(null); + } +}