DEADSOFTWARE

Add inventory bar
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / GameInputHandler.java
index ff8fa2e89438cec46984e53333740fcc9e72521b..d63568cb1dad36a1cfd5bd16d310e6fe43297657 100644 (file)
@@ -54,7 +54,8 @@ public class GameInputHandler {
     public void touchUp(int screenX, int screenY, int button) {
         if (gameProc.isTouchDown) {
             if (button == Input.Buttons.RIGHT){
-                gameProc.world.placeToForeground(gameProc.cursorX, gameProc.cursorY, 1);
+                gameProc.world.placeToForeground(gameProc.cursorX, gameProc.cursorY,
+                        gameProc.player.inventory[gameProc.invSlot]);
             } else if (button == Input.Buttons.LEFT) {
                 if (gameProc.world.getForeMap(gameProc.cursorX, gameProc.cursorY) > 0) {
                     gameProc.world.placeToForeground(gameProc.cursorX, gameProc.cursorY, 0);
@@ -74,4 +75,10 @@ public class GameInputHandler {
         gameProc.isTouchDown = false;*/
     }
 
+    public void scrolled(int amount) {
+        gameProc.invSlot += amount;
+        if (gameProc.invSlot < 0) gameProc.invSlot = 8;
+        if (gameProc.invSlot > 8) gameProc.invSlot = 0;
+    }
+
 }