sdljava.joystick
Class HatState

java.lang.Object
  extended by sdljava.joystick.HatState

public class HatState
extends java.lang.Object

Describe the state of a joystick hat.

Version:
$Id: HatState.java,v 1.4 2005/01/19 03:09:12 ivan_ganza Exp $
Author:
Ivan Z. Ganza

Field Summary
(package private) static java.util.Map modCache
          cache of HatState instances, one for each possible mods values
static int SDL_HAT_CENTERED
           
static int SDL_HAT_DOWN
           
static int SDL_HAT_LEFT
           
static int SDL_HAT_LEFTDOWN
           
static int SDL_HAT_LEFTUP
           
static int SDL_HAT_RIGHT
           
static int SDL_HAT_RIGHTDOWN
           
static int SDL_HAT_RIGHTUP
           
static int SDL_HAT_UP
           
(package private)  int state
           
 
Constructor Summary
HatState(int state)
           
 
Method Summary
static HatState get(int state)
          Get the HatState instance identified by state.
 boolean hatCentered()
           
 boolean hatDown()
           
 boolean hatLeft()
           
 boolean hatLeftDown()
           
 boolean hatLeftUp()
           
 boolean hatRight()
           
 boolean hatRightDown()
           
 boolean hatRightUp()
           
 boolean hatUp()
           
 java.lang.String toString()
          Return a string represenation of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SDL_HAT_CENTERED

public static final int SDL_HAT_CENTERED
See Also:
Constant Field Values

SDL_HAT_UP

public static final int SDL_HAT_UP
See Also:
Constant Field Values

SDL_HAT_RIGHT

public static final int SDL_HAT_RIGHT
See Also:
Constant Field Values

SDL_HAT_DOWN

public static final int SDL_HAT_DOWN
See Also:
Constant Field Values

SDL_HAT_LEFT

public static final int SDL_HAT_LEFT
See Also:
Constant Field Values

SDL_HAT_RIGHTUP

public static final int SDL_HAT_RIGHTUP
See Also:
Constant Field Values

SDL_HAT_RIGHTDOWN

public static final int SDL_HAT_RIGHTDOWN
See Also:
Constant Field Values

SDL_HAT_LEFTUP

public static final int SDL_HAT_LEFTUP
See Also:
Constant Field Values

SDL_HAT_LEFTDOWN

public static final int SDL_HAT_LEFTDOWN
See Also:
Constant Field Values

modCache

static java.util.Map modCache
cache of HatState instances, one for each possible mods values


state

int state
Constructor Detail

HatState

public HatState(int state)
Method Detail

get

public static HatState get(int state)
Get the HatState instance identified by state. This method creates the HatState instance and caches it if it didn't already exist. Once created we won't need to create new HatState object instances each time a keyboard event occurs.

Parameters:
mods - valid key mods (possibly OR'd together)
Returns:
The singleton HatState instance

hatCentered

public boolean hatCentered()

hatUp

public boolean hatUp()

hatRight

public boolean hatRight()

hatDown

public boolean hatDown()

hatLeft

public boolean hatLeft()

hatRightUp

public boolean hatRightUp()

hatRightDown

public boolean hatRightDown()

hatLeftUp

public boolean hatLeftUp()

hatLeftDown

public boolean hatLeftDown()

toString

public java.lang.String toString()
Return a string represenation of this object

Overrides:
toString in class java.lang.Object
Returns:
a String represenation of this object