summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0d17e8d)
raw | patch | inline | side by side (parent: 0d17e8d)
author | fred-boy <fredboy@protonmail.com> | |
Fri, 27 Sep 2019 11:15:08 +0000 (18:15 +0700) | ||
committer | fred-boy <fredboy@protonmail.com> | |
Sun, 29 Sep 2019 04:39:17 +0000 (11:39 +0700) |
diff --git a/core/src/ru/deadsoftware/cavedroid/GameScreen.java b/core/src/ru/deadsoftware/cavedroid/GameScreen.java
index 759cbc0db800c5e8467ad7b18f59578c34565ed0..4717818a46d3f008f2c8383f20350bcce9ac34b4 100644 (file)
public static int FPS;
public static boolean SHOW_DEBUG = true;
+ public static boolean SHOW_MAP = false;
public static int NEW_GAME_MODE = 0;
public static GameProc GP;
Gdx.input.setInputProcessor(new InputHandlerMenu(menuRenderer));
}
- public static int getWidth() {
+ public static float getWidth() {
return Gdx.graphics.getWidth();
}
- public static int getHeight() {
+ public static float getHeight() {
return Gdx.graphics.getHeight();
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameInput.java b/core/src/ru/deadsoftware/cavedroid/game/GameInput.java
index 50ad5e4bf3b8dc34e7b763e3f79d61e64ee75bf0..85d736dd4cd99c1e21d8b3cf7fa0231b6066aa6c 100644 (file)
case Input.Keys.F1:
GameScreen.SHOW_DEBUG = !GameScreen.SHOW_DEBUG;
break;
+
+ case Input.Keys.M:
+ GameScreen.SHOW_MAP = !GameScreen.SHOW_MAP;
+ break;
}
}
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
index a34f0c871e5ba786f71d25598998cf6de00d5d6d..9e54c9a5a74a54f4932f609124bc89088740acfe 100644 (file)
package ru.deadsoftware.cavedroid.game;
import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import ru.deadsoftware.cavedroid.CaveGame;
for (int y = minY; y < maxY; y++) {
for (int x = minX; x < maxX; x++) {
if ((GP.world.getForeMap(x, y) == 0 || GameItems.getBlock(GP.world.getForeMap(x, y)).isTransparent())
- && GP.world.getBackMap(x, y) > 0) shaper.rect(drawX(x), drawY(y), 16, 16);
+ && GP.world.getBackMap(x, y) > 0)
+ shaper.rect(drawX(x), drawY(y), 16, 16);
}
}
shaper.end();
if (CaveGame.TOUCH) drawTouchGui();
+ spriter.end();
+
+ if(GameScreen.SHOW_MAP) {
+ //DRAW MAP
+ shaper.begin(ShapeRenderer.ShapeType.Filled);
+ shaper.setColor(Color.LIGHT_GRAY);
+ shaper.rect(0, 0, GP.world.getWidth(), 128);
+ for (int y = 128; y < 256; y++) {
+ for (int x = 0; x < getWidth(); x++) {
+ if (GP.world.getForeMap(x, y) > 0 || GP.world.getBackMap(x, y) > 0) {
+ if (GameItems.isWater(GP.world.getForeMap(x, y))) {
+ shaper.setColor(Color.BLUE);
+ } else if (GameItems.isLava(GP.world.getForeMap(x, y))) {
+ shaper.setColor(Color.RED);
+ } else {
+ if (GP.world.getForeMap(x, y) > 0) {
+ shaper.setColor(Color.BLACK);
+ } else {
+ shaper.setColor(Color.DARK_GRAY);
+ }
+ }
+ shaper.rect(x, y - 128, 1, 1);
+ }
+ }
+ }
+ shaper.setColor(Color.OLIVE);
+ shaper.rect(GP.player.pos.x / 16, GP.player.pos.y / 16 - 128, 1, 2);
+ shaper.end();
+ //=================
+ }
+ spriter.begin();
+
if (GameScreen.SHOW_DEBUG) {
drawString("FPS: " + GameScreen.FPS, 0, 0);
drawString("X: " + (int) (GP.player.pos.x / 16), 0, 10);
drawString("Game mode: " + GP.player.gameMode, 0, 80);
}
spriter.end();
+
+
}
}