GF4J 0.9.4 Beta

gameframe.input
Interface PointerDevice


public interface PointerDevice

This interface is meant for input devices that are pointer or mouse like in their operation. This means that the device has a cursor visible on the screen (is be implemented by the engine implementation if not provided by the OS) and has from one to many buttons.

Since:
GameFrame for Java 0.9
Version:
GameFrame for Java 0.9.4
Author:
Pasi Keränen 16. May 1999

Method Summary
 int getButtonDownCount(int buttonId)
          Returns the number of times the button has been stroken since last reading (after last call made to wasButtonDown or getButtonDownCount methods with the same button id number).
 int getX()
          Returns the X-coordinate of the pointer devices current location.
 int getY()
          Returns the Y-coordinate of the pointer devices current location.
 boolean isButtonDown(int buttonId)
          Returns true if the button is currently down.
 boolean wasButtonDown(int buttonId)
          Returns true if the button was briefly kept down after last reading of the buttons state (after last call made to wasButtonDown or getButtonDownCount methods with the same button id number).
 

Method Detail

getX

public int getX()
Returns the X-coordinate of the pointer devices current location. If the mouse is outside of the screen returns -1.
Returns:
Pointers current X-location or -1 if not on screen.
Since:
GameFrame for Java 0.9

getY

public int getY()
Returns the Y-coordinate of the pointer devices current location. If the mouse is outside of the screen returns -1.
Returns:
Pointers current Y-location or -1 if not on screen.
Since:
GameFrame for Java 0.9

isButtonDown

public boolean isButtonDown(int buttonId)
Returns true if the button is currently down. Id numbers should be 0 = primary button, 1 = secondary or "popup menu" button, 2 etc. for rest of the buttons. Max. 3 buttons are supported (button id's from 0 to 2).
Parameters:
buttonId - The number of the button we want to query.
Returns:
True if the button is or was down.
Since:
GameFrame for Java 0.9

wasButtonDown

public boolean wasButtonDown(int buttonId)
Returns true if the button was briefly kept down after last reading of the buttons state (after last call made to wasButtonDown or getButtonDownCount methods with the same button id number). Id numbers should be 0 = primary button, 1 = secondary or "popup menu" button, 2 etc. for rest of the buttons. Max. 3 buttons are supported (button id's from 0 to 2).
Parameters:
buttonId - The number of the button we want to query.
Returns:
True if the button is or was down.
Since:
GameFrame for Java 0.9

getButtonDownCount

public int getButtonDownCount(int buttonId)
Returns the number of times the button has been stroken since last reading (after last call made to wasButtonDown or getButtonDownCount methods with the same button id number). Id numbers should be 0 = primary button, 1 = secondary or "popup menu" button, 2 = third button. Max. 3 buttons are supported (button id's from 0 to 2).
Parameters:
buttonId - The number of the button we want to query.
Returns:
The number of times the button was stroken (pressed and released)
Since:
GameFrame for Java 0.9

GF4J 0.9.4 Beta