|
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 BaseInputpublic void refresh()
BaseInput
refresh in interface BaseInputpublic void cleanup()
BaseInput
cleanup in interface BaseInput
public void mouseMove(int x,
int y)
BaseInputx, y screen coordinate.
mouseMove in interface BaseInputx - the x-coordinate of the new mouse locationy - the y-coordinate of the new mouse locationpublic boolean isMouseExists()
BaseInput
isMouseExists in interface BaseInputpublic int getMouseX()
BaseInputx-coordinate.
getMouseX in interface BaseInputpublic int getMouseY()
BaseInputy-coordinate.
getMouseY in interface BaseInputpublic int getMouseDX()
BaseInputx-coordinate.
getMouseDX in interface BaseInputpublic int getMouseDY()
BaseInputy-coordinate.
getMouseDY in interface BaseInputpublic void setMouseVisible(boolean visible)
BaseInput
setMouseVisible in interface BaseInputvisible - mouse pointer visible statuspublic boolean isMouseVisible()
BaseInput
isMouseVisible in interface BaseInputpublic int getMouseReleased()
BaseInputBaseInput.NO_BUTTON if no button is being
released.
getMouseReleased in interface BaseInputMouseEvent.BUTTON1,
MouseEvent.BUTTON2,
MouseEvent.BUTTON3public boolean isMouseReleased(int button)
BaseInput
isMouseReleased in interface BaseInputbutton - the mouse button to be checked
MouseEvent.BUTTON1,
MouseEvent.BUTTON2,
MouseEvent.BUTTON3public int getMousePressed()
BaseInputBaseInput.NO_BUTTON if no button is being
pressed.
getMousePressed in interface BaseInputMouseEvent.BUTTON1,
MouseEvent.BUTTON2,
MouseEvent.BUTTON3public boolean isMousePressed(int button)
BaseInput
isMousePressed in interface BaseInputbutton - the mouse button to be checked
MouseEvent.BUTTON1,
MouseEvent.BUTTON2,
MouseEvent.BUTTON3public boolean[] getMouseDown()
public boolean isMouseDown(int button)
BaseInput
isMouseDown in interface BaseInputbutton - the mouse button to be checked
MouseEvent.BUTTON1,
MouseEvent.BUTTON2,
MouseEvent.BUTTON3public int getKeyReleased()
BaseInputBaseInput.NO_KEY if no key is being released.
getKeyReleased in interface BaseInputKeyEvent.VK_1public boolean isKeyReleased(int keyCode)
BaseInput
isKeyReleased in interface BaseInputkeyCode - the key to be checked
KeyEvent.VK_1public int getKeyPressed()
BaseInputBaseInput.NO_KEY if no key is being pressed.
getKeyPressed in interface BaseInputKeyEvent.VK_1public boolean isKeyPressed(int keyCode)
BaseInput
isKeyPressed in interface BaseInputkeyCode - the key to be checked
KeyEvent.VK_1public boolean[] getKeyDown()
public boolean isKeyDown(int keyCode)
BaseInput
isKeyDown in interface BaseInputkeyCode - the key to be checked
KeyEvent.VK_1public Component getComponent()
|
GTGE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||