DEADSOFTWARE

5b4d9ba333fbd7a028604bae57bb8568a47eabdd
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / misc / InputHandlerMenu.java
1 package ru.deadsoftware.cavecraft.misc;
3 import com.badlogic.gdx.InputProcessor;
4 import ru.deadsoftware.cavecraft.CaveGame;
5 import ru.deadsoftware.cavecraft.GameScreen;
6 import ru.deadsoftware.cavecraft.menu.MenuRenderer;
7 import ru.deadsoftware.cavecraft.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 }
47 break;
48 case MENU_NEW_GAME:
49 for (Button button : menuRenderer.menuNGBtns) {
50 if (button.getRect().contains(screenX, screenY) && button.getType() > 0)
51 menuRenderer.buttonClicked(button);
52 }
53 break;
54 }
55 return false;
56 }
58 @Override
59 public boolean touchDragged(int screenX, int screenY, int pointer) {
60 return false;
61 }
63 @Override
64 public boolean mouseMoved(int screenX, int screenY) {
65 return false;
66 }
68 @Override
69 public boolean scrolled(int amount) {
70 return false;
71 }
73 }