summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f4d52e3)
raw | patch | inline | side by side (parent: f4d52e3)
author | fred-boy <fredboy@protonmail.com> | |
Wed, 6 May 2020 13:29:26 +0000 (20:29 +0700) | ||
committer | fred-boy <fredboy@protonmail.com> | |
Wed, 6 May 2020 14:27:01 +0000 (21:27 +0700) |
30 files changed:
diff --git a/core/src/ru/deadsoftware/cavedroid/CaveGame.java b/core/src/ru/deadsoftware/cavedroid/CaveGame.java
index f1fb3eed43b8be66c7f358e028561085358bdcdb..031b6135ae3fb58153427d52e76814d598898124 100644 (file)
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import ru.deadsoftware.cavedroid.game.GameItems;
+import ru.deadsoftware.cavedroid.game.GameScreen;
import ru.deadsoftware.cavedroid.misc.Assets;
public class CaveGame extends Game {
public static final String VERSION = "alpha 0.4";
+ private final MainConfig mMainConfig;
+ private final MainComponent mMainComponent;
+
private final String mGameFolder;
private final boolean mTouch;
private boolean mDebug;
public CaveGame(String gameFolder, boolean touch) {
mGameFolder = gameFolder;
mTouch = touch;
+
+ mMainComponent = DaggerMainComponent.builder().caveGame(this).build();
+ mMainConfig = mMainComponent.getMainConfig();
}
public void setDebug(boolean debug) {
mDebug = debug;
}
- private void initConfig(MainConfig mainConfig, MainComponent mainComponent) {
+ private void initConfig() {
int width = mTouch ? 320 : 480;
int height = (int) (width * ((float) Gdx.graphics.getHeight() / Gdx.graphics.getWidth()));
- mainConfig.setMainComponent(mainComponent);
- mainConfig.setGameFolder(mGameFolder);
- mainConfig.setTouch(mTouch);
- mainConfig.setWidth(width);
- mainConfig.setHeight(height);
- mainConfig.setShowInfo(true);
+ mMainConfig.setMainComponent(mMainComponent);
+ mMainConfig.setGameFolder(mGameFolder);
+ mMainConfig.setTouch(mTouch);
+ mMainConfig.setWidth(width);
+ mMainConfig.setHeight(height);
+ mMainConfig.setShowInfo(mDebug);
+ }
+
+ public void newGame() {
+ GameScreen gameScreen = mMainComponent.getGameScreen();
+ gameScreen.newGame();
+ setScreen(gameScreen);
+ }
+
+ public void loadGame() {
+ GameScreen gameScreen = mMainComponent.getGameScreen();
+ gameScreen.loadGame();
+ setScreen(gameScreen);
+ }
+
+ public void quitGame() {
+ setScreen(mMainComponent.getMenuScreen());
}
@Override
Assets.load();
GameItems.load();
- MainComponent mainComponent = DaggerMainComponent.create();
- initConfig(mainComponent.getGameConfig(), mainComponent);
- setScreen(mainComponent.getGameScreen());
+ initConfig();
+
+ setScreen(mMainComponent.getMenuScreen());
}
}
diff --git a/core/src/ru/deadsoftware/cavedroid/MainComponent.java b/core/src/ru/deadsoftware/cavedroid/MainComponent.java
index 74bb1915dbd59c8ea8d723db8b1c87f1d43b48f5..d8a05da03fbdeda134cc144a6af804f881ff48d9 100644 (file)
import dagger.Component;
import ru.deadsoftware.cavedroid.game.GameScreen;
+import ru.deadsoftware.cavedroid.menu.MenuScreen;
import javax.inject.Singleton;
@Singleton
-@Component
+@Component(dependencies = CaveGame.class)
public interface MainComponent {
GameScreen getGameScreen();
- MainConfig getGameConfig();
+
+ MenuScreen getMenuScreen();
+
+ MainConfig getMainConfig();
}
diff --git a/core/src/ru/deadsoftware/cavedroid/MainConfig.java b/core/src/ru/deadsoftware/cavedroid/MainConfig.java
index b48b78df896ebe46b878bc1675dcc44007fdafdc..8cd0ffdac6920e2977f46ac10c156e8be4f4ac7f 100644 (file)
import ru.deadsoftware.cavedroid.game.GameUiWindow;
+import javax.annotation.CheckForNull;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class MainConfig {
+ private final CaveGame mCaveGame;
+
+ @CheckForNull
private MainComponent mMainComponent;
private GameUiWindow mGameUiWindow;
private float mHeight;
@Inject
- public MainConfig() {
+ public MainConfig(CaveGame caveGame) {
+ mCaveGame = caveGame;
+
mGameUiWindow = GameUiWindow.NONE;
mGameFolder = "";
}
+ public CaveGame getCaveGame() {
+ return mCaveGame;
+ }
+
public MainComponent getMainComponent() {
+ assert mMainComponent != null;
return mMainComponent;
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameComponent.java b/core/src/ru/deadsoftware/cavedroid/game/GameComponent.java
index 320f4f6438c2f85d9468c5648f412f30522a5b47..25779f06851e234c83c818872bf290064eccd82d 100644 (file)
import ru.deadsoftware.cavedroid.MainComponent;
@GameScope
-@Component(dependencies = MainComponent.class)
+@Component(dependencies = MainComponent.class, modules = GameModule.class)
public interface GameComponent {
GameProc getGameProc();
+
GameInputProcessor getGameInputProcessor();
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameFluidsThread.java b/core/src/ru/deadsoftware/cavedroid/game/GameFluidsThread.java
index 20e95b8799bda3cdcfbcb3513db1d0a6e4921506..c3cdd47b355a5d2434f27c3df622dbb1ea669836 100644 (file)
private static final int[] LAVA_IDS = {9, 64, 65, 66, 67};
private long mFluidLastUpdateTimestamp = 0;
-
+
private final GameWorld mGameWorld;
private final MobsController mMobsController;
private final Thread mMainThread;
-
+
GameFluidsThread(GameWorld gameWorld,
MobsController mobsController,
Thread mainThread) {
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameInput.java b/core/src/ru/deadsoftware/cavedroid/game/GameInput.java
index 3a5e3c4ff47044665b0d69cac4384f0c7bd7072c..ca603176453f1ac7e219c6d825c11dfeb1f8f528 100644 (file)
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.game.mobs.Pig;
import ru.deadsoftware.cavedroid.game.mobs.Player;
+import ru.deadsoftware.cavedroid.game.objects.DropController;
import ru.deadsoftware.cavedroid.misc.Assets;
import ru.deadsoftware.cavedroid.misc.ControlMode;
private final MainConfig mMainConfig;
private final GameWorld mGameWorld;
+ private final DropController mDropController;
private final MobsController mMobsController;
private final Player mPlayer;
@Inject
public GameInput(MainConfig mainConfig,
GameWorld gameWorld,
+ DropController dropController,
MobsController mobsController) {
mMainConfig = mainConfig;
mGameWorld = gameWorld;
+ mDropController = dropController;
mMobsController = mobsController;
mPlayer = mMobsController.getPlayer();
mTouchedDown = false;
} else {
if (insideHotbar(mTouchDownX, mTouchDownY)) {
-// CaveGame.GAME_STATE = GameState.CREATIVE_INV;
+ mMainConfig.setGameUiWindow(GameUiWindow.CREATIVE_INVENTORY);
mTouchedDown = false;
}
}
mGameWorld.placeToForeground(mCurX, mCurY, 8);
break;
-// case Input.Keys.ESCAPE:
-// case Input.Keys.BACK:
-// CaveGame.APP_STATE = AppState.SAVE;
-// CaveGame.GAME_STATE = GameState.PAUSE;
-// break;
+ case Input.Keys.ESCAPE:
+ case Input.Keys.BACK:
+ GameSaver.save(mMainConfig, mDropController, mMobsController, mGameWorld);
+ mMainConfig.getCaveGame().quitGame();
+ break;
case Input.Keys.F1:
mMainConfig.setShowInfo(!mMainConfig.isShowInfo());
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameInputProcessor.java b/core/src/ru/deadsoftware/cavedroid/game/GameInputProcessor.java
index faafd63959c4ede000938d27d503ce13ac0c6f92..51cc897f4a1f891e5cf044325e4c09db572e55ff 100644 (file)
private final GameInput mGameInput;
private final GameRenderer mGameRenderer;
private final MainConfig mMainConfig;
-
+
@Inject
public GameInputProcessor(GameInput gameInput,
GameRenderer gameRenderer,
mGameInput = gameInput;
mGameRenderer = gameRenderer;
mMainConfig = mainConfig;
-
+
loadTouchButtonsFromJSON();
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameModule.java b/core/src/ru/deadsoftware/cavedroid/game/GameModule.java
--- /dev/null
@@ -0,0 +1,52 @@
+package ru.deadsoftware.cavedroid.game;
+
+import dagger.Module;
+import dagger.Provides;
+import ru.deadsoftware.cavedroid.MainConfig;
+import ru.deadsoftware.cavedroid.game.mobs.MobsController;
+import ru.deadsoftware.cavedroid.game.objects.DropController;
+
+import javax.annotation.CheckForNull;
+
+@Module
+public class GameModule {
+
+ @CheckForNull
+ private static GameSaver.Data data;
+
+ public static void load(MainConfig mainConfig) {
+ data = GameSaver.load(mainConfig);
+ }
+
+ private static void makeDataNullIfEmpty() {
+ if (data != null && data.isEmpty()) {
+ data = null;
+ }
+ }
+
+ @Provides
+ @GameScope
+ public static DropController provideDropController() {
+ DropController controller = data != null ? data.retrieveDropController() : new DropController();
+ makeDataNullIfEmpty();
+ return controller;
+ }
+
+ @Provides
+ @GameScope
+ public static MobsController provideMobsController() {
+ MobsController controller = data != null ? data.retrieveMobsController() : new MobsController();
+ makeDataNullIfEmpty();
+ return controller;
+ }
+
+ @Provides
+ @GameScope
+ public static GameWorld provideGameWorld(DropController dropController, MobsController mobsController) {
+ int[][] fm = data != null ? data.retrieveForeMap() : null;
+ int[][] bm = data != null ? data.retrieveBackMap() : null;
+ makeDataNullIfEmpty();
+ return new GameWorld(dropController, mobsController, fm, bm);
+ }
+
+}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java b/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java
index 6695d6e76864606e4fe06a6aaaa80e8dcf3e97b1..d6b5a9aa5da8e907c07430e1670cce350a61a757 100644 (file)
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.game.mobs.Player;
import ru.deadsoftware.cavedroid.game.objects.Drop;
+import ru.deadsoftware.cavedroid.game.objects.DropController;
import javax.inject.Inject;
import java.util.Iterator;
private final GameWorld mGameWorld;
private final MainConfig mMainConfig;
private final MobsController mMobsController;
+ private final DropController mDropController;
@Inject
public GamePhysics(GameWorld gameWorld,
MainConfig mainConfig,
- MobsController mobsController) {
+ MobsController mobsController,
+ DropController dropController) {
mGameWorld = gameWorld;
mMainConfig = mainConfig;
mMobsController = mobsController;
+ mDropController = dropController;
}
/**
}
void update() {
-// for (Iterator<Drop> it = GP.drops.iterator(); it.hasNext(); ) {
-// Drop drop = it.next();
-// dropPhy(drop);
-// if (Intersector.overlaps(drop, GP.player)) {
-// drop.pickUpDrop(GP.player);
-// }
-// if (drop.isPickedUp()) {
-// it.remove();
-// }
-// }
+ Player player = mMobsController.getPlayer();
+
+ for (Iterator<Drop> it = mDropController.getIterator(); it.hasNext(); ) {
+ Drop drop = it.next();
+ dropPhy(drop);
+ if (Intersector.overlaps(drop, player)) {
+ drop.pickUpDrop(player);
+ }
+ if (drop.isPickedUp()) {
+ it.remove();
+ }
+ }
for (Iterator<Mob> it = mMobsController.getIterator(); it.hasNext(); ) {
Mob mob = it.next();
}
}
- Player player = mMobsController.getPlayer();
playerPhy(player);
if (player.isDead()) {
player.respawn(mGameWorld);
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameProc.java b/core/src/ru/deadsoftware/cavedroid/game/GameProc.java
index ef0821107a4e520b0d56e4c21d145e9203549992..44a46878cff367a12cc83ed0b8b8619be6b16c54 100644 (file)
package ru.deadsoftware.cavedroid.game;
+import com.badlogic.gdx.utils.Disposable;
+
import javax.inject.Inject;
@GameScope
-public class GameProc {
+public class GameProc implements Disposable {
public static final int MAX_CREATIVE_SCROLL = GameItems.getItemsSize() / 8;
mGameRenderer.render(delta);
}
+ @Override
+ public void dispose() {
+ mGameWorld.dispose();
+ }
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
index 018fe1bf750e5b3fba65d98bb1acddcead8af876..864938d83b35db74a152d17f90ef4480a30897d4 100644 (file)
@GameScope
public class GameRenderer extends Renderer {
- private static final String TAG = "GameRenderer";
-
private final MainConfig mMainConfig;
private final GameInput mGameInput;
private final GameWorld mGameWorld;
if (mMainConfig.isShowInfo()) {
spriter.begin();
+ Player player = mMobsController.getPlayer();
drawString("FPS: " + fps, 0, 0);
- drawString("X: " + mMobsController.getPlayer().getMapX(), 0, 10);
- drawString("Y: " + mMobsController.getPlayer().getUpperMapY(), 0, 20);
+ drawString("X: " + player.getMapX(), 0, 10);
+ drawString("Y: " + player.getUpperMapY(), 0, 20);
drawString("CurX: " + mGameInput.getCurX(), 0, 30);
drawString("CurY: " + mGameInput.getCurY(), 0, 40);
drawString("Mobs: " + mMobsController.getSize(), 0, 50);
drawString("Drops: " + mDropController.getSize(), 0, 60);
drawString("Block: " + GameItems.getBlockKey(mGameWorld.getForeMap(mGameInput.getCurX(), mGameInput.getCurY())), 0, 70);
drawString("Hand: " + GameItems.getItemKey(mMobsController.getPlayer().inventory[mMobsController.getPlayer().slot]), 0, 80);
- drawString("Game mode: " + mMobsController.getPlayer().gameMode, 0, 90);
+ drawString("Game mode: " + player.gameMode, 0, 90);
spriter.end();
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameSaver.java b/core/src/ru/deadsoftware/cavedroid/game/GameSaver.java
index 26281f6c81dfa5c16207c91ce810a6e5f3016192..1ff2bad9783788a68d6ff1858dc9185f2a9a6fbe 100644 (file)
package ru.deadsoftware.cavedroid.game;
+import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
+import ru.deadsoftware.cavedroid.MainConfig;
+import ru.deadsoftware.cavedroid.game.mobs.MobsController;
+import ru.deadsoftware.cavedroid.game.objects.DropController;
-import java.io.BufferedOutputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
+import javax.annotation.CheckForNull;
+import java.io.*;
import java.nio.ByteBuffer;
-//TODO rewrite saver
public class GameSaver {
- private static final int VERSION = 0;
+ public static class Data {
+ @CheckForNull
+ private MobsController mMobsController;
+ @CheckForNull
+ private DropController mDropController;
+ @CheckForNull
+ private int[][] mForeMap, mBackMap;
+ public Data(MobsController mobsController, DropController dropController, int[][] foreMap, int[][] backMap) {
+ mMobsController = mobsController;
+ mDropController = dropController;
+ mForeMap = foreMap;
+ mBackMap = backMap;
+ }
+
+ public MobsController retrieveMobsController() {
+ assert mMobsController != null;
+ MobsController mobsController = mMobsController;
+ mMobsController = null;
+ return mobsController;
+ }
+
+ public DropController retrieveDropController() {
+ assert mDropController != null;
+ DropController dropController = mDropController;
+ mDropController = null;
+ return dropController;
+ }
+
+ public int[][] retrieveForeMap() {
+ assert mForeMap != null;
+ int[][] foreMap = mForeMap;
+ mForeMap = null;
+ return foreMap;
+ }
+
+ public int[][] retrieveBackMap() {
+ assert mBackMap != null;
+ int[][] backMap = mBackMap;
+ mBackMap = null;
+ return backMap;
+ }
+
+ public boolean isEmpty() {
+ return mMobsController == null && mDropController == null && mForeMap == null && mBackMap == null;
+ }
+ }
+
+ private static final int SAVE_VERSION = 1;
private static byte[] intToBytes(int i) {
return ByteBuffer.allocate(4).putInt(i).array();
}
private static void saveMap(FileHandle file, int[][] map) throws IOException {
- int rl, bl;
+ int run, block;
int width = map.length;
int height = map[0].length;
+
BufferedOutputStream out = new BufferedOutputStream(file.write(false));
- out.write(intToBytes(VERSION));
+
+ out.write(intToBytes(SAVE_VERSION));
out.write(intToBytes(width));
out.write(intToBytes(height));
+
for (int y = 0; y < height; y++) {
- bl = map[0][y];
- rl = 0;
+ block = map[0][y];
+ run = 0;
for (int[] ints : map) {
- if (ints[y] != bl) {
- out.write(intToBytes(rl));
- out.write(intToBytes(bl));
- rl = 0;
- bl = ints[y];
+ if (ints[y] != block) {
+ out.write(intToBytes(run));
+ out.write(intToBytes(block));
+ run = 0;
+ block = ints[y];
}
- rl++;
+ run++;
}
- out.write(intToBytes(rl));
- out.write(intToBytes(bl));
+ out.write(intToBytes(run));
+ out.write(intToBytes(block));
}
+
out.flush();
out.close();
}
-
private static int[][] loadMap(FileHandle file) throws Exception {
int[][] map;
- int ver, width, height;
- int rl, bl;
+ int version, width, height;
+ int run, block;
+
DataInputStream in = new DataInputStream(file.read());
- ver = in.readInt();
- if (VERSION == ver) {
+
+ version = in.readInt();
+
+ if (SAVE_VERSION == version) {
width = in.readInt();
height = in.readInt();
map = new int[width][height];
for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x += rl) {
- rl = in.readInt();
- bl = in.readInt();
- for (int i = x; i < x + rl; i++) {
- map[i][y] = bl;
+ for (int x = 0; x < width; x += run) {
+ run = in.readInt();
+ block = in.readInt();
+ for (int i = x; i < x + run; i++) {
+ map[i][y] = block;
}
}
}
- in.close();
} else {
throw new Exception("version mismatch");
}
+
+ in.close();
return map;
}
- public static GameProc load() {
-// FileHandle file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/game.sav");
-// GameProc gameProc = null;
-// try {
-// ObjectInputStream in = new ObjectInputStream(file.read());
-// int ver = in.readInt();
-// if (VERSION == ver) {
-// gameProc = (GameProc) in.readObject();
-// } else {
-// throw new Exception("version mismatch");
-// }
-// in.close();
-// gameProc.world = new GameWorld(
-// loadMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav")),
-// loadMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav"))
-// );
-// gameProc.physics = new GamePhysics();
-// gameProc.input = new GameInput();
-// } catch (Exception e) {
-// Gdx.app.error("GameSaver", e.getMessage(), e);
-// Gdx.app.exit();
-// }
-// return gameProc;
+ @CheckForNull
+ public static Data load(MainConfig mainConfig) {
+ String folder = mainConfig.getGameFolder();
+ FileHandle file = Gdx.files.absolute(folder + "/saves/game.sav");
+
+ try {
+ ObjectInputStream in = new ObjectInputStream(file.read());
+ int version = in.readInt();
+ DropController dropController;
+ MobsController mobsController;
+
+ if (SAVE_VERSION == version) {
+ dropController = (DropController) in.readObject();
+ mobsController = (MobsController) in.readObject();
+ } else {
+ throw new Exception("version mismatch");
+ }
+
+ in.close();
+
+ int[][] foreMap = loadMap(Gdx.files.absolute(mainConfig.getGameFolder() + "/saves/foremap.sav"));
+ int[][] backMap = loadMap(Gdx.files.absolute(mainConfig.getGameFolder() + "/saves/backmap.sav"));
+
+ if (dropController == null || mobsController == null) {
+ throw new Exception("couldn't load");
+ }
+
+ return new Data(mobsController, dropController, foreMap, backMap);
+ } catch (Exception e) {
+ Gdx.app.error("GameSaver", e.getMessage());
+ }
+
return null;
}
- public static void save(GameProc gp) {
-// FileHandle file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/");
-// file.mkdirs();
-// file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/game.sav");
-// try {
-// ObjectOutputStream out = new ObjectOutputStream(file.write(false));
-// out.writeInt(VERSION);
-// out.writeObject(gp);
-// out.close();
-// saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav"), gp.world.getFullForeMap());
-// saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav"), gp.world.getFullBackMap());
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
- }
+ public static void save(MainConfig mainConfig,
+ DropController dropController,
+ MobsController mobsController,
+ GameWorld gameWorld) {
+
+ String folder = mainConfig.getGameFolder();
+ FileHandle file = Gdx.files.absolute(folder + "/saves/");
+ file.mkdirs();
+ file = Gdx.files.absolute(folder + "/saves/game.sav");
- public static boolean exists() {
-// return (Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/game.sav").exists() &&
-// Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav").exists() &&
-// Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav").exists());
- return false;
+ try {
+ ObjectOutputStream out = new ObjectOutputStream(file.write(false));
+ out.writeInt(SAVE_VERSION);
+ out.writeObject(dropController);
+ out.writeObject(mobsController);
+ out.close();
+ saveMap(Gdx.files.absolute(folder + "/saves/foremap.sav"), gameWorld.getFullForeMap());
+ saveMap(Gdx.files.absolute(folder + "/saves/backmap.sav"), gameWorld.getFullBackMap());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
+ public static boolean exists(MainConfig mainConfig) {
+ String folder = mainConfig.getGameFolder();
+ return (Gdx.files.absolute(folder + "/saves/game.sav").exists() &&
+ Gdx.files.absolute(folder + "/saves/foremap.sav").exists() &&
+ Gdx.files.absolute(folder + "/saves/backmap.sav").exists());
+ }
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameScreen.java b/core/src/ru/deadsoftware/cavedroid/game/GameScreen.java
index 00cfd3e6502b57c0be039514f0f25870f639d2f6..370d8bd79066baf1db5c385f4d89556b53c6f740 100644 (file)
import com.badlogic.gdx.Screen;
import ru.deadsoftware.cavedroid.MainConfig;
+import javax.annotation.CheckForNull;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class GameScreen implements Screen {
- private static final String TAG = "GameScreen";
-
private final MainConfig mMainConfig;
+ @CheckForNull
private GameProc mGameProc;
+ @CheckForNull
+ private GameInputProcessor mGameInputProcessor;
@Inject
public GameScreen(MainConfig mainConfig) {
mMainConfig = mainConfig;
- newGame();
}
public void newGame() {
+ if (mGameProc != null) {
+ mGameProc.dispose();
+ }
+
GameComponent gameComponent = DaggerGameComponent.builder()
.mainComponent(mMainConfig.getMainComponent()).build();
+
mGameProc = gameComponent.getGameProc();
+ mGameInputProcessor = gameComponent.getGameInputProcessor();
+
+ Gdx.input.setInputProcessor(gameComponent.getGameInputProcessor());
+ }
+
+ public void loadGame() {
+ if (mGameProc != null) {
+ mGameProc.dispose();
+ }
+
+ GameModule.load(mMainConfig);
+
+ GameComponent gameComponent = DaggerGameComponent.builder()
+ .mainComponent(mMainConfig.getMainComponent()).build();
+
+ mGameProc = gameComponent.getGameProc();
+ mGameInputProcessor = gameComponent.getGameInputProcessor();
+
Gdx.input.setInputProcessor(gameComponent.getGameInputProcessor());
}
@Override
public void show() {
-
+ Gdx.input.setInputProcessor(mGameInputProcessor);
}
@Override
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java b/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java
index 5aecce295466dda979db1ed307f27f0cbead3706..cbf970ced1a84251183cca22cbd9877844ae374a 100644 (file)
package ru.deadsoftware.cavedroid.game;
+import com.badlogic.gdx.utils.Disposable;
import ru.deadsoftware.cavedroid.game.mobs.FallingGravel;
import ru.deadsoftware.cavedroid.game.mobs.FallingSand;
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.game.objects.Block;
import ru.deadsoftware.cavedroid.game.objects.DropController;
+import javax.annotation.CheckForNull;
import javax.inject.Inject;
@GameScope
-public class GameWorld {
+public class GameWorld implements Disposable {
private static final int DEFAULT_WIDTH = 1024;
private static final int DEFAULT_HEIGHT = 256;
private int mUpdateY;
@Inject
- GameWorld(DropController dropController,
- MobsController mobsController) {
+ public GameWorld(DropController dropController,
+ MobsController mobsController,
+ @CheckForNull int[][] foreMap,
+ @CheckForNull int[][] backMap) {
mDropController = dropController;
mMobsController = mobsController;
- mWidth = DEFAULT_WIDTH;
- mHeight = DEFAULT_HEIGHT;
- WorldGen.genWorld(mWidth, mHeight);
- mForeMap = WorldGen.getForeMap();
- mBackMap = WorldGen.getBackMap();
- WorldGen.clear();
+ boolean isNewGame = foreMap == null || backMap == null;
+
+ if (isNewGame) {
+ mWidth = DEFAULT_WIDTH;
+ mHeight = DEFAULT_HEIGHT;
+ WorldGen.genWorld(mWidth, mHeight);
+ mForeMap = WorldGen.getForeMap();
+ mBackMap = WorldGen.getBackMap();
+ WorldGen.clear();
+ mMobsController.getPlayer().respawn(this);
+ } else {
+ mForeMap = foreMap;
+ mBackMap = backMap;
+ mWidth = mForeMap.length;
+ mHeight = mForeMap[0].length;
+ }
mGameFluidsThread = new GameFluidsThread(this, mMobsController, Thread.currentThread());
}
-// GameWorld(int[][] foreMap, int[][] backMap) {
-// this.foreMap = foreMap.clone();
-// this.backMap = backMap.clone();
-// WIDTH = foreMap.length;
-// HEIGHT = foreMap[0].length;
-// }
-
public int getWidth() {
return mWidth;
}
setForeMap(x, y, 0);
mMobsController.addMob(FallingSand.class, x * 16, y * 16);
updateBlock(x, y - 1);
- }
+ }
}
if (getForeMap(x, y) == 11) {
mGameFluidsThread.start();
}
+ @Override
+ public void dispose() {
+ mGameFluidsThread.interrupt();
+ }
}
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/WorldGen.java b/core/src/ru/deadsoftware/cavedroid/game/WorldGen.java
index 4c9b9b23f68a1bfb823e44a1baffb087084a4b1b..cc02aea03f2dff4af2151175d451cb3c751c7f23 100644 (file)
import com.badlogic.gdx.math.RandomXS128;
import com.badlogic.gdx.utils.TimeUtils;
+import javax.annotation.CheckForNull;
+
class WorldGen {
+ @CheckForNull
private static RandomXS128 rand;
private static long seed;
+ @CheckForNull
private static int[][] foreMap, backMap;
+ @CheckForNull
private static int[] hMap;
+ @CheckForNull
private static int[] bMap; //biomes, 0-plains, 1-desert
public static long getSeed() {
}
private static void genCactus(int x, int y) {
+ assert foreMap != null;
foreMap[x][y] = 59;
foreMap[x][y - 1] = 59;
foreMap[x][y - 2] = 59;
}
private static void genOak(int x, int y) {
+ assert foreMap != null && backMap != null;
backMap[x][y] = 15;
backMap[x][y - 1] = 15;
backMap[x][y - 2] = 15;
}
static int[][] getForeMap() {
+ assert foreMap != null;
return foreMap;
}
static int[][] getBackMap() {
+ assert backMap != null;
return backMap;
}
static void clear() {
- foreMap = null;
- backMap = null;
hMap = null;
bMap = null;
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java
index 91dfae55e90823ce7fdc91aa6f919835edc6e58c..0f765925bc1679bed83830f29011a5f0bd88def8 100644 (file)
private boolean mFlyMode;
/**
- * @param x in pixels
- * @param y in pixels
- * @param width in pixels
- * @param height in pixels
- * @param mDirection Direction in which mob is looking
+ * @param x in pixels
+ * @param y in pixels
+ * @param width in pixels
+ * @param height in pixels
+ * @param mDirection Direction in which mob is looking
*/
protected Mob(float x, float y, float width, float height, Direction mDirection, Type type) {
super(x, y, width, height);
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/MobsController.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/MobsController.java
index 915ce25603a42f8dcdf76e201899b345a7aa3b4c..cda54ee9c04678109cc15f9586f81d9e00b91301 100644 (file)
import ru.deadsoftware.cavedroid.game.GameScope;
import javax.inject.Inject;
+import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedList;
@GameScope
-public class MobsController {
+public class MobsController implements Serializable {
public interface Callback {
void run(Mob mob);
diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/DropController.java b/core/src/ru/deadsoftware/cavedroid/game/objects/DropController.java
index c71a37ed04cab439136c9850da947fb7166ad40f..0e4c6592abe3badac802872be953ab84c68b2324 100644 (file)
import ru.deadsoftware.cavedroid.game.GameScope;
import javax.inject.Inject;
+import java.io.Serializable;
+import java.util.Iterator;
import java.util.LinkedList;
@GameScope
-public class DropController {
+public class DropController implements Serializable {
public interface Callback {
void run(Drop drop);
mDrops.forEach(callback::run);
}
+ public Iterator<Drop> getIterator() {
+ return mDrops.iterator();
+ }
+
}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/MenuComponent.java b/core/src/ru/deadsoftware/cavedroid/menu/MenuComponent.java
--- /dev/null
@@ -0,0 +1,10 @@
+package ru.deadsoftware.cavedroid.menu;
+
+import dagger.Component;
+import ru.deadsoftware.cavedroid.MainComponent;
+
+@MenuScope
+@Component(dependencies = MainComponent.class)
+public interface MenuComponent {
+ MenuProc getMenuProc();
+}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/MenuProc.java b/core/src/ru/deadsoftware/cavedroid/menu/MenuProc.java
index 8bc9dd6615f37fec87e79aa0acda38bdd4bb1ac4..f96d4d42756545c2d13cfc20de9a74655f986c15 100644 (file)
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.ObjectMap;
import ru.deadsoftware.cavedroid.CaveGame;
-import ru.deadsoftware.cavedroid.game.GameScreen;
+import ru.deadsoftware.cavedroid.MainConfig;
import ru.deadsoftware.cavedroid.menu.objects.Button;
import ru.deadsoftware.cavedroid.menu.submenus.Menu;
import ru.deadsoftware.cavedroid.menu.submenus.MenuMain;
import ru.deadsoftware.cavedroid.menu.submenus.MenuNewGame;
import ru.deadsoftware.cavedroid.misc.Renderer;
-import ru.deadsoftware.cavedroid.misc.states.AppState;
-import ru.deadsoftware.cavedroid.misc.states.GameState;
-import ru.deadsoftware.cavedroid.misc.states.MenuState;
+
+import javax.inject.Inject;
import static ru.deadsoftware.cavedroid.misc.Assets.*;
+@MenuScope
public class MenuProc extends Renderer {
- private MenuMain mainMenu;
- private MenuNewGame newGameMenu;
+ public class Input {
+ private void startNewGame(int gameMode) {
+ mMainConfig.getCaveGame().newGame();
+ }
+
+ public void newGameClicked() {
+ mCurrentMenu = mMenuNewGame;
+ }
- private Menu currentMenu;
+ public void loadGameClicked() {
+ mMainConfig.getCaveGame().loadGame();
+ }
+
+ public void quitClicked() {
+ Gdx.app.exit();
+ }
- public MenuProc(int width) {
- super(width, width * Gdx.graphics.getHeight() / Gdx.graphics.getWidth());
- mainMenu = new MenuMain(getWidth(), getHeight(), this::drawButton);
- newGameMenu = new MenuNewGame(getWidth(), getHeight(), this::drawButton);
- currentMenu = mainMenu;
+ public void survivalClicked() {
+ startNewGame(0);
+ }
+
+ public void creativeClicked() {
+ startNewGame(1);
+ }
+
+ public void backClicked() {
+ mCurrentMenu = mMenuMain;
+ }
+ }
+
+ private final MainConfig mMainConfig;
+
+ private final MenuMain mMenuMain;
+ private final MenuNewGame mMenuNewGame;
+
+ private Menu mCurrentMenu;
+
+ @Inject
+ public MenuProc(MainConfig mainConfig) {
+ super(mainConfig.getWidth(), mainConfig.getHeight());
+
+ mMainConfig = mainConfig;
+
+ Input menuInput = new Input();
+
+ mMenuMain = new MenuMain(getWidth(), getHeight(), this::drawButton, mainConfig, menuInput);
+ mMenuNewGame = new MenuNewGame(getWidth(), getHeight(), this::drawButton, mainConfig, menuInput);
+
+ mCurrentMenu = mMenuMain;
}
private void drawButton(Button button) {
(button.getY() + button.getHeight() / 2) - (float) getStringHeight(button.getLabel()) / 2);
}
- private void update() {
-// switch (CaveGame.MENU_STATE) {
-// case MAIN:
-// currentMenu = mainMenu;
-// break;
-// case NEW_GAME:
-// currentMenu = newGameMenu;
-// break;
-// case LOADING:
-// drawString("Generating World...");
-// CaveGame.APP_STATE = AppState.GAME;
-// CaveGame.GAME_STATE = GameState.PLAY;
-// break;
-// case SAVING:
-// drawString("Saving Game...");
-// CaveGame.APP_STATE = AppState.MENU;
-// CaveGame.MENU_STATE = MenuState.MAIN;
-// break;
-// }
- }
-
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int mb) {
screenX *= getWidth() / Gdx.graphics.getWidth();
screenY *= getHeight() / Gdx.graphics.getHeight();
- for (ObjectMap.Entry<String, Button> entry : currentMenu.getButtons()) {
+ for (ObjectMap.Entry<String, Button> entry : mCurrentMenu.getButtons()) {
Button button = entry.value;
if (button.getRect().contains(screenX, screenY)) {
if (button.getType() > 0) {
@Override
public void render(float delta) {
- update();
spriter.begin();
- currentMenu.draw(spriter);
+ mCurrentMenu.draw(spriter);
drawString("CaveDroid " + CaveGame.VERSION, 0,
getHeight() - getStringHeight("CaveDroid " + CaveGame.VERSION) * 1.5f);
spriter.end();
}
+
+ public void reset() {
+ mCurrentMenu = mMenuMain;
+ }
}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/MenuScope.java b/core/src/ru/deadsoftware/cavedroid/menu/MenuScope.java
--- /dev/null
@@ -0,0 +1,10 @@
+package ru.deadsoftware.cavedroid.menu;
+
+import javax.inject.Scope;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Scope
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MenuScope {
+}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/MenuScreen.java b/core/src/ru/deadsoftware/cavedroid/menu/MenuScreen.java
--- /dev/null
@@ -0,0 +1,57 @@
+package ru.deadsoftware.cavedroid.menu;
+
+import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.Screen;
+import ru.deadsoftware.cavedroid.MainConfig;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+@Singleton
+public class MenuScreen implements Screen {
+
+ private final MenuProc mMenuProc;
+
+ @Inject
+ public MenuScreen(MainConfig mainConfig) {
+ MenuComponent menuComponent = DaggerMenuComponent.builder()
+ .mainComponent(mainConfig.getMainComponent()).build();
+ mMenuProc = menuComponent.getMenuProc();
+ }
+
+ @Override
+ public void show() {
+ mMenuProc.reset();
+ Gdx.input.setInputProcessor(mMenuProc);
+ }
+
+ @Override
+ public void render(float delta) {
+ mMenuProc.render(delta);
+ }
+
+ @Override
+ public void resize(int width, int height) {
+
+ }
+
+ @Override
+ public void pause() {
+
+ }
+
+ @Override
+ public void resume() {
+
+ }
+
+ @Override
+ public void hide() {
+
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/submenus/Menu.java b/core/src/ru/deadsoftware/cavedroid/menu/submenus/Menu.java
index 2a89e04608f3064a170bdb69c363a99deb84d23d..9f8df4c25d96d498c6019c1e123ef99a61e05c6e 100644 (file)
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.ArrayMap;
import com.badlogic.gdx.utils.JsonValue;
-import ru.deadsoftware.cavedroid.CaveGame;
-import ru.deadsoftware.cavedroid.game.GameScreen;
+import ru.deadsoftware.cavedroid.MainConfig;
+import ru.deadsoftware.cavedroid.menu.MenuProc;
import ru.deadsoftware.cavedroid.menu.objects.Button;
import ru.deadsoftware.cavedroid.menu.objects.ButtonEventListener;
import ru.deadsoftware.cavedroid.menu.objects.ButtonRenderer;
public abstract class Menu {
- private ButtonRenderer buttonRenderer;
+ protected final MainConfig mMainConfig;
+ protected final MenuProc.Input mMenuInput;
- private float width;
- private float height;
+ private final ButtonRenderer mButtonRenderer;
+
+ private final float mWidth;
+ private final float mHeight;
/**
* {@link ArrayMap} of {@link Button Buttons} of this menu screen
* @param height Viewport height
* @param buttonRenderer {@link ButtonRenderer} that will draw the buttons of this menu
*/
- Menu(float width, float height, ButtonRenderer buttonRenderer) {
- this.width = width;
- this.height = height;
- this.buttonRenderer = buttonRenderer;
+ Menu(float width, float height, ButtonRenderer buttonRenderer, MainConfig mainConfig, MenuProc.Input menuInput) {
+ mWidth = width;
+ mHeight = height;
+ mButtonRenderer = buttonRenderer;
+ mMainConfig = mainConfig;
+ mMenuInput = menuInput;
initButtons();
}
}
HashMap<String, ButtonEventListener> eventListeners = getButtonEventListeners();
JsonValue json = Assets.jsonReader.parse(jsonFile);
- int y = (int) height / 4;
+ int y = (int) mHeight / 4;
for (JsonValue key = json.child(); key != null; key = key.next(), y += Button.HEIGHT + 10) {
buttons.put(key.name(),
new Button(Assets.getStringFromJson(key, "label", ""),
- (int) width / 2 - Button.WIDTH / 2,
+ (int) mWidth / 2 - Button.WIDTH / 2,
Assets.getIntFromJson(key, "y", y),
Assets.getIntFromJson(key, "type", Button.NORMAL),
eventListeners.containsKey(key.name()) ? eventListeners.get(key.name()) : () -> {
TextureRegion background = Assets.textureRegions.get("background");
TextureRegion gamelogo = Assets.textureRegions.get("gamelogo");
- for (int x = 0; x <= width / 16; x++) {
- for (int y = 0; y <= height / 16; y++) {
+ for (int x = 0; x <= mWidth / 16; x++) {
+ for (int y = 0; y <= mHeight / 16; y++) {
spriter.draw(background, x * 16, y * 16);
}
}
- spriter.draw(gamelogo, width / 2 - (float) gamelogo.getRegionWidth() / 2, 8);
+ spriter.draw(gamelogo, mWidth / 2 - (float) gamelogo.getRegionWidth() / 2, 8);
- float inputX = Gdx.input.getX() * width / Gdx.graphics.getWidth();
- float inputY = Gdx.input.getY() * height / Gdx.graphics.getHeight();
+ float inputX = Gdx.input.getX() * mWidth / Gdx.graphics.getWidth();
+ float inputY = Gdx.input.getY() * mHeight / Gdx.graphics.getHeight();
for (Button button : buttons.values()) {
if (button.getType() > 0) {
if (button.getRect().contains(inputX, inputY) && (/*!CaveGame.TOUCH || */Gdx.input.isTouched())) {
button.setType(1);
}
}
- button.draw(buttonRenderer);
+ button.draw(mButtonRenderer);
}
}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/submenus/MenuInput.java b/core/src/ru/deadsoftware/cavedroid/menu/submenus/MenuInput.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package ru.deadsoftware.cavedroid.menu.submenus;
-
-import com.badlogic.gdx.Gdx;
-import ru.deadsoftware.cavedroid.CaveGame;
-import ru.deadsoftware.cavedroid.game.GameSaver;
-import ru.deadsoftware.cavedroid.misc.states.AppState;
-import ru.deadsoftware.cavedroid.misc.states.MenuState;
-
-class MenuInput {
-
- private static void startNewGame(int gameMode) {
-// GP = new GameProc();
-// GP.player.respawn();
-// GameSaver.save(GP);
-// CaveGame.APP_STATE = AppState.LOAD;
- }
-
- static void newGameClicked() {
-// CaveGame.MENU_STATE = MenuState.NEW_GAME;
- }
-
- static void loadGameClicked() {
-// CaveGame.APP_STATE = AppState.LOAD;
-// GP = GameSaver.load();
- }
-
- static void quitClicked() {
- Gdx.app.exit();
- }
-
- static void survivalClicked() {
- startNewGame(0);
- }
-
- static void creativeClicked() {
- startNewGame(1);
- }
-
- static void backClicked() {
-// CaveGame.MENU_STATE = MenuState.MAIN;
- }
-
-}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/submenus/MenuMain.java b/core/src/ru/deadsoftware/cavedroid/menu/submenus/MenuMain.java
index 10db012c8efe278812fd3765f8e9be47acc0a7fe..d2dedd23c351f3fc8e91626375e55a0f3b3fd90d 100644 (file)
package ru.deadsoftware.cavedroid.menu.submenus;
import com.badlogic.gdx.Gdx;
+import ru.deadsoftware.cavedroid.MainConfig;
import ru.deadsoftware.cavedroid.game.GameSaver;
+import ru.deadsoftware.cavedroid.menu.MenuProc;
import ru.deadsoftware.cavedroid.menu.objects.Button;
import ru.deadsoftware.cavedroid.menu.objects.ButtonEventListener;
import ru.deadsoftware.cavedroid.menu.objects.ButtonRenderer;
public class MenuMain extends Menu {
- public MenuMain(float width, float height, ButtonRenderer buttonRenderer) {
- super(width, height, buttonRenderer);
+ public MenuMain(float width, float height, ButtonRenderer buttonRenderer, MainConfig mainConfig, MenuProc.Input menuInput) {
+ super(width, height, buttonRenderer, mainConfig, menuInput);
}
@Override
protected HashMap<String, ButtonEventListener> getButtonEventListeners() {
HashMap<String, ButtonEventListener> map = new HashMap<>();
- map.put("new_game", MenuInput::newGameClicked);
- map.put("load_game", MenuInput::loadGameClicked);
- map.put("quit", MenuInput::quitClicked);
+ map.put("new_game", mMenuInput::newGameClicked);
+ map.put("load_game", mMenuInput::loadGameClicked);
+ map.put("quit", mMenuInput::quitClicked);
return map;
}
@Override
protected void initButtons() {
loadButtonsFromJson(Gdx.files.internal("json/menu_main_buttons.json"));
- if (GameSaver.exists()) {
+ if (GameSaver.exists(mMainConfig)) {
getButtons().get("load_game").setType(Button.NORMAL);
}
}
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/submenus/MenuNewGame.java b/core/src/ru/deadsoftware/cavedroid/menu/submenus/MenuNewGame.java
index 6e6b66656519dff6449b1aaac54ec616c4349d38..2c3b38bee9b041a5ae16fd4e2e5a4d1d707aacad 100644 (file)
package ru.deadsoftware.cavedroid.menu.submenus;
import com.badlogic.gdx.Gdx;
+import ru.deadsoftware.cavedroid.MainConfig;
+import ru.deadsoftware.cavedroid.menu.MenuProc;
import ru.deadsoftware.cavedroid.menu.objects.ButtonEventListener;
import ru.deadsoftware.cavedroid.menu.objects.ButtonRenderer;
public class MenuNewGame extends Menu {
- public MenuNewGame(float width, float height, ButtonRenderer buttonRenderer) {
- super(width, height, buttonRenderer);
+ public MenuNewGame(float width, float height, ButtonRenderer buttonRenderer, MainConfig mainConfig, MenuProc.Input menuInput) {
+ super(width, height, buttonRenderer, mainConfig, menuInput);
}
@Override
protected HashMap<String, ButtonEventListener> getButtonEventListeners() {
HashMap<String, ButtonEventListener> map = new HashMap<>();
- map.put("survival", MenuInput::survivalClicked);
- map.put("creative", MenuInput::creativeClicked);
- map.put("back", MenuInput::backClicked);
+ map.put("survival", mMenuInput::survivalClicked);
+ map.put("creative", mMenuInput::creativeClicked);
+ map.put("back", mMenuInput::backClicked);
return map;
}
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/states/AppState.java b/core/src/ru/deadsoftware/cavedroid/misc/states/AppState.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package ru.deadsoftware.cavedroid.misc.states;
-
-public enum AppState {
- MENU,
- GAME,
- SAVE,
- LOAD
-}
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/states/GameState.java b/core/src/ru/deadsoftware/cavedroid/misc/states/GameState.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package ru.deadsoftware.cavedroid.misc.states;
-
-public enum GameState {
- PLAY,
- CREATIVE_INV,
- PAUSE
-}
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/states/MenuState.java b/core/src/ru/deadsoftware/cavedroid/misc/states/MenuState.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package ru.deadsoftware.cavedroid.misc.states;
-
-public enum MenuState {
- MAIN,
- NEW_GAME,
- LOADING,
- SAVING
-}
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/states/package-info.java b/core/src/ru/deadsoftware/cavedroid/misc/states/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.misc.states;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file