If you think the Android project TileArena listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package game.tile.arena.util.input;
//www.java2s.comimport com.badlogic.gdx.InputProcessor;
import game.tile.arena.Game;
import game.tile.arena.util.Preferences;
publicclass WeaponSwitchInput implements InputProcessor {
@Override
publicboolean keyDown(int keycode) {
if (Preferences.get().TOUCH_CONTROLS)
return false;
if (keycode == Preferences.get().WEAPON_SWITCH) {
Game.player.switchWeapon();
return true;
}
return false;
}
@Override
publicboolean keyUp(int keycode) {
return false;
}
@Override
publicboolean keyTyped(char character) {
return false;
}
@Override
publicboolean touchDown(int screenX, int screenY, int pointer, int button) {
if (Preferences.get().TOUCH_CONTROLS) {
Game.player.switchWeapon();
return true;
}
return false;
}
@Override
publicboolean touchUp(int screenX, int screenY, int pointer, int button) {
return false;
}
@Override
publicboolean touchDragged(int screenX, int screenY, int pointer) {
return false;
}
@Override
publicboolean mouseMoved(int screenX, int screenY) {
return false;
}
@Override
publicboolean scrolled(int amount) {
return false;
}
}