DEADSOFTWARE

Add touch controls
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / Assets.java
index 45634ebfa449f2ed7fd4ec1357570d6f3e3d9562..96dbbdc328e46d8c69ddcdd70493b25fd7440389 100644 (file)
@@ -10,7 +10,7 @@ public class Assets {
     public static final int BLOCK_TEXTURES = 3;
 
     public static Texture charTexture;
-    public static Sprite[] playerSprite = new Sprite[2];
+    public static TextureRegion[] playerSkin = new TextureRegion[2];
 
     public static Sprite shade;
 
@@ -21,12 +21,18 @@ public class Assets {
     public static TextureRegion invBar;
     public static TextureRegion invCur;
 
+    public static Texture touchGui;
+    public static TextureRegion[] touchArrows = new TextureRegion[4];
+    public static TextureRegion touchLMB, touchRMB;
+    public static TextureRegion touchToggleMode;
+    public static TextureRegion touchSpace;
+
     public static void load() {
         charTexture = new Texture(Gdx.files.internal("char.png"));
-        playerSprite[0] = new Sprite(new TextureRegion(charTexture, 0,0,8,30));
-        playerSprite[0].flip(false,true);
-        playerSprite[1] = new Sprite(new TextureRegion(charTexture, 8,0,8,30));
-        playerSprite[1].flip(false,true);
+        playerSkin[0] = new TextureRegion(charTexture, 0,0,8,30);
+        playerSkin[0].flip(false,true);
+        playerSkin[1] = new TextureRegion(charTexture, 8,0,8,30);
+        playerSkin[1].flip(false,true);
 
         shade = new Sprite(new Texture(Gdx.files.internal("shade.png")));
 
@@ -34,6 +40,20 @@ public class Assets {
         invBar = new TextureRegion(gui,0,0,182,22);
         invCur = new TextureRegion(gui,0,22,24,24);
 
+        touchGui = new Texture(Gdx.files.internal("touch_gui.png"));
+        for (int i=0; i<4; i++) {
+            touchArrows[i] = new TextureRegion(touchGui, i*26, 0, 26,26);
+            touchArrows[i].flip(false, true);
+        }
+        touchLMB = new TextureRegion(touchGui, 0, 26, 26,26);
+        touchLMB.flip(false, true);
+        touchRMB = new TextureRegion(touchGui, 52, 26, 26,26);
+        touchRMB.flip(false, true);
+        touchToggleMode = new TextureRegion(touchGui, 26, 26, 26, 26);
+        touchToggleMode.flip(false, true);
+        touchSpace = new TextureRegion(touchGui, 0, 52, 104, 26);
+        touchSpace.flip(false, true);
+
         terrain = new Texture(Gdx.files.internal("terrain.png"));
         for (int i=0; i<BLOCK_TEXTURES; i++) {
             blockTextures[i] = new TextureRegion(terrain,