Class GDXGraphics
java.lang.Object
nl.colorize.multimedialib.renderer.libgdx.GDXGraphics
- All Implemented Interfaces:
StageVisitor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
dispose()
void
drawBackground
(ColorRGB backgroundColor) void
drawCircle
(Primitive graphic, Circle circle) void
Draws a line using libGDX'sShapeBatch
.void
drawPolygon
(Primitive graphic, Polygon polygon) void
void
drawSegmentedLine
(Primitive graphic, SegmentedLine line) void
drawSprite
(Sprite sprite) void
void
prepareStage
(Stage stage) Prepares visiting the stage.void
protected void
boolean
Indicates whether this visitor should visit all graphics, or only graphics that are currently visible.protected void
switchMode
(boolean sprites, boolean shapes) Switches graphics modes.float
toScreenY
(float y) void
visitContainer
(Container container) Visits a container.
-
Constructor Details
-
GDXGraphics
-
-
Method Details
-
restartBatch
protected void restartBatch() -
prepareStage
Description copied from interface:StageVisitor
Prepares visiting the stage. This method is called before any of the stage's graphics are visited. It can be used to add initialization logic that should be performed before any graphics can be drawn.- Specified by:
prepareStage
in interfaceStageVisitor
-
shouldVisitAllGraphics
public boolean shouldVisitAllGraphics()Description copied from interface:StageVisitor
Indicates whether this visitor should visit all graphics, or only graphics that are currently visible.- Specified by:
shouldVisitAllGraphics
in interfaceStageVisitor
-
visitContainer
Description copied from interface:StageVisitor
Visits a container. This method does not actually need to draw the container's graphics, since the correspondingdrawX
methods will be called for all the container's children. This method will be called before the container's children are visited. It can be used to handle logic related to the container itself, for example to process children that were added or removed since the last frame update.- Specified by:
visitContainer
in interfaceStageVisitor
-
drawBackground
- Specified by:
drawBackground
in interfaceStageVisitor
-
drawLine
Draws a line using libGDX'sShapeBatch
. Drawing lines will always trigger a mode switch, as "line mode" and "fill mode" are separate and lines are the only shape without a fill.- Specified by:
drawLine
in interfaceStageVisitor
-
drawSegmentedLine
- Specified by:
drawSegmentedLine
in interfaceStageVisitor
-
drawRect
- Specified by:
drawRect
in interfaceStageVisitor
-
drawCircle
- Specified by:
drawCircle
in interfaceStageVisitor
-
drawPolygon
- Specified by:
drawPolygon
in interfaceStageVisitor
-
drawSprite
- Specified by:
drawSprite
in interfaceStageVisitor
-
drawText
- Specified by:
drawText
in interfaceStageVisitor
-
toScreenY
public float toScreenY(float y) -
switchMode
protected void switchMode(boolean sprites, boolean shapes) Switches graphics modes. libGDX is heavily reliant on performing drawing operations in batch mode. As a consequence, there is a performance penalty when drawing sprites and shapes interchangeably, as this will trigger several mode switches during each frame. -
render3D
-
dispose
protected void dispose()
-