|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.gameEngine.game.GameRelatedObject
vooga.gameEngine.controller.GameRelatedController
vooga.gameEngine.controller.HumanController
public class HumanController
HumanController
is an GameRelatedController
which
manages GameItem
's that are affected by human interaction. As an
GameRelatedController
, it will store these items in a list. When the
user enters in input through some form, this class will update all relevant
items of the change.
Constructor Summary | |
---|---|
HumanController()
Creates a HumanController |
Method Summary | |
---|---|
void |
addKeyboardInput(javax.swing.KeyStroke key,
java.lang.Class<? extends java.util.EventObject> eventClass)
Maps a keyboard key to an event so that pressing that key when the Game window has focus will result in the mapped event being fired to its registered listeners. |
void |
addKeyboardInput(javax.swing.KeyStroke key,
java.lang.Class<? extends java.util.EventObject> eventClass,
java.util.EventListener listener)
Maps a keyboard key to an event and a specific listener so that pressing that key when the Game window has focus will result in the mapped event being fired only to that specific listener. |
void |
addMouseClicked(java.lang.Integer mouseEventID,
java.lang.Class<? extends java.util.EventObject> eventClass)
Maps a MouseEvent key to an event. |
void |
addMouseInput(java.lang.Integer mouseEventID,
java.lang.Class<? extends java.util.EventObject> eventClass)
Maps a MouseEvent to an event. |
void |
addMouseInput(java.lang.Integer mouseEventID,
java.lang.Class<? extends java.util.EventObject> eventClass,
java.util.EventListener listener)
Maps a MouseEvent to an event and a specific listener so that
whenever the MouseEvent is fired, the event it maps to will
be fired to the specific listener. |
void |
addMouseListener(java.awt.event.MouseListener listener)
adds the specified mouse listener to the list of listeners a mouse event will be fired at the listener every time a mouse event would normally be fired by java the mouse event will be changed to the coordinate system used by the game |
void |
disableAllInputListening()
Disables this HumanController from listening to key or mouse
input. |
java.util.Map<javax.swing.KeyStroke,java.lang.Class<? extends java.util.EventObject>> |
getKeyBindings()
Returns all the key bindings that are currently assigned. |
java.util.List<java.util.EventObject> |
getUserInput()
Simple getter method to obtain the events fired by user input. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent arg0)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent arg0)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
pauseInputListening()
Pauses this HumanController from responding to any input that would result in
firing an event that is not a PausableEvent . |
void |
removeAllKeyboardInput()
Resets all keyboard input. |
void |
removeAllKeyboardInput(java.util.Collection<javax.swing.KeyStroke> keys)
Removes the given KeyStroke s from all relevant
Map s. |
void |
removeKeyboardInput(javax.swing.KeyStroke key)
Removes the given KeyStroke from all relevant
Map s. |
void |
removeMouseListener(java.awt.event.MouseListener listener)
|
void |
resumeInputListening()
Allows this HumanController to resume responding to all input. |
void |
setCameraController(CameraController cameraController)
sets the camera controller for updating the mouse position |
void |
setComponent(javax.swing.JComponent component)
Sets the JComponent that this HumanController will
listen to for keyboard and mouse input |
Methods inherited from class vooga.gameEngine.game.GameRelatedObject |
---|
addEventListener, clearListeners, equals, fire, fire, fire, getEventListeners, getID, getListenerCount, removeEventListener |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HumanController()
HumanController
Method Detail |
---|
public void setComponent(javax.swing.JComponent component)
JComponent
that this HumanController
will
listen to for keyboard and mouse input
component
- this HumanController
will listen topublic void setCameraController(CameraController cameraController)
cameraController
- public void addKeyboardInput(javax.swing.KeyStroke key, java.lang.Class<? extends java.util.EventObject> eventClass)
key
- The keyboard key or combination of keys to be mappedeventClass
- The class of the event to be fired when the key parameter is
pressedpublic void addKeyboardInput(javax.swing.KeyStroke key, java.lang.Class<? extends java.util.EventObject> eventClass, java.util.EventListener listener)
key
- The keyboard key or combination of keys to be mappedeventClass
- The class of the event to be fired when the key parameter is
pressedlistener
- The EventListener
that should respond to the
firing of the eventpublic void removeKeyboardInput(javax.swing.KeyStroke key)
KeyStroke
from all relevant
Map
s. Thus, if the given KeyStroke
is pressed,
no action will be taken.
key
- the KeyStroke
to remove functionality frompublic void removeAllKeyboardInput(java.util.Collection<javax.swing.KeyStroke> keys)
KeyStroke
s from all relevant
Map
s. Thus, if any of the given KeyStroke
s are
pressed, no action will be taken.
keys
- the KeyStroke
s to remove functionality frompublic void removeAllKeyboardInput()
removeAllKeyboardInput(Collection)
public void addMouseInput(java.lang.Integer mouseEventID, java.lang.Class<? extends java.util.EventObject> eventClass)
MouseEvent
to an event. This map is then used so that
whenever the MouseEvent
is fired, the event it maps to will
be fired to all registered listeners.
mouseButton
- The MouseEvent
to be mappedeventClass
- The class of the event to be fired when the
MouseEvent
occurspublic void addMouseInput(java.lang.Integer mouseEventID, java.lang.Class<? extends java.util.EventObject> eventClass, java.util.EventListener listener)
MouseEvent
to an event and a specific listener so that
whenever the MouseEvent
is fired, the event it maps to will
be fired to the specific listener.
mouseButton
- The MouseEvent
to be mappedeventClass
- The class of the event to be fired when the
MouseEvent
occurslistener
- The EventListener
that should respond to the
firing of the eventpublic void addMouseListener(java.awt.event.MouseListener listener)
listener
- public void addMouseClicked(java.lang.Integer mouseEventID, java.lang.Class<? extends java.util.EventObject> eventClass)
MouseEvent
key to an event. This method fires only if the
mouse is on an object
mouseInput
- eventClass
- public void removeMouseListener(java.awt.event.MouseListener listener)
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent arg0)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent arg0)
mouseMoved
in interface java.awt.event.MouseMotionListener
public java.util.List<java.util.EventObject> getUserInput()
List
of fired eventspublic void pauseInputListening()
HumanController
from responding to any input that would result in
firing an event that is not a PausableEvent
.
public void resumeInputListening()
HumanController
to resume responding to all input.
public void disableAllInputListening()
HumanController
from listening to key or mouse
input.
public java.util.Map<javax.swing.KeyStroke,java.lang.Class<? extends java.util.EventObject>> getKeyBindings()
Map
of key bindings
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |