DEADSOFTWARE

Fix json load
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / misc / InputHandlerMenu.java
1 package ru.deadsoftware.cavedroid.misc;
3 import com.badlogic.gdx.InputProcessor;
4 import ru.deadsoftware.cavedroid.CaveGame;
5 import ru.deadsoftware.cavedroid.GameScreen;
6 import ru.deadsoftware.cavedroid.menu.MenuRenderer;
7 import ru.deadsoftware.cavedroid.menu.objects.Button;
9 public class InputHandlerMenu implements InputProcessor {
11 private MenuRenderer menuRenderer;
13 public InputHandlerMenu(MenuRenderer menuRenderer) {
14 this.menuRenderer = menuRenderer;
15 }
17 @Override
18 public boolean keyDown(int keycode) {
19 return false;
20 }
22 @Override
23 public boolean keyUp(int keycode) {
24 return false;
25 }
27 @Override
28 public boolean keyTyped(char character) {
29 return false;
30 }
32 @Override
33 public boolean touchDown(int screenX, int screenY, int pointer, int mb) {
34 return false;
35 }
37 @Override
38 public boolean touchUp(int screenX, int screenY, int pointer, int mb) {
39 screenX *= menuRenderer.getWidth() / GameScreen.getWidth();
40 screenY *= menuRenderer.getHeight() / GameScreen.getHeight();
41 switch (CaveGame.STATE) {
42 case MENU_MAIN:
43 for (Button button : menuRenderer.menuMainBtns) {
44 if (button.getRect().contains(screenX, screenY) && button.getType() > 0) {
45 menuRenderer.buttonClicked(button);
46 break;
47 }
48 }
49 break;
50 case MENU_NEW_GAME:
51 for (Button button : menuRenderer.menuNGBtns) {
52 if (button.getRect().contains(screenX, screenY) && button.getType() > 0) {
53 menuRenderer.buttonClicked(button);
54 break;
55 }
56 }
57 break;
58 }
59 return false;
60 }
62 @Override
63 public boolean touchDragged(int screenX, int screenY, int pointer) {
64 return false;
65 }
67 @Override
68 public boolean mouseMoved(int screenX, int screenY) {
69 return false;
70 }
72 @Override
73 public boolean scrolled(int amount) {
74 return false;
75 }
77 }