org.deken.game.input
Class InputMouseAction

java.lang.Object
  extended by org.deken.game.input.Action
      extended by org.deken.game.input.InputMouseAction

public class InputMouseAction
extends Action

Title: InputMouseAction

Description: InputAction stores the value of an input from the mouse and the list of InputListeners that want to be notified when the input action occurs. Actions are identified by the InputMonitor.Mouse enum.

Copyright: Copyright (c) 2006

Version:
1.0
Author:
Gary Deken

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deken.game.input.Action
Action.Behavior, Action.State
 
Field Summary
 
Fields inherited from class org.deken.game.input.Action
amount, behavior, consumed, id, state
 
Constructor Summary
InputMouseAction(InputMonitor.Mouse mouseID, Action.Behavior behavior)
           
 
Method Summary
 void activate()
          This signals that the key was pressed, or that the mouse event occurred.
 void activate(int amount)
          This is not used for InputMouseAction.
 boolean add(InputMouseListener listener)
          Over-rides the add() in InputAction, to take an InputMouseListener.
 boolean contains(InputMouseListener listener)
           
 void deactivate()
          This signals that the input has ceased to be pressed or mouse stopped moving.
 int getAmountX()
          Returns the amount changed, since last update.
 int getAmountY()
          Returns the amount changed, since last update.
 InputMonitor.Mouse getMouseID()
           
 java.lang.String getName()
          Returns the name of the InputMouseAction based on the InputMonitor.Mouse name.
 int getXPosition()
           
 int getYPosition()
           
 boolean isEqual(InputMonitor.Mouse mouse)
           
 boolean isMovement()
          Returns if this InputMouseAction is for any type of movement of the Mouse, excluding wheel movement and button clicks.
protected  void notifyListeners()
          Over-ride the notifyListeners from InputAction.
 boolean remove(InputMouseListener listener)
          Removes the InputListener passed in from this InputAction.
 void reset()
          Resets this InputAction to an un-active state.
 void setXPosition(int xPosition)
           
 void setYPosition(int yPosition)
           
 
Methods inherited from class org.deken.game.input.Action
consumed, getId, isActive, isConsumed, setId, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InputMouseAction

public InputMouseAction(InputMonitor.Mouse mouseID,
                        Action.Behavior behavior)
Parameters:
mouseID - InputMonitor.Mouse
behavior - int
Method Detail

activate

public void activate(int amount)
This is not used for InputMouseAction. Use Activate, with will calculate the x and y amounts from last firing.

Parameters:
amount - int

activate

public void activate()
This signals that the key was pressed, or that the mouse event occurred.

Specified by:
activate in class Action

add

public boolean add(InputMouseListener listener)
Over-rides the add() in InputAction, to take an InputMouseListener.

Parameters:
listener - InputMouseListener
Returns:
boolean

contains

public boolean contains(InputMouseListener listener)

deactivate

public void deactivate()
This signals that the input has ceased to be pressed or mouse stopped moving.

Specified by:
deactivate in class Action

getAmountX

public int getAmountX()
Returns the amount changed, since last update.

Returns:
int

getAmountY

public int getAmountY()
Returns the amount changed, since last update.

Returns:
int

getName

public java.lang.String getName()
Returns the name of the InputMouseAction based on the InputMonitor.Mouse name.

Returns:
String

getMouseID

public InputMonitor.Mouse getMouseID()

getXPosition

public int getXPosition()
Returns:
int

getYPosition

public int getYPosition()
Returns:
int

isEqual

public boolean isEqual(InputMonitor.Mouse mouse)

isMovement

public boolean isMovement()
Returns if this InputMouseAction is for any type of movement of the Mouse, excluding wheel movement and button clicks.

Returns:
boolean

remove

public boolean remove(InputMouseListener listener)
Removes the InputListener passed in from this InputAction. It returns true if it was successfully removed.

Parameters:
listener - InputMouseListener
Returns:
boolean

reset

public void reset()
Resets this InputAction to an un-active state.


setXPosition

public void setXPosition(int xPosition)
Parameters:
xPosition - int

setYPosition

public void setYPosition(int yPosition)
Parameters:
yPosition - int

notifyListeners

protected void notifyListeners()
Over-ride the notifyListeners from InputAction. This loops through the listeners, and determines if the listener has been clicked. If it has, the listener is notified.

Specified by:
notifyListeners in class Action