|
GTGE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.golden.gamedev.engine.input.AWTInput
public class AWTInput
Input engine using AWT Component as the input listener.
See BaseInput
for how to use input
engine separated from Golden T Game Engine (GTGE) Frame Work.
Nested Class Summary | |
---|---|
protected class |
AWTInput.InputListener
The real class that listening the AWT Input Event. |
Field Summary |
---|
Fields inherited from interface com.golden.gamedev.engine.BaseInput |
---|
NO_BUTTON, NO_KEY |
Constructor Summary | |
---|---|
AWTInput(Component comp)
Creates new AWT Input from specified component. |
Method Summary | |
---|---|
void |
cleanup()
Releases any system resources hooked by this input engine. |
protected AWTInput.InputListener |
createInputListener()
Creates the default input listener of this AWT Input Component. |
Component |
getComponent()
Returns the AWT Component used by this input engine. |
boolean[] |
getKeyDown()
Returns boolean (on/off) mapping of currently pressed key. |
int |
getKeyPressed()
Returns key pressed or BaseInput.NO_KEY if no key is being pressed. |
int |
getKeyReleased()
Returns key released or BaseInput.NO_KEY if no key is being released. |
boolean[] |
getMouseDown()
Returns boolean (on/off) mapping of pressed mouse button. |
int |
getMouseDX()
Returns the delta of mouse x -coordinate. |
int |
getMouseDY()
Returns the delta of mouse y -coordinate. |
int |
getMousePressed()
Returns mouse button pressed or BaseInput.NO_BUTTON if no button is being
pressed. |
int |
getMouseReleased()
Returns mouse button released or BaseInput.NO_BUTTON if no button is being
released. |
int |
getMouseX()
Returns the mouse x -coordinate. |
int |
getMouseY()
Returns the mouse y -coordinate. |
boolean |
isKeyDown(int keyCode)
Returns true if the specified key is being pressed. |
boolean |
isKeyPressed(int keyCode)
Returns true if the specified key is being pressed. |
boolean |
isKeyReleased(int keyCode)
Returns true if the specified key is being released. |
boolean |
isMouseDown(int button)
Returns true if the specified button is being pressed. |
boolean |
isMouseExists()
Returns true, if the mouse pointer is in input component area. |
boolean |
isMousePressed(int button)
Returns true if the specified button is being pressed. |
boolean |
isMouseReleased(int button)
Returns true if the specified button is being released. |
boolean |
isMouseVisible()
Returns mouse pointer visible status. |
void |
mouseMove(int x,
int y)
Move the mouse to x , y screen coordinate. |
void |
refresh()
Refresh all input actions to empty. |
void |
setMouseVisible(boolean visible)
Sets mouse pointer visible status. |
void |
update(long elapsedTime)
Updates input engine actions, this method need to be called in tight loop. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AWTInput(Component comp)
Method Detail |
---|
protected AWTInput.InputListener createInputListener()
public void update(long elapsedTime)
BaseInput
update
in interface BaseInput
public void refresh()
BaseInput
refresh
in interface BaseInput
public void cleanup()
BaseInput
cleanup
in interface BaseInput
public void mouseMove(int x, int y)
BaseInput
x
, y
screen coordinate.
mouseMove
in interface BaseInput
x
- the x
-coordinate of the new mouse locationy
- the y
-coordinate of the new mouse locationpublic boolean isMouseExists()
BaseInput
isMouseExists
in interface BaseInput
public int getMouseX()
BaseInput
x
-coordinate.
getMouseX
in interface BaseInput
public int getMouseY()
BaseInput
y
-coordinate.
getMouseY
in interface BaseInput
public int getMouseDX()
BaseInput
x
-coordinate.
getMouseDX
in interface BaseInput
public int getMouseDY()
BaseInput
y
-coordinate.
getMouseDY
in interface BaseInput
public void setMouseVisible(boolean visible)
BaseInput
setMouseVisible
in interface BaseInput
visible
- mouse pointer visible statuspublic boolean isMouseVisible()
BaseInput
isMouseVisible
in interface BaseInput
public int getMouseReleased()
BaseInput
BaseInput.NO_BUTTON
if no button is being
released.
getMouseReleased
in interface BaseInput
MouseEvent.BUTTON1
,
MouseEvent.BUTTON2
,
MouseEvent.BUTTON3
public boolean isMouseReleased(int button)
BaseInput
isMouseReleased
in interface BaseInput
button
- the mouse button to be checked
MouseEvent.BUTTON1
,
MouseEvent.BUTTON2
,
MouseEvent.BUTTON3
public int getMousePressed()
BaseInput
BaseInput.NO_BUTTON
if no button is being
pressed.
getMousePressed
in interface BaseInput
MouseEvent.BUTTON1
,
MouseEvent.BUTTON2
,
MouseEvent.BUTTON3
public boolean isMousePressed(int button)
BaseInput
isMousePressed
in interface BaseInput
button
- the mouse button to be checked
MouseEvent.BUTTON1
,
MouseEvent.BUTTON2
,
MouseEvent.BUTTON3
public boolean[] getMouseDown()
public boolean isMouseDown(int button)
BaseInput
isMouseDown
in interface BaseInput
button
- the mouse button to be checked
MouseEvent.BUTTON1
,
MouseEvent.BUTTON2
,
MouseEvent.BUTTON3
public int getKeyReleased()
BaseInput
BaseInput.NO_KEY
if no key is being released.
getKeyReleased
in interface BaseInput
KeyEvent.VK_1
public boolean isKeyReleased(int keyCode)
BaseInput
isKeyReleased
in interface BaseInput
keyCode
- the key to be checked
KeyEvent.VK_1
public int getKeyPressed()
BaseInput
BaseInput.NO_KEY
if no key is being pressed.
getKeyPressed
in interface BaseInput
KeyEvent.VK_1
public boolean isKeyPressed(int keyCode)
BaseInput
isKeyPressed
in interface BaseInput
keyCode
- the key to be checked
KeyEvent.VK_1
public boolean[] getKeyDown()
public boolean isKeyDown(int keyCode)
BaseInput
isKeyDown
in interface BaseInput
keyCode
- the key to be checked
KeyEvent.VK_1
public Component getComponent()
|
GTGE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |