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
;
18 public boolean keyDown(int keycode
) {
23 public boolean keyUp(int keycode
) {
28 public boolean keyTyped(char character
) {
33 public boolean touchDown(int screenX
, int screenY
, int pointer
, int mb
) {
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
) {
43 for (Button button
: menuRenderer
.menuMainBtns
) {
44 if (button
.getRect().contains(screenX
, screenY
) && button
.getType() > 0) {
45 menuRenderer
.buttonClicked(button
);
51 for (Button button
: menuRenderer
.menuNGBtns
) {
52 if (button
.getRect().contains(screenX
, screenY
) && button
.getType() > 0) {
53 menuRenderer
.buttonClicked(button
);
63 public boolean touchDragged(int screenX
, int screenY
, int pointer
) {
68 public boolean mouseMoved(int screenX
, int screenY
) {
73 public boolean scrolled(int amount
) {