Package com.prineside.tdi2.systems
Class RenderSystem
java.lang.Object
com.prineside.tdi2.Registrable
com.prineside.tdi2.GameSystem
com.prineside.tdi2.systems.RenderSystem
- All Implemented Interfaces:
Disposable
,KryoSerializable
Manages the order of rendering.
Everything, except the UI, is rendered through this system.
Layers are ordered by "z-index", from lowest to the highest (higher z-index is being drawn on top
of a lower ones). Default systems add their (default) layers with z-index specified in
config.GameRenderingOrder.
By default, LayerRenderers will receive an instance of Batch which is already prepared to be
used (batch.begin() already called, color set to WHITE, previous layers are flushed if needed,
projection and transform matrices are reset to camera / zero, blending is enabled and "additive"
color mode is set to the value specified by the layer) and it guarantees that this batch
has not been affected by the previous layers. It is not necessary to use this instance of batch
and it can be completely ignored - batch is there for a convenience, other rendering methods
(ShapeRenderer / PolygonBatch / SpriteCache etc) can be used instead but LayerRenderer must
properly configure them manually (make sure to set a proper color / matrices etc).
Layers can do whatever they need to in their LayerRenderers - for example, switch a shader / end
the batch, use ShapeRenderer instead, start rendering to FrameBuffers (using RenderManager's
methods) etc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionfloat
float
float
float
float
long
Fields inherited from class com.prineside.tdi2.Registrable
S
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLayer
(RenderSystem.Layer layer) Add a layer in place.void
addLayerAfter
(RenderSystem.Layer layer) Add a layer after.void
addLayerBefore
(RenderSystem.Layer layer) Add a layer before.boolean
void
calculateDeltaTimes
(Render event) void
dispose()
Releases all resources of this object.void
drawLayers
(Batch batch) getLayer
(int zIndex) void
prepareBatch
(Batch batch, boolean additive) Does the same as RenderingManager.prepareBatch but also resets projection / transform matrix to the current camera (in case it has been changed)boolean
Should the update() method be rendered on the debug overlayremoveLayer
(RenderSystem.Layer layer) removeLayerByZIndex
(int zIndex) void
setup()
Performs the initial configuration of the system.Methods inherited from class com.prineside.tdi2.GameSystem
getFastStateHash, postSetup, postStateRestore, update
Methods inherited from class com.prineside.tdi2.Registrable
isRegistered, read, setRegistered, setUnregistered, write
-
Field Details
-
gameOverGameSpeed
public float gameOverGameSpeed -
gameOverTimestamp
public long gameOverTimestamp -
gameOverInterpolatedTime
public float gameOverInterpolatedTime -
currentInGameDeltaTime
public float currentInGameDeltaTime -
currentInterpolatedDeltaTime
public float currentInterpolatedDeltaTime -
currentRealDeltaTime
public float currentRealDeltaTime
-
-
Constructor Details
-
RenderSystem
public RenderSystem()
-
-
Method Details
-
setup
public void setup()Description copied from class:GameSystem
Performs the initial configuration of the system. At the moment of call, systemProvider already contains all objects of systems.- Overrides:
setup
in classGameSystem
-
getCamera
-
dispose
public void dispose()Description copied from interface:com.badlogic.gdx.utils.Disposable
Releases all resources of this object.- Specified by:
dispose
in interfaceDisposable
- Overrides:
dispose
in classGameSystem
-
getLayer
-
removeLayerByZIndex
-
removeLayer
-
addLayer
Add a layer in place. If layer with the same Z-index already exists, it will be removed first. -
addLayerAfter
Add a layer after. If layer with the same Z-index already exists, this new layer will be added on the next empty Z-index. Layer's zIndex will be adjusted if needed. -
addLayerBefore
Add a layer before. If layer with the same Z-index already exists, this new layer will be added on the previous empty Z-index. Layer's zIndex will be adjusted if needed. -
calculateDeltaTimes
-
drawLayers
-
prepareBatch
Does the same as RenderingManager.prepareBatch but also resets projection / transform matrix to the current camera (in case it has been changed) -
profileUpdate
public boolean profileUpdate()Description copied from class:GameSystem
Should the update() method be rendered on the debug overlay- Overrides:
profileUpdate
in classGameSystem
-
affectsGameState
public boolean affectsGameState()- Specified by:
affectsGameState
in classGameSystem
-
getSystemName
- Specified by:
getSystemName
in classGameSystem
-