Java tutorial
/* * Copyright 2013 Adrin Lpez Gonzlez <alg_18_k@hotmail.com> * Julin Surez alfonso <julian_0141@hotmail.com> * * This file is part of GameDefender. * * GameDefender is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GameDefender is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GameDefender. If not, see <http://www.gnu.org/licenses/>. */ package service; import application.abstraction.IScreen; import com.badlogic.gdx.Input; import com.badlogic.gdx.InputProcessor; /** * OnBackPressedInput.java * * @version May 26, 2013 * @author Adrin Lpez Gonzlez * @author Julin Surez alfonso * */ public class OnBackPressedInput implements InputProcessor { private IScreen controller; /** * OnBackPressedInput constructor. * * @param controller * is a controller. */ public OnBackPressedInput(IScreen controller) { this.controller = controller; } @Override public boolean keyDown(int keycode) { if (keycode == Input.Keys.BACK) { controller.onBackPressed(); return true; } return false; } @Override public boolean keyUp(int keycode) { return false; } @Override public boolean keyTyped(char character) { return false; } @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { return false; } @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { return false; } @Override public boolean touchDragged(int screenX, int screenY, int pointer) { return false; } @Override public boolean mouseMoved(int screenX, int screenY) { return false; } @Override public boolean scrolled(int amount) { return false; } }