summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 79cde6c)
raw | patch | inline | side by side (parent: 79cde6c)
author | fred-boy <fred-boy@protonmail.com> | |
Tue, 24 Apr 2018 10:48:56 +0000 (17:48 +0700) | ||
committer | fred-boy <fred-boy@protonmail.com> | |
Tue, 24 Apr 2018 10:48:56 +0000 (17:48 +0700) |
diff --git a/core/src/ru/deadsoftware/cavecraft/GameState.java b/core/src/ru/deadsoftware/cavecraft/AppState.java
similarity index 64%
rename from core/src/ru/deadsoftware/cavecraft/GameState.java
rename to core/src/ru/deadsoftware/cavecraft/AppState.java
index 8f110642fc404386ff51b978678f684f67cef300..e38e701ff2999a032cf101d8c82dad1dce11bcaa 100644 (file)
rename from core/src/ru/deadsoftware/cavecraft/GameState.java
rename to core/src/ru/deadsoftware/cavecraft/AppState.java
index 8f110642fc404386ff51b978678f684f67cef300..e38e701ff2999a032cf101d8c82dad1dce11bcaa 100644 (file)
package ru.deadsoftware.cavecraft;
-public enum GameState {
- RESTART,
+public enum AppState {
+ GOTO_GAME,
GOTO_MENU,
+
MENU_MAIN,
+ MENU_GENWORLD,
+
GAME_PLAY,
GAME_CREATIVE_INV
}
diff --git a/core/src/ru/deadsoftware/cavecraft/CaveGame.java b/core/src/ru/deadsoftware/cavecraft/CaveGame.java
index 31b763a3e7106d87c1fe26abc0686f6487c51b11..72481c2b66a695af66746f944bf5440379b164a9 100644 (file)
public static final String VERSION = "alpha 0.3-dev";
public static String GAME_FOLDER;
- public static GameState STATE;
+ public static AppState STATE;
public static boolean TOUCH;
public CaveGame(boolean touch) {
TOUCH = touch;
- STATE = GameState.MENU_MAIN;
+ STATE = AppState.MENU_MAIN;
}
@Override
diff --git a/core/src/ru/deadsoftware/cavecraft/GameScreen.java b/core/src/ru/deadsoftware/cavecraft/GameScreen.java
index 52c3dcf5c8f2dbf1cedd7952d97fefe8a2648e82..1c6ad795349289701f3a2bfaeb29503a799f0fba 100644 (file)
menu();
break;
- case RESTART:
+ case GOTO_GAME:
gameProc = new GameProc();
renderer = gameProc.renderer;
Gdx.input.setInputProcessor(new InputHandlerGame(gameProc));
- CaveGame.STATE = GameState.GAME_PLAY;
+ CaveGame.STATE = AppState.GAME_PLAY;
break;
case GOTO_MENU:
renderer = menuRenderer;
Gdx.input.setInputProcessor(new InputHandlerMenu(menuRenderer));
- CaveGame.STATE = GameState.MENU_MAIN;
+ CaveGame.STATE = AppState.MENU_MAIN;
break;
}
renderer.render();
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java
index f05f56376d3524625ef798a10b49b34dcb12651d..10e0e43f0047bad021e6f5b29120b8afc38f6586 100644 (file)
package ru.deadsoftware.cavecraft.game;
-import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.utils.TimeUtils;
import ru.deadsoftware.cavecraft.*;
+import ru.deadsoftware.cavecraft.AppState;
public class GameInput {
break;
case Input.Keys.E:
- if (CaveGame.STATE == GameState.GAME_PLAY) CaveGame.STATE = GameState.GAME_CREATIVE_INV;
- else CaveGame.STATE = GameState.GAME_PLAY;
+ if (CaveGame.STATE == AppState.GAME_PLAY) CaveGame.STATE = AppState.GAME_CREATIVE_INV;
+ else CaveGame.STATE = AppState.GAME_PLAY;
break;
case Input.Keys.N:
- CaveGame.STATE = GameState.RESTART;
+ CaveGame.STATE = AppState.GOTO_GAME;
break;
case Input.Keys.ESCAPE: case Input.Keys.BACK:
- CaveGame.STATE = GameState.GOTO_MENU;
+ CaveGame.STATE = AppState.GOTO_MENU;
break;
}
}
}
public void touchDown(int screenX, int screenY, int button) {
- if (CaveGame.STATE == GameState.GAME_CREATIVE_INV &&
+ if (CaveGame.STATE == AppState.GAME_CREATIVE_INV &&
screenX>gameProc.renderer.camera.viewportWidth/2-Assets.creativeInv.getRegionWidth()/2 &&
screenX<gameProc.renderer.camera.viewportWidth/2+Assets.creativeInv.getRegionWidth()/2 &&
screenY>gameProc.renderer.camera.viewportHeight/2-Assets.creativeInv.getRegionHeight()/2 &&
}
gameProc.player.inventory[0] = item;
}
- } else if (CaveGame.STATE == GameState.GAME_CREATIVE_INV) {
- CaveGame.STATE = GameState.GAME_PLAY;
+ } else if (CaveGame.STATE == AppState.GAME_CREATIVE_INV) {
+ CaveGame.STATE = AppState.GAME_PLAY;
} else {
gameProc.touchDownX = screenX;
gameProc.touchDownY = screenY;
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java
index a4a6c94f698892faf86e7fd98cd3f30a27e7a088..a2107fa956fd9bc0948d2e02fd0f770b511b1183 100644 (file)
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.TimeUtils;
import ru.deadsoftware.cavecraft.*;
+import ru.deadsoftware.cavecraft.AppState;
import ru.deadsoftware.cavecraft.game.mobs.Mob;
import ru.deadsoftware.cavecraft.game.mobs.Pig;
import ru.deadsoftware.cavecraft.game.objects.Player;
touchDownY< Assets.invBar.getRegionHeight() &&
touchDownX>renderer.camera.viewportWidth/2-Assets.invBar.getRegionWidth()/2 &&
touchDownX<renderer.camera.viewportWidth/2+Assets.invBar.getRegionWidth()/2) {
- CaveGame.STATE = GameState.GAME_CREATIVE_INV;
+ CaveGame.STATE = AppState.GAME_CREATIVE_INV;
}
isTouchDown = false;
}
diff --git a/core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java b/core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java
index c8cbc288a252b50adc40841a7761aec2b97deb08..aa2897db09265c1471b64578ba6cf7c4063ee0b7 100644 (file)
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import ru.deadsoftware.cavecraft.*;
+import ru.deadsoftware.cavecraft.AppState;
import ru.deadsoftware.cavecraft.menu.objects.Button;
public class MenuRenderer extends Renderer {
public void buttonClicked(Button button) {
if (button.getLabel().toLowerCase().equals("play")) {
- CaveGame.STATE = GameState.RESTART;
+ CaveGame.STATE = AppState.GOTO_GAME;
} else if (button.getLabel().toLowerCase().equals("quit")) {
Gdx.app.exit();
}