|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--InputHandler
InputHandler class for mouse and keyboard input from the user.
Field Summary | |
java.util.Vector |
m_commands
|
double |
maxpower
|
double |
minpower
|
private java.awt.Point |
mousePosition
|
private PlayerCanvas |
p_canvas
|
private double |
power
|
private double |
powerScale
|
boolean |
running
|
private java.awt.Point |
user
|
Constructor Summary | |
InputHandler(PlayerCanvas p)
InputHandler Constructor used for creating mouse and keyboard input handlers for the PlayerCanvas. |
Method Summary | |
private double |
getAngle(int x,
int y)
getAngle method, used for determining the angle at which the point (x,y) is from the centre view of the player. |
private double |
getDistance(int x,
int y)
getDistance method, used to obtain the distance to a point (x,y) from the player. |
void |
keyPressed(java.awt.event.KeyEvent e)
keyPressed event, used for implementing default action when a key is pressed (example - space bar = kick |
void |
keyReleased(java.awt.event.KeyEvent e)
keyReleased event - currently not implemented |
void |
keyTyped(java.awt.event.KeyEvent e)
keyTyped event - currently not implemented |
void |
mouseClicked(java.awt.event.MouseEvent e)
mouseClicked event, used for determining default actions when the mouse buttons are clicked - currently not implemented. |
void |
mouseDragged(java.awt.event.MouseEvent e)
mouseDragged event, used for obtaining the canvas mouse position to where the mouse was dragged. |
void |
mouseEntered(java.awt.event.MouseEvent e)
mouseEntered event - currently not implemented. |
void |
mouseExited(java.awt.event.MouseEvent e)
mouseExited event - currently not implemented. |
void |
mouseMoved(java.awt.event.MouseEvent e)
mouseMoved event, used for obtaining the canvas mouse position to where the mouse was moved. |
void |
mousePressed(java.awt.event.MouseEvent e)
mousePressed event, used for determining the action to take, based on the mouse click. |
void |
mouseReleased(java.awt.event.MouseEvent e)
mouseReleased event, used for determining the current mouse position on the canvas when the mouse button is released. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public java.util.Vector m_commands
private PlayerCanvas p_canvas
private java.awt.Point user
private java.awt.Point mousePosition
public double maxpower
public double minpower
private double powerScale
private double power
public boolean running
Constructor Detail |
public InputHandler(PlayerCanvas p)
p
- PlayerCanvas to be used with input handlingMethod Detail |
private double getDistance(int x, int y)
x
- x-coordinate of the pointy
- y-coordinate of the pointprivate double getAngle(int x, int y)
x
- x-coordinate of the pointy
- y-coordinate of the pointpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- Mouse event which occurred.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
e
- Mouse event which occurred.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
e
- Mouse event which occurred.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- Mouse event which occurred.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
e
- Mouse event which occurred.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
e
- Mouse event which occurred.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
e
- Mouse event which occurred.public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
e
- Key event which occurred.public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
e
- Key event which occurred.public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
e
- Key event which occurred.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |