|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.cult3d.device.MouseDevice
This class provides a way to query information about the mouse cursors position relative the Cult3D Player window and the mouse button states.
Field Summary | |
static Sprite |
DEFAULT_CURSOR
The default mouse cursor. |
static int |
LEFT
Indicates that the left mouse button is pressed. |
static int |
NONE
Indicates that no mouse button is pressed. |
static int |
RIGHT
Indicates that the right button is pressed. |
Constructor Summary | |
MouseDevice()
Constructs an instance of this class. |
Method Summary | |
java.lang.String |
getInfo()
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D. |
int |
getMouseButtonState()
Returns the state of the mouse buttons. |
Node |
getMouseOverNode()
This method checks what node is under the current mouse position and returns the topmost node it finds. |
java.awt.Point |
getMousePosition()
Returns the current coordinate of the mouse relative to the Cult3D Player window. |
int |
getMouseXPosition()
Returns the current x coordinate of the mouse relative to the Cult3D Player window. |
int |
getMouseYPosition()
Returns the current y coordinate of the mouse relative to the Cult3D Player window. |
void |
setCursor(Sprite sprite)
Changes the mouse cursor to the the given Sprite object. |
java.lang.String |
toString()
Returns a string representation of the values of this object. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int NONE
public static final int RIGHT
public static final int LEFT
public static final Sprite DEFAULT_CURSOR
Constructor Detail |
public MouseDevice()
Method Detail |
public void setCursor(Sprite sprite)
To use a custom mouse pointer, first add a new cursor resource in the Cult3D Designer. Then create a new Sprite object by using the static Sprite.getSprite() method and passing it the name of the cursor resource, as defined in the Cult3D Designer. Then pass this Sprite object to this method.
To change back to the system default cursor, use the static DEFAULT_CURSOR member of this class as argument.
sprite
- Sprite to use as cursorSprite
public int getMouseXPosition()
The mouse coordinate is only updated when the mouse is hoovering over the Cult3D Player window, so the x coordinate returned when the mouse cursor is outside the window is undefined. Normally the x value remains as it was when the mouse cursor left the window area. The exception is thrown when the mouse is dragged, i.e. moved with the left mouse button down. Then the mouse cursors position will be updated outside the Cult3D Player window as well.
public int getMouseYPosition()
The mouse coordinate is only updated when the mouse is hoovering over the Cult3D Player window, so the x coordinate returned when the mouse cursor is outside the window is undefined. Normally the x value remains as it was when the mouse cursor left the window area. The exception is when the mouse is dragged, i.e. moved with the left mouse button down. Then the mouse cursors position will be updated outside the Cult3D Player window as well.
public java.awt.Point getMousePosition()
The mouse coordinate is only updated when the mouse is hoovering over the Cult3D Player window, so the coordinate returned when the mouse cursor is outside the window is undefined. Normally the coordinate remains as it was when the mouse cursor left the window area. The exception is when the mouse is dragged, i.e. moved with the left mouse button down. Then the mouse cursors position will be updated outside the Cult3D Player window as well.
public int getMouseButtonState()
public Node getMouseOverNode()
CultWindow.getNodeAtCoordinate(int x, int y)
public java.lang.String getInfo()
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
public java.lang.String toString()
Returns a string representation of the values of this object.
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |