sdljava.joystick

Class HatState

public class HatState extends 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
static MapmodCache
cache of HatState instances, one for each possible mods values
intstate
static intSDL_HAT_CENTERED
static intSDL_HAT_DOWN
static intSDL_HAT_LEFT
static intSDL_HAT_LEFTDOWN
static intSDL_HAT_LEFTUP
static intSDL_HAT_RIGHT
static intSDL_HAT_RIGHTDOWN
static intSDL_HAT_RIGHTUP
static intSDL_HAT_UP
Constructor Summary
HatState(int state)
Method Summary
static HatStateget(int state)
Get the HatState instance identified by state.
booleanhatCentered()
booleanhatDown()
booleanhatLeft()
booleanhatLeftDown()
booleanhatLeftUp()
booleanhatRight()
booleanhatRightDown()
booleanhatRightUp()
booleanhatUp()
StringtoString()
Return a string represenation of this object

Field Detail

modCache

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

state

int state

SDL_HAT_CENTERED

public static final int SDL_HAT_CENTERED

SDL_HAT_DOWN

public static final int SDL_HAT_DOWN

SDL_HAT_LEFT

public static final int SDL_HAT_LEFT

SDL_HAT_LEFTDOWN

public static final int SDL_HAT_LEFTDOWN

SDL_HAT_LEFTUP

public static final int SDL_HAT_LEFTUP

SDL_HAT_RIGHT

public static final int SDL_HAT_RIGHT

SDL_HAT_RIGHTDOWN

public static final int SDL_HAT_RIGHTDOWN

SDL_HAT_RIGHTUP

public static final int SDL_HAT_RIGHTUP

SDL_HAT_UP

public static final int SDL_HAT_UP

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()

hatDown

public boolean hatDown()

hatLeft

public boolean hatLeft()

hatLeftDown

public boolean hatLeftDown()

hatLeftUp

public boolean hatLeftUp()

hatRight

public boolean hatRight()

hatRightDown

public boolean hatRightDown()

hatRightUp

public boolean hatRightUp()

hatUp

public boolean hatUp()

toString

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

Returns: a String represenation of this object