summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 562b0e1)
raw | patch | inline | side by side (parent: 562b0e1)
author | fred-boy <fredboy@protonmail.com> | |
Sat, 28 Sep 2019 16:49:05 +0000 (23:49 +0700) | ||
committer | fred-boy <fredboy@protonmail.com> | |
Sun, 29 Sep 2019 04:39:18 +0000 (11:39 +0700) |
21 files changed:
diff --git a/.gitignore b/.gitignore
index 6d842f29b2c82d13306f047deee24bfcdc2ef30b..ac624d207dbf4971a19c34d50b5b78ea187c9358 100644 (file)
--- a/.gitignore
+++ b/.gitignore
/local.properties
.gradle/
gradle-app.setting
-/build/
-/android/build/
-/core/build/
-/desktop/build/
-/html/build/
-/ios/build/
-/ios-moe/build/
## OS Specific
.DS_Store
index dbde2a40718327bbfcc43230de9efe4d5b6b3e58..014587c25a7fd813dbac633ef4ee3e3563421e4d 100644 (file)
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
- android:theme="@style/GdxTheme" tools:ignore="GoogleAppIndexingWarning">
+ android:theme="@style/GdxTheme" tools:ignore="GoogleAppIndexingWarning"
+ android:fullBackupContent="@xml/backup_descriptor">
<activity
android:name="ru.deadsoftware.cavedroid.AndroidLauncher"
android:label="@string/app_name"
diff --git a/android/res/xml/backup_descriptor.xml b/android/res/xml/backup_descriptor.xml
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<full-backup-content>
+ <!-- Exclude specific shared preferences that contain GCM registration Id -->
+</full-backup-content>
diff --git a/core/src/ru/deadsoftware/cavedroid/GameScreen.java b/core/src/ru/deadsoftware/cavedroid/GameScreen.java
index fc82bf28ca1544a0b30e916c9d5166e946c49341..09604fd4b79bb6a4c1661649513cd72f045ab15b 100644 (file)
private MenuRenderer menuRenderer;
private InputHandlerGame inputHandlerGame;
- private InputHandlerMenu inputHandlerMenu;
+ private final InputHandlerMenu inputHandlerMenu;
public GameScreen() {
Assets.load();
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameFluidsThread.java b/core/src/ru/deadsoftware/cavedroid/game/GameFluidsThread.java
index 57c74700ee0d894c388f62b549a92ef96360cff2..1f0302c93e578dc7ab830446c42f2221f5a428a9 100644 (file)
import static ru.deadsoftware.cavedroid.GameScreen.GP;
import static ru.deadsoftware.cavedroid.game.GameItems.*;
-public class GameFluidsThread extends Thread {
+class GameFluidsThread extends Thread {
private static final int FLUID_UPDATE_INTERVAL_MS = 100;
private static final int FLUID_STATES = 5;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameItems.java b/core/src/ru/deadsoftware/cavedroid/game/GameItems.java
index 82c4b33264acb0942f27968f0e996707328a06d1..9945b06d068e80cd3b78170c187e4c659f06fbb2 100644 (file)
public class GameItems {
- private static HashMap<String, Integer> blocksIds = new HashMap<>();
- private static HashMap<String, Integer> itemsIds = new HashMap<>();
+ private static final HashMap<String, Integer> blocksIds = new HashMap<>();
+ private static final HashMap<String, Integer> itemsIds = new HashMap<>();
- private static ArrayMap<String, Block> blocks = new ArrayMap<>();
- private static ArrayMap<String, Item> items = new ArrayMap<>();
+ private static final ArrayMap<String, Block> blocks = new ArrayMap<>();
+ private static final ArrayMap<String, Item> items = new ArrayMap<>();
static boolean isFluid(int id) {
return getBlock(id).isFluid();
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java b/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java
index 25709bd718aba08ae1a5291c9d16ebddc647aa92..7e12e53d375160d5285427b7985116c174190f5d 100644 (file)
static final int PL_SPEED = 2;
- private Vector2 gravity = new Vector2(0, .9f);
+ private final Vector2 gravity = new Vector2(0, .9f);
private boolean checkJump(Rectangle rect, int dir) {
int bl;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameProc.java b/core/src/ru/deadsoftware/cavedroid/game/GameProc.java
index 60be6ebb4d395b1a46ac71b70dc43fad880db34f..245f0dc5d1d322728e6bf1810ea6986a561916ff 100644 (file)
package ru.deadsoftware.cavedroid.game;
-import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Disposable;
import ru.deadsoftware.cavedroid.CaveGame;
import ru.deadsoftware.cavedroid.GameScreen;
transient GamePhysics physics;
public ControlMode controlMode;
- public Player player;
- public ArrayList<Mob> mobs;
- ArrayList<Drop> drops;
+ public final Player player;
+ public final ArrayList<Mob> mobs;
+ final ArrayList<Drop> drops;
public void resetRenderer() {
int scale = CaveGame.TOUCH ? 320 : 480;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java b/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java
index e921b98138ceaabcab6db3d9dff559e4aa9113a0..0c4435045898d292016c756237a3adb758471ecd 100644 (file)
@SuppressWarnings("WeakerAccess")
public class GameWorld {
- private int WIDTH, HEIGHT;
- private int[][] foreMap;
- private int[][] backMap;
+ private final int WIDTH;
+ private final int HEIGHT;
+ private final int[][] foreMap;
+ private final int[][] backMap;
GameWorld(int width, int height) {
WIDTH = width;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/WorldGen.java b/core/src/ru/deadsoftware/cavedroid/game/WorldGen.java
index b6ab59e2f91a20b7d76837509bfd0da49c47e07e..f820190320d4b5bbec7108af4da0f37a03f24813 100644 (file)
import com.badlogic.gdx.math.RandomXS128;
import com.badlogic.gdx.utils.TimeUtils;
-public class WorldGen {
+class WorldGen {
private static RandomXS128 rand;
private static long seed;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java
index bcab5867bc4e8ee9186543eebd206e4733437b86..32c63cc26514d674c777f6f5a777104c68508fe4 100644 (file)
public static final int LEFT = 0;
public static final int RIGHT = 1;
- private float width, height;
+ private final float width;
+ private final float height;
private int dir;
public boolean flyMode;
- public Vector2 pos;
+ public final Vector2 pos;
public Vector2 mov;
private boolean dead;
* @param dir integer representing a direction where 0 is left and 1 is right.
* You should use {@link #LEFT} and {@link #RIGHT} constants
*/
- public Mob(float x, float y, float width, float height, int dir) {
+ protected Mob(float x, float y, float width, float height, int dir) {
pos = new Vector2(x, y);
mov = new Vector2(0, 0);
this.width = width;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/Block.java b/core/src/ru/deadsoftware/cavedroid/game/objects/Block.java
index 8cda832e540a9e307f1ae4d8343cac181b6ee9c5..c99f5055ff4b896c57db62224bb0256337f217a4 100644 (file)
public class Block {
- private int x, y, w, h;
- private int hp;
- private String drop, meta;
- private Sprite tex;
-
- private boolean coll, bg, tp, rb, fluid;
+ private final int x;
+ private final int y;
+ private final int w;
+ private final int h;
+ private final int hp;
+ private final String drop;
+ private final String meta;
+ private final Sprite tex;
+
+ private final boolean coll;
+ private final boolean bg;
+ private final boolean tp;
+ private final boolean rb;
+ private final boolean fluid;
/**
*
diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/Drop.java b/core/src/ru/deadsoftware/cavedroid/game/objects/Drop.java
index 00bc31788784c04135add9840f92336867c82c5d..cda629d963bb8a103105978d7f57f998c7d0c48f 100644 (file)
public class Drop implements Serializable {
- private int id;
+ private final int id;
public boolean pickedUp = false;
- public Vector2 move, pos;
+ public final Vector2 move;
+ public final Vector2 pos;
public Drop(float x, float y, int id) {
this.id = id;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/Item.java b/core/src/ru/deadsoftware/cavedroid/game/objects/Item.java
index a619a1babfdcfd94e3c76a2fb86261d88f00055d..0083001d05d844a3744146e3e0d0cd544d7c89c8 100644 (file)
public class Item {
- private String name, type;
- private Sprite tex;
+ private final String name;
+ private final String type;
+ private final Sprite tex;
public Item(String name, String type, Sprite tex) {
this.name = name;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/Player.java b/core/src/ru/deadsoftware/cavedroid/game/objects/Player.java
index 1c12f03cc2f23654df8920ef61edfdefb3871bba..11863b7c7122aa794d3d7a2714ce3347e16c79f1 100644 (file)
public class Player extends Mob implements Serializable {
- public int[] inventory;
+ public final int[] inventory;
public int slot;
- public int gameMode;
+ public final int gameMode;
public boolean swim;
public Player(int gameMode) {
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/MenuRenderer.java b/core/src/ru/deadsoftware/cavedroid/menu/MenuRenderer.java
index 74fbf95b1bf924a8106f0c04b910b866426fa855..fe1834d2ede6d4db50fdfb81a6ab8325c225011d 100644 (file)
public class MenuRenderer extends Renderer {
- public Array<Button> menuMainBtns;
- public Array<Button> menuNGBtns;
+ public final Array<Button> menuMainBtns;
+ public final Array<Button> menuNGBtns;
public MenuRenderer(int width) {
super(width, width * GameScreen.getHeight() / GameScreen.getWidth());
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/objects/Button.java b/core/src/ru/deadsoftware/cavedroid/menu/objects/Button.java
index f0da583f5c0e9c0127402e8eb067778b77211337..123b9b55f8ac646f41a15ea31dca430e8b2021fb 100644 (file)
public class Button {
- private Rectangle rect;
- private String label;
+ private final Rectangle rect;
+ private final String label;
private int type;
- public Button(String label, float x, float y, float width, float heigth, int type) {
+ public Button(String label, float x, float y, float width, float height, int type) {
this.label = label;
- rect = new Rectangle(x, y, width, heigth);
+ rect = new Rectangle(x, y, width, height);
this.type = type;
}
- public Button(String label, float x, float y, float width, float heigth) {
- this(label, x, y, width, heigth, 1);
+ public Button(String label, float x, float y, float width, float height) {
+ this(label, x, y, width, height, 1);
}
public Button(String label, float x, float y, int type) {
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/Assets.java b/core/src/ru/deadsoftware/cavedroid/misc/Assets.java
index 778a44d78fcae10d20957c173edd5946a28d8a6a..e2abcdfd61ceb82dfe547dfeffe9a23243f396d0 100644 (file)
public class Assets {
- public static JsonReader jsonReader = new JsonReader();
+ public static final JsonReader jsonReader = new JsonReader();
- private static GlyphLayout glyphLayout = new GlyphLayout();
+ private static final GlyphLayout glyphLayout = new GlyphLayout();
static BitmapFont minecraftFont;
- public static Sprite[][] playerSprite = new Sprite[2][4];
- public static Sprite[][] pigSprite = new Sprite[2][2];
+ public static final Sprite[][] playerSprite = new Sprite[2][4];
+ public static final Sprite[][] pigSprite = new Sprite[2][2];
public static Sprite fallingSandSprite;
public static Sprite fallingGravelSprite;
- public static HashMap<String, TextureRegion> textureRegions = new HashMap<>();
- public static ArrayMap<String, Rectangle> guiMap = new ArrayMap<>();
+ public static final HashMap<String, TextureRegion> textureRegions = new HashMap<>();
+ public static final ArrayMap<String, Rectangle> guiMap = new ArrayMap<>();
private static TextureRegion flippedRegion(Texture texture, int x, int y, int width, int height) {
return new TextureRegion(texture, x, y + height, width, -height);
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/InputHandlerMenu.java b/core/src/ru/deadsoftware/cavedroid/misc/InputHandlerMenu.java
index 5616d7bf4b14dda7771f5f807c6ba65295a24660..b97b5fe4eb46dd6d8d1900a9693eb875205803b0 100644 (file)
public class InputHandlerMenu implements InputProcessor {
- private MenuRenderer menuRenderer;
+ private final MenuRenderer menuRenderer;
public InputHandlerMenu(MenuRenderer menuRenderer) {
this.menuRenderer = menuRenderer;
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/Renderer.java b/core/src/ru/deadsoftware/cavedroid/misc/Renderer.java
index 18e077ac586e31ff158f21b7d6da1e41d7b5022f..4919bc86654461fd27e9e63b9b79a9e592e8dee3 100644 (file)
public abstract class Renderer {
- private OrthographicCamera camera;
+ private final OrthographicCamera camera;
- protected ShapeRenderer shaper;
- protected SpriteBatch spriter;
+ protected final ShapeRenderer shaper;
+ protected final SpriteBatch spriter;
- public Renderer() {
+ protected Renderer() {
this(GameScreen.getWidth(), GameScreen.getHeight());
}
- public Renderer(float width, float height) {
+ protected Renderer(float width, float height) {
camera = new OrthographicCamera();
camera.setToOrtho(true, width, height);
shaper = new ShapeRenderer();
diff --git a/desktop/src/ru/deadsoftware/cavedroid/desktop/DesktopLauncher.java b/desktop/src/ru/deadsoftware/cavedroid/desktop/DesktopLauncher.java
index b3f09bffb5f3affe74de1ba44110366e2a199eb7..4551dce958cbeae0496e7f65636dcbe21d751b8a 100644 (file)
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import ru.deadsoftware.cavedroid.CaveGame;
-public class DesktopLauncher {
+class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.addIcon("icons/icon256.png", Files.FileType.Internal);