Class MouseCursor
java.lang.Object
de.gurkenlabs.litiengine.graphics.MouseCursor
- All Implemented Interfaces:
IRenderable
public final class MouseCursor
extends java.lang.Object
implements IRenderable
The visual representation of the
It controls the appearance of the rendered cursor and allows to specify offsets from the actual mouse location.
Mouse
in the LITIENGINE.It controls the appearance of the rendered cursor and allows to specify offsets from the actual mouse location.
- See Also:
Mouse
Constructor Summary
Constructors Constructor Description MouseCursor()
Initializes a new instance of theMouseCursor
class.Method Summary
Modifier and Type Method Description java.awt.Image
getImage()
int
getOffsetX()
int
getOffsetY()
java.awt.geom.AffineTransform
getTransform()
void
hideDefaultCursor()
boolean
isVisible()
Determines whether the cursor is currently visible (and will thereby be rendered), by checking thevisible
flag and whether the specified cursor image is null.void
render(java.awt.Graphics2D g)
Renders the visual contents of this instance onto the provided graphics context.void
set(java.awt.Image img)
void
set(java.awt.Image img, int offsetX, int offsetY)
void
set(java.awt.Image img, Align hAlign, Valign vAlign)
void
setOffset(int x, int y)
void
setOffsetX(int cursorOffsetX)
void
setOffsetY(int cursorOffsetY)
void
setTransform(java.awt.geom.AffineTransform transform)
void
setVisible(boolean visible)
void
showDefaultCursor()
Constructor Details
MouseCursor
public MouseCursor()Initializes a new instance of theMouseCursor
class.
Method Details
render
public void render(java.awt.Graphics2D g)Description copied from interface:IRenderable
Renders the visual contents of this instance onto the provided graphics context.If an
Entity
implements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.This interface can be implemented in general by anything that should be rendered to the game's screen.
- Specified by:
render
in interfaceIRenderable
- Parameters:
g
- The current graphics object onto which this instance will render its visual contents.- See Also:
RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
getImage
public java.awt.Image getImage()getTransform
public java.awt.geom.AffineTransform getTransform()getOffsetX
public int getOffsetX()getOffsetY
public int getOffsetY()isVisible
public boolean isVisible()Determines whether the cursor is currently visible (and will thereby be rendered), by checking thevisible
flag and whether the specified cursor image is null.- Returns:
- True if the cursor is currently visible; otherwise false.
set
public void set(java.awt.Image img)set
public void set(java.awt.Image img, int offsetX, int offsetY)set
setOffset
public void setOffset(int x, int y)setOffsetX
public void setOffsetX(int cursorOffsetX)setOffsetY
public void setOffsetY(int cursorOffsetY)setTransform
public void setTransform(java.awt.geom.AffineTransform transform)setVisible
public void setVisible(boolean visible)showDefaultCursor
public void showDefaultCursor()hideDefaultCursor
public void hideDefaultCursor()