Package de.gurkenlabs.litiengine.gui
Class MouseDrawComponent
java.lang.Object
de.gurkenlabs.litiengine.gui.GuiComponent
de.gurkenlabs.litiengine.gui.ImageComponent
de.gurkenlabs.litiengine.gui.MouseDrawComponent
- All Implemented Interfaces:
IRenderable
,Tweenable
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.event.MouseWheelListener
,java.util.EventListener
public class MouseDrawComponent
extends ImageComponent
Field Summary
Fields inherited from class de.gurkenlabs.litiengine.gui.ImageComponent
BACKGROUND_DISABLED_INDEX, BACKGROUND_HOVER_INDEX, BACKGROUND_INDEX, BACKGROUND_PRESSED_INDEX
Constructor Summary
Constructors Constructor Description MouseDrawComponent(double x, double y, double width, double height, Spritesheet spritesheet, java.lang.String text, java.awt.Image image)
Method Summary
Modifier and Type Method Description void
clearDrawingSpace()
java.awt.Color
getDrawingColor()
java.awt.image.BufferedImage
getDrawingSpace()
void
mouseDragged(java.awt.event.MouseEvent e)
void
render(java.awt.Graphics2D g)
Renders the visual contents of this instance onto the provided graphics context.void
setBrushSize(double newSize)
void
setDrawingColor(java.awt.Color color)
Methods inherited from class de.gurkenlabs.litiengine.gui.ImageComponent
getBackground, getImage, getImageAlign, getImageScaleMode, getImageValign, getSpritesheet, rescaleImage, setHeight, setImage, setImageAlign, setImageScaleMode, setImageValign, setSpriteSheet, setWidth
Methods inherited from class de.gurkenlabs.litiengine.gui.GuiComponent
drawTextShadow, getAppearance, getAppearanceDisabled, getAppearanceHovered, getBoundingBox, getClickConsumer, getComponentId, getComponents, getCurrentAppearance, getFont, getHeight, getHoverConsumer, getHoverSound, getLocation, getMouseDraggedConsumer, getMouseEnterConsumer, getMouseLeaveConsumer, getMouseMovedConsumer, getMousePressedConsumer, getMouseReleasedConsumer, getMouseWheelConsumer, getName, getShape, getTag, getText, getTextAlign, getTextAngle, getTextShadowColor, getTextShadowStroke, getTextToRender, getTextValign, getTextX, getTextY, getTweenValues, getWidth, getX, getY, hasAutomaticLineBreaks, hasTextAntialiasing, initializeComponents, isEnabled, isForwardMouseEvents, isHovered, isPressed, isSelected, isSuspended, isVisible, mouseClicked, mouseEntered, mouseEventShouldBeForwarded, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, onClicked, onHovered, onMouseDragged, onMouseEnter, onMouseLeave, onMouseMoved, onMousePressed, onMouseReleased, onMouseWheelScrolled, onTextChanged, prepare, setAutomaticLineBreaks, setDimension, setEnabled, setFont, setFontSize, setForwardMouseEvents, setHovered, setHoverSound, setLocation, setLocation, setName, setSelected, setTag, setText, setTextAlign, setTextAngle, setTextAntialiasing, setTextShadow, setTextShadowColor, setTextShadowStroke, setTextValign, setTextX, setTextY, setTweenValues, setVisible, setX, setY, suspend, toggleSelection, toggleSuspension
Constructor Details
MouseDrawComponent
public MouseDrawComponent(double x, double y, double width, double height, Spritesheet spritesheet, java.lang.String text, java.awt.Image image)
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
- Overrides:
render
in classImageComponent
- 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)
setBrushSize
public void setBrushSize(double newSize)getDrawingColor
public java.awt.Color getDrawingColor()setDrawingColor
public void setDrawingColor(java.awt.Color color)mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
- Overrides:
mouseDragged
in classGuiComponent
clearDrawingSpace
public void clearDrawingSpace()getDrawingSpace
public java.awt.image.BufferedImage getDrawingSpace()