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
;
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
);
49 for (Button button
: menuRenderer
.menuNGBtns
) {
50 if (button
.getRect().contains(screenX
, screenY
) && button
.getType() > 0)
51 menuRenderer
.buttonClicked(button
);
59 public boolean touchDragged(int screenX
, int screenY
, int pointer
) {
64 public boolean mouseMoved(int screenX
, int screenY
) {
69 public boolean scrolled(int amount
) {