Path: blob/master/SLICK_HOME/src/org/newdawn/slick/command/ControllerDirectionControl.java
1456 views
package org.newdawn.slick.command;12/**3* A control indicating that a particular direction must be pressed or released4* on a controller to cause the command to fire5*6* @author kevin7*/8public class ControllerDirectionControl extends ControllerControl {9/** The direction indicating we're waiting for the user to press left */10public static final Direction LEFT = new Direction(LEFT_EVENT);11/** The direction indicating we're waiting for the user to press up */12public static final Direction UP = new Direction(UP_EVENT);13/** The direction indicating we're waiting for the user to press down */14public static final Direction DOWN = new Direction(DOWN_EVENT);15/** The direction indicating we're waiting for the user to press right */16public static final Direction RIGHT = new Direction(RIGHT_EVENT);1718/**19* Create a new input that indicates a direcitonal control must be pressed20*21* @param controllerIndex The index of the controller to listen to22* @param dir The direction to wait for23*/24public ControllerDirectionControl(int controllerIndex, Direction dir) {25super(controllerIndex, dir.event, 0);26}2728/**29* Enum pretender30*31* @author kevin32*/33private static class Direction {34/** The event to be fired for this direction */35private int event;3637/**38* Create a new direction indicator/enum value39*40* @param event The event to fire when this direction is used41*/42public Direction(int event) {43this.event = event;44}45}46}474849