GTGE API

com.golden.gamedev.engine.input
Class AWTInput

java.lang.Object
  extended by com.golden.gamedev.engine.input.AWTInput
All Implemented Interfaces:
BaseInput

public class AWTInput
extends Object
implements BaseInput

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

AWTInput

public AWTInput(Component comp)
Creates new AWT Input from specified component.

Method Detail

createInputListener

protected AWTInput.InputListener createInputListener()
Creates the default input listener of this AWT Input Component.


update

public void update(long elapsedTime)
Description copied from interface: BaseInput
Updates input engine actions, this method need to be called in tight loop.

Specified by:
update in interface BaseInput

refresh

public void refresh()
Description copied from interface: BaseInput
Refresh all input actions to empty.

Specified by:
refresh in interface BaseInput

cleanup

public void cleanup()
Description copied from interface: BaseInput
Releases any system resources hooked by this input engine.

Specified by:
cleanup in interface BaseInput

mouseMove

public void mouseMove(int x,
                      int y)
Description copied from interface: BaseInput
Move the mouse to x, y screen coordinate.

Specified by:
mouseMove in interface BaseInput
Parameters:
x - the x-coordinate of the new mouse location
y - the y-coordinate of the new mouse location

isMouseExists

public boolean isMouseExists()
Description copied from interface: BaseInput
Returns true, if the mouse pointer is in input component area.

Specified by:
isMouseExists in interface BaseInput

getMouseX

public int getMouseX()
Description copied from interface: BaseInput
Returns the mouse x-coordinate.

Specified by:
getMouseX in interface BaseInput

getMouseY

public int getMouseY()
Description copied from interface: BaseInput
Returns the mouse y-coordinate.

Specified by:
getMouseY in interface BaseInput

getMouseDX

public int getMouseDX()
Description copied from interface: BaseInput
Returns the delta of mouse x-coordinate.

Specified by:
getMouseDX in interface BaseInput

getMouseDY

public int getMouseDY()
Description copied from interface: BaseInput
Returns the delta of mouse y-coordinate.

Specified by:
getMouseDY in interface BaseInput

setMouseVisible

public void setMouseVisible(boolean visible)
Description copied from interface: BaseInput
Sets mouse pointer visible status.

Specified by:
setMouseVisible in interface BaseInput
Parameters:
visible - mouse pointer visible status

isMouseVisible

public boolean isMouseVisible()
Description copied from interface: BaseInput
Returns mouse pointer visible status.

Specified by:
isMouseVisible in interface BaseInput

getMouseReleased

public int getMouseReleased()
Description copied from interface: BaseInput
Returns mouse button released or BaseInput.NO_BUTTON if no button is being released.

Specified by:
getMouseReleased in interface BaseInput
See Also:
MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3

isMouseReleased

public boolean isMouseReleased(int button)
Description copied from interface: BaseInput
Returns true if the specified button is being released.

Specified by:
isMouseReleased in interface BaseInput
Parameters:
button - the mouse button to be checked
Returns:
true, if the button is released.
See Also:
MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3

getMousePressed

public int getMousePressed()
Description copied from interface: BaseInput
Returns mouse button pressed or BaseInput.NO_BUTTON if no button is being pressed.

Specified by:
getMousePressed in interface BaseInput
See Also:
MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3

isMousePressed

public boolean isMousePressed(int button)
Description copied from interface: BaseInput
Returns true if the specified button is being pressed.

Specified by:
isMousePressed in interface BaseInput
Parameters:
button - the mouse button to be checked
Returns:
true, if the button is pressed.
See Also:
MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3

getMouseDown

public boolean[] getMouseDown()
Returns boolean (on/off) mapping of pressed mouse button.


isMouseDown

public boolean isMouseDown(int button)
Description copied from interface: BaseInput
Returns true if the specified button is being pressed.

Specified by:
isMouseDown in interface BaseInput
Parameters:
button - the mouse button to be checked
Returns:
true, if the button is being pressed.
See Also:
MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3

getKeyReleased

public int getKeyReleased()
Description copied from interface: BaseInput
Returns key released or BaseInput.NO_KEY if no key is being released.

Specified by:
getKeyReleased in interface BaseInput
See Also:
KeyEvent.VK_1

isKeyReleased

public boolean isKeyReleased(int keyCode)
Description copied from interface: BaseInput
Returns true if the specified key is being released.

Specified by:
isKeyReleased in interface BaseInput
Parameters:
keyCode - the key to be checked
Returns:
true, if the key is released.
See Also:
KeyEvent.VK_1

getKeyPressed

public int getKeyPressed()
Description copied from interface: BaseInput
Returns key pressed or BaseInput.NO_KEY if no key is being pressed.

Specified by:
getKeyPressed in interface BaseInput
See Also:
KeyEvent.VK_1

isKeyPressed

public boolean isKeyPressed(int keyCode)
Description copied from interface: BaseInput
Returns true if the specified key is being pressed.

Specified by:
isKeyPressed in interface BaseInput
Parameters:
keyCode - the key to be checked
Returns:
true, if the key is pressed.
See Also:
KeyEvent.VK_1

getKeyDown

public boolean[] getKeyDown()
Returns boolean (on/off) mapping of currently pressed key.


isKeyDown

public boolean isKeyDown(int keyCode)
Description copied from interface: BaseInput
Returns true if the specified key is being pressed.

Specified by:
isKeyDown in interface BaseInput
Parameters:
keyCode - the key to be checked
Returns:
true, if the key is being pressed.
See Also:
KeyEvent.VK_1

getComponent

public Component getComponent()
Returns the AWT Component used by this input engine.


GTGE API

Copyright © 2003-2005 Golden T Studios. All rights reserved. Use is subject to license terms.
GoldenStudios.or.id