This commit is contained in:
Robert Vokac 2024-08-09 15:05:58 +02:00
parent e8f3523a38
commit 042f6dc15c
No known key found for this signature in database
GPG Key ID: C459E1E4B4A986BB
11 changed files with 436 additions and 30 deletions

1
clean.sh Executable file
View File

@ -0,0 +1 @@
./gradlew clean $1

View File

@ -17,20 +17,29 @@
// <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.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;
}
}

View File

@ -17,13 +17,13 @@
// <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;
package com.openeggbert.compatibility;
/**
*
* @author robertvokac
*/
public class GameFiles {
public enum ImageResolution {
NORMAL, DOUBLE;
}

View File

@ -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
// <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.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;
}
}

View File

@ -17,22 +17,29 @@
// <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.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;
}
}

View File

@ -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;
}
}

View File

@ -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
// <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.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);
}
}

View File

@ -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<OpenEggbertScreenType> getScreenType() {

View 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.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<OpenEggbertScreenType> 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);
}
}

View 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.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<OpenEggbertScreenType> 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);
}
}

View 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.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<OpenEggbertScreenType> 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);
}
}