replace RenderContext with ViewContext. use registered "services" to hold the renderer objects that used to live in RenderContext
This commit is contained in:
parent
1f4d42ab4c
commit
4b8deb90cb
|
@ -1,16 +1,24 @@
|
||||||
package com.blarg.gdx;
|
package com.blarg.gdx;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.g3d.ModelBatch;
|
||||||
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
import com.badlogic.gdx.utils.TimeUtils;
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
import com.blarg.gdx.events.EventManager;
|
import com.blarg.gdx.events.EventManager;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
import com.blarg.gdx.graphics.*;
|
||||||
import com.blarg.gdx.states.StateManager;
|
import com.blarg.gdx.states.StateManager;
|
||||||
|
|
||||||
public abstract class GameApp implements Disposable {
|
public abstract class GameApp implements Disposable {
|
||||||
public final EventManager eventManager;
|
public final EventManager eventManager;
|
||||||
public final StateManager stateManager;
|
public final StateManager stateManager;
|
||||||
public final RenderContext renderContext;
|
public final ViewportContext viewportContext;
|
||||||
|
public final ExtendedSpriteBatch spriteBatch;
|
||||||
|
public final BillboardSpriteBatch billboardSpriteBatch;
|
||||||
|
public final ModelBatch modelBatch;
|
||||||
|
public final SolidColorTextureCache solidColorTextures;
|
||||||
|
public final DebugGeometryRenderer debugGeometryRenderer;
|
||||||
|
public final ShapeRenderer shapeRenderer;
|
||||||
|
|
||||||
boolean logHeapMemUsage = false;
|
boolean logHeapMemUsage = false;
|
||||||
long lastHeapMemLogTime = 0;
|
long lastHeapMemLogTime = 0;
|
||||||
|
@ -20,7 +28,23 @@ public abstract class GameApp implements Disposable {
|
||||||
|
|
||||||
eventManager = new EventManager();
|
eventManager = new EventManager();
|
||||||
stateManager = new StateManager(this, eventManager);
|
stateManager = new StateManager(this, eventManager);
|
||||||
renderContext = new RenderContext(true);
|
viewportContext = new ViewportContext(true);
|
||||||
|
spriteBatch = new ExtendedSpriteBatch();
|
||||||
|
billboardSpriteBatch = new BillboardSpriteBatch();
|
||||||
|
modelBatch = new ModelBatch();
|
||||||
|
solidColorTextures = new SolidColorTextureCache();
|
||||||
|
debugGeometryRenderer = new DebugGeometryRenderer();
|
||||||
|
shapeRenderer = new ShapeRenderer();
|
||||||
|
|
||||||
|
Services.register(eventManager);
|
||||||
|
Services.register(stateManager);
|
||||||
|
Services.register(viewportContext);
|
||||||
|
Services.register(spriteBatch);
|
||||||
|
Services.register(billboardSpriteBatch);
|
||||||
|
Services.register(modelBatch);
|
||||||
|
Services.register(solidColorTextures);
|
||||||
|
Services.register(debugGeometryRenderer);
|
||||||
|
Services.register(shapeRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void toggleHeapMemUsageLogging(boolean enable) {
|
protected void toggleHeapMemUsageLogging(boolean enable) {
|
||||||
|
@ -33,17 +57,21 @@ public abstract class GameApp implements Disposable {
|
||||||
|
|
||||||
public void onResize(int width, int height) {
|
public void onResize(int width, int height) {
|
||||||
Gdx.app.debug("GameApp", String.format("onResize(%d, %d)", width, height));
|
Gdx.app.debug("GameApp", String.format("onResize(%d, %d)", width, height));
|
||||||
renderContext.onResize(width, height);
|
viewportContext.onResize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(float delta) {
|
public void onRender(float delta) {
|
||||||
renderContext.onPreRender();
|
viewportContext.onPreRender();
|
||||||
stateManager.onRender(delta, renderContext);
|
spriteBatch.setProjectionMatrix(viewportContext.getOrthographicCamera().combined);
|
||||||
renderContext.onPostRender();
|
spriteBatch.setPixelScale(viewportContext.pixelScaler.getScale());
|
||||||
|
|
||||||
|
stateManager.onRender(delta);
|
||||||
|
|
||||||
|
viewportContext.onPostRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(float delta) {
|
public void onUpdate(float delta) {
|
||||||
renderContext.onUpdate(delta);
|
viewportContext.onUpdate(delta);
|
||||||
eventManager.onUpdate(delta);
|
eventManager.onUpdate(delta);
|
||||||
stateManager.onUpdate(delta);
|
stateManager.onUpdate(delta);
|
||||||
if (stateManager.isEmpty()) {
|
if (stateManager.isEmpty()) {
|
||||||
|
@ -64,12 +92,14 @@ public abstract class GameApp implements Disposable {
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
Gdx.app.debug("GameApp", "onPause");
|
Gdx.app.debug("GameApp", "onPause");
|
||||||
stateManager.onAppPause();
|
stateManager.onAppPause();
|
||||||
renderContext.onPause();
|
viewportContext.onPause();
|
||||||
|
solidColorTextures.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
Gdx.app.debug("GameApp", "onResume");
|
Gdx.app.debug("GameApp", "onResume");
|
||||||
renderContext.onResume();
|
viewportContext.onResume();
|
||||||
|
solidColorTextures.onResume();
|
||||||
stateManager.onAppResume();
|
stateManager.onAppResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +107,9 @@ public abstract class GameApp implements Disposable {
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
Gdx.app.debug("GameApp", "dispose");
|
Gdx.app.debug("GameApp", "dispose");
|
||||||
stateManager.dispose();
|
stateManager.dispose();
|
||||||
renderContext.dispose();
|
solidColorTextures.dispose();
|
||||||
|
modelBatch.dispose();
|
||||||
|
billboardSpriteBatch.dispose();
|
||||||
|
spriteBatch.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.badlogic.gdx.utils.Disposable;
|
||||||
import com.blarg.gdx.events.Event;
|
import com.blarg.gdx.events.Event;
|
||||||
import com.blarg.gdx.events.EventHandler;
|
import com.blarg.gdx.events.EventHandler;
|
||||||
import com.blarg.gdx.events.EventManager;
|
import com.blarg.gdx.events.EventManager;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
|
||||||
|
|
||||||
public abstract class ComponentSystem extends EventHandler implements Disposable {
|
public abstract class ComponentSystem extends EventHandler implements Disposable {
|
||||||
public final EntityManager entityManager;
|
public final EntityManager entityManager;
|
||||||
|
@ -26,7 +25,7 @@ public abstract class ComponentSystem extends EventHandler implements Disposable
|
||||||
public void onResize() {
|
public void onResize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(float delta, RenderContext renderContext) {
|
public void onRender(float delta) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(float delta) {
|
public void onUpdate(float delta) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.blarg.gdx.entities.systemcomponents.EntityPresetComponent;
|
||||||
import com.blarg.gdx.entities.systemcomponents.InactiveComponent;
|
import com.blarg.gdx.entities.systemcomponents.InactiveComponent;
|
||||||
import com.blarg.gdx.events.EventManager;
|
import com.blarg.gdx.events.EventManager;
|
||||||
import com.blarg.gdx.ReflectionUtils;
|
import com.blarg.gdx.ReflectionUtils;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
|
||||||
|
|
||||||
public class EntityManager implements Disposable {
|
public class EntityManager implements Disposable {
|
||||||
public final EventManager eventManager;
|
public final EventManager eventManager;
|
||||||
|
@ -293,9 +292,9 @@ public class EntityManager implements Disposable {
|
||||||
componentSystems.get(i).onResize();
|
componentSystems.get(i).onResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(float delta, RenderContext renderContext) {
|
public void onRender(float delta) {
|
||||||
for (int i = 0; i < componentSystems.size; ++i)
|
for (int i = 0; i < componentSystems.size; ++i)
|
||||||
componentSystems.get(i).onRender(delta, renderContext);
|
componentSystems.get(i).onRender(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(float delta) {
|
public void onUpdate(float delta) {
|
||||||
|
|
|
@ -10,61 +10,59 @@ import com.badlogic.gdx.math.Vector3;
|
||||||
public final class GraphicsHelpers {
|
public final class GraphicsHelpers {
|
||||||
final static Matrix4 tmpTransform = new Matrix4();
|
final static Matrix4 tmpTransform = new Matrix4();
|
||||||
|
|
||||||
public static void renderCoordinateSystemAxis(ShapeRenderer shapeRenderer, ExtendedSpriteBatch spriteBatch, Camera projectionCamera, BitmapFont font, Vector3 origin) {
|
public static void clear() {
|
||||||
renderCoordinateSystemAxis(shapeRenderer, spriteBatch, projectionCamera, font, origin, 5.0f);
|
clear(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderCoordinateSystemAxis(ShapeRenderer shapeRenderer, ExtendedSpriteBatch spriteBatch, Camera projectionCamera, BitmapFont font, Vector3 origin, float axisLength) {
|
public static void clear(float red, float green, float blue, float alpha) {
|
||||||
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
|
Gdx.graphics.getGL20().glClearColor(red, green, blue, alpha);
|
||||||
spriteBatch.begin(projectionCamera);
|
Gdx.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
shapeRenderer.setColor(Color.WHITE);
|
public static void renderCoordinateSystemAxis(DebugGeometryRenderer debugGeometryRenderer, ExtendedSpriteBatch spriteBatch, Camera projectionCamera, BitmapFont font, Vector3 origin) {
|
||||||
shapeRenderer.line(origin.x, origin.y, origin.z, origin.x + 0.0f, origin.y + axisLength, origin.z + 0.0f);
|
renderCoordinateSystemAxis(debugGeometryRenderer, spriteBatch, projectionCamera, font, origin, 5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void renderCoordinateSystemAxis(DebugGeometryRenderer debugGeometryRenderer, ExtendedSpriteBatch spriteBatch, Camera projectionCamera, BitmapFont font, Vector3 origin, float axisLength) {
|
||||||
|
debugGeometryRenderer.begin(projectionCamera);
|
||||||
|
debugGeometryRenderer.line(origin.x, origin.y, origin.z, origin.x + 0.0f, origin.y + axisLength, origin.z + 0.0f, Color.WHITE);
|
||||||
|
debugGeometryRenderer.line(origin.x, origin.y, origin.z, origin.x + 0.0f, origin.y + -axisLength, origin.z + 0.0f, Color.BLACK);
|
||||||
|
debugGeometryRenderer.line(origin.x, origin.y, origin.z, origin.x + -axisLength, origin.y + 0.0f, origin.z + 0.0f, Color.GREEN);
|
||||||
|
debugGeometryRenderer.line(origin.x, origin.y, origin.z, origin.x + axisLength, origin.y + 0.0f, origin.z + 0.0f, Color.RED);
|
||||||
|
debugGeometryRenderer.line(origin.x, origin.y, origin.z, origin.x + 0.0f, origin.y + 0.0f, origin.z + -axisLength, Color.CYAN);
|
||||||
|
debugGeometryRenderer.line(origin.x, origin.y, origin.z, origin.x + 0.0f, origin.y + 0.0f, origin.z + axisLength, Color.YELLOW);
|
||||||
|
debugGeometryRenderer.end();
|
||||||
|
|
||||||
|
spriteBatch.begin(projectionCamera);
|
||||||
spriteBatch.setColor(Color.WHITE);
|
spriteBatch.setColor(Color.WHITE);
|
||||||
spriteBatch.draw(font, origin.x + 0.0f, origin.y + axisLength, origin.z + 0.0f, "UP (+Y)", 0.5f);
|
spriteBatch.draw(font, origin.x + 0.0f, origin.y + axisLength, origin.z + 0.0f, "UP (+Y)", 0.5f);
|
||||||
|
|
||||||
shapeRenderer.setColor(Color.BLACK);
|
|
||||||
shapeRenderer.line(origin.x, origin.y, origin.z, origin.x + 0.0f, origin.y + -axisLength, origin.z + 0.0f);
|
|
||||||
spriteBatch.setColor(Color.BLACK);
|
spriteBatch.setColor(Color.BLACK);
|
||||||
spriteBatch.draw(font, origin.x + 0.0f, origin.y + -axisLength, origin.z + 0.0f, "DOWN (-Y)", 0.5f);
|
spriteBatch.draw(font, origin.x + 0.0f, origin.y + -axisLength, origin.z + 0.0f, "DOWN (-Y)", 0.5f);
|
||||||
|
|
||||||
shapeRenderer.setColor(Color.GREEN);
|
|
||||||
shapeRenderer.line(origin.x, origin.y, origin.z, origin.x + -axisLength, origin.y + 0.0f, origin.z + 0.0f);
|
|
||||||
spriteBatch.setColor(Color.GREEN);
|
spriteBatch.setColor(Color.GREEN);
|
||||||
spriteBatch.draw(font, origin.x + -axisLength, origin.y + 0.0f, origin.z + 0.0f, "LEFT (-X)", 0.5f);
|
spriteBatch.draw(font, origin.x + -axisLength, origin.y + 0.0f, origin.z + 0.0f, "LEFT (-X)", 0.5f);
|
||||||
|
|
||||||
shapeRenderer.setColor(Color.RED);
|
|
||||||
shapeRenderer.line(origin.x, origin.y, origin.z, origin.x + axisLength, origin.y + 0.0f, origin.z + 0.0f);
|
|
||||||
spriteBatch.setColor(Color.RED);
|
spriteBatch.setColor(Color.RED);
|
||||||
spriteBatch.draw(font, origin.x + axisLength, origin.y + 0.0f, origin.z + 0.0f, "RIGHT (+X)", 0.5f);
|
spriteBatch.draw(font, origin.x + axisLength, origin.y + 0.0f, origin.z + 0.0f, "RIGHT (+X)", 0.5f);
|
||||||
|
|
||||||
shapeRenderer.setColor(Color.CYAN);
|
|
||||||
shapeRenderer.line(origin.x, origin.y, origin.z, origin.x + 0.0f, origin.y + 0.0f, origin.z + -axisLength);
|
|
||||||
spriteBatch.setColor(Color.CYAN);
|
spriteBatch.setColor(Color.CYAN);
|
||||||
spriteBatch.draw(font, origin.x + 0.0f, origin.y + 0.0f, origin.z + -axisLength, "FORWARD (-Z)", 0.5f);
|
spriteBatch.draw(font, origin.x + 0.0f, origin.y + 0.0f, origin.z + -axisLength, "FORWARD (-Z)", 0.5f);
|
||||||
|
|
||||||
shapeRenderer.setColor(Color.YELLOW);
|
|
||||||
shapeRenderer.line(origin.x, origin.y, origin.z, origin.x + 0.0f, origin.y + 0.0f, origin.z + axisLength);
|
|
||||||
spriteBatch.setColor(Color.YELLOW);
|
spriteBatch.setColor(Color.YELLOW);
|
||||||
spriteBatch.draw(font, origin.x + 0.0f, origin.y + 0.0f, origin.z + axisLength, "BACKWARD (+Z)", 0.5f);
|
spriteBatch.draw(font, origin.x + 0.0f, origin.y + 0.0f, origin.z + axisLength, "BACKWARD (+Z)", 0.5f);
|
||||||
|
|
||||||
spriteBatch.end();
|
spriteBatch.end();
|
||||||
shapeRenderer.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderGridPlane(ShapeRenderer shapeRenderer, int width, int depth) {
|
public static void renderGridPlane(ShapeRenderer shapeRenderer, Camera projectionCamera, int width, int depth) {
|
||||||
tmpTransform.idt();
|
tmpTransform.idt();
|
||||||
renderGridPlane(shapeRenderer, width, depth, tmpTransform);
|
renderGridPlane(shapeRenderer, projectionCamera, width, depth, tmpTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderGridPlane(ShapeRenderer shapeRenderer, int width, int depth, float minX, float minY, float minZ) {
|
public static void renderGridPlane(ShapeRenderer shapeRenderer, Camera projectionCamera, int width, int depth, float minX, float minY, float minZ) {
|
||||||
tmpTransform.idt().translate(minX, minY, minZ);
|
tmpTransform.idt().translate(minX, minY, minZ);
|
||||||
renderGridPlane(shapeRenderer, width, depth, tmpTransform);
|
renderGridPlane(shapeRenderer, projectionCamera, width, depth, tmpTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderGridPlane(ShapeRenderer shapeRenderer, int width, int depth, Matrix4 transform) {
|
public static void renderGridPlane(ShapeRenderer shapeRenderer, Camera projectionCamera, int width, int depth, Matrix4 transform) {
|
||||||
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
|
shapeRenderer.setProjectionMatrix(projectionCamera.combined);
|
||||||
shapeRenderer.setTransformMatrix(transform);
|
shapeRenderer.setTransformMatrix(transform);
|
||||||
|
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
|
||||||
shapeRenderer.setColor(Color.WHITE);
|
shapeRenderer.setColor(Color.WHITE);
|
||||||
|
|
||||||
for (int i = 0; i <= width; ++i)
|
for (int i = 0; i <= width; ++i)
|
||||||
|
|
|
@ -1,120 +0,0 @@
|
||||||
package com.blarg.gdx.graphics;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
import com.badlogic.gdx.graphics.Camera;
|
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
|
||||||
import com.badlogic.gdx.graphics.PerspectiveCamera;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
|
||||||
import com.badlogic.gdx.graphics.g3d.ModelBatch;
|
|
||||||
import com.badlogic.gdx.graphics.g3d.decals.DecalBatch;
|
|
||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
|
||||||
import com.blarg.gdx.math.MathHelpers;
|
|
||||||
|
|
||||||
public class RenderContext implements Disposable {
|
|
||||||
public final ExtendedSpriteBatch spriteBatch;
|
|
||||||
public final BillboardSpriteBatch billboardSpriteBatch;
|
|
||||||
public final ShapeRenderer debugGeometryRenderer2D;
|
|
||||||
public final ShapeRenderer debugGeometryRenderer3D;
|
|
||||||
public final ModelBatch modelBatch;
|
|
||||||
public final ScreenPixelScaler pixelScaler;
|
|
||||||
public final SolidColorTextureCache solidColorTextures;
|
|
||||||
|
|
||||||
Camera perspectiveCamera;
|
|
||||||
OrthographicCamera orthographicCamera;
|
|
||||||
|
|
||||||
public RenderContext(boolean use2dPixelScaling) {
|
|
||||||
Gdx.app.debug("RenderContext", "ctor");
|
|
||||||
spriteBatch = new ExtendedSpriteBatch();
|
|
||||||
billboardSpriteBatch = new BillboardSpriteBatch();
|
|
||||||
debugGeometryRenderer2D = new ShapeRenderer();
|
|
||||||
debugGeometryRenderer3D = new ShapeRenderer();
|
|
||||||
modelBatch = new ModelBatch();
|
|
||||||
solidColorTextures = new SolidColorTextureCache();
|
|
||||||
|
|
||||||
if (use2dPixelScaling)
|
|
||||||
pixelScaler = new DefaultScreenPixelScaler();
|
|
||||||
else
|
|
||||||
pixelScaler = new NoScaleScreenPixelScaler();
|
|
||||||
pixelScaler.calculateScale(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
|
||||||
orthographicCamera = new OrthographicCamera(pixelScaler.getScaledWidth(), pixelScaler.getScaledHeight());
|
|
||||||
|
|
||||||
setDefaultPerspectiveCamera();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Camera getPerspectiveCamera() {
|
|
||||||
return perspectiveCamera;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrthographicCamera getOrthographicCamera() {
|
|
||||||
return orthographicCamera;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPerspectiveCamera(Camera camera) {
|
|
||||||
if (camera == null)
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
perspectiveCamera = camera;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefaultPerspectiveCamera() {
|
|
||||||
PerspectiveCamera camera = new PerspectiveCamera(60.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
|
||||||
camera.position.set(0.0f, 0.0f, 0.0f);
|
|
||||||
camera.lookAt(MathHelpers.FORWARD_VECTOR3);
|
|
||||||
camera.near = 0.1f;
|
|
||||||
camera.far = 100.0f;
|
|
||||||
camera.update();
|
|
||||||
setPerspectiveCamera(camera);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
clear(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear(float red, float green, float blue, float alpha) {
|
|
||||||
Gdx.graphics.getGL20().glClearColor(red, green, blue, alpha);
|
|
||||||
Gdx.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPreRender() {
|
|
||||||
spriteBatch.setProjectionMatrix(orthographicCamera.combined);
|
|
||||||
spriteBatch.setPixelScale(pixelScaler.getScale());
|
|
||||||
debugGeometryRenderer2D.setProjectionMatrix(orthographicCamera.combined);
|
|
||||||
debugGeometryRenderer3D.setProjectionMatrix(perspectiveCamera.combined);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPostRender() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onUpdate(float delta) {
|
|
||||||
perspectiveCamera.update();
|
|
||||||
orthographicCamera.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onResize(int width, int height) {
|
|
||||||
Gdx.app.debug("RenderContext", String.format("onResize(%d, %d)", width, height));
|
|
||||||
pixelScaler.calculateScale(width, height);
|
|
||||||
orthographicCamera.setToOrtho(false, pixelScaler.getScaledWidth(), pixelScaler.getScaledHeight());
|
|
||||||
perspectiveCamera.viewportWidth = width;
|
|
||||||
perspectiveCamera.viewportHeight = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPause() {
|
|
||||||
Gdx.app.debug("RenderContext", String.format("onPause"));
|
|
||||||
solidColorTextures.onPause();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onResume() {
|
|
||||||
Gdx.app.debug("RenderContext", String.format("onResume"));
|
|
||||||
solidColorTextures.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
|
||||||
Gdx.app.debug("RenderContext", String.format("dispose"));
|
|
||||||
solidColorTextures.dispose();
|
|
||||||
modelBatch.dispose();
|
|
||||||
billboardSpriteBatch.dispose();
|
|
||||||
spriteBatch.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
82
src/com/blarg/gdx/graphics/ViewportContext.java
Normal file
82
src/com/blarg/gdx/graphics/ViewportContext.java
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
package com.blarg.gdx.graphics;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.Camera;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.graphics.PerspectiveCamera;
|
||||||
|
import com.blarg.gdx.math.MathHelpers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages graphics state relating to the viewport dimensions and camera(s).
|
||||||
|
*/
|
||||||
|
public class ViewportContext {
|
||||||
|
public final ScreenPixelScaler pixelScaler;
|
||||||
|
|
||||||
|
Camera perspectiveCamera;
|
||||||
|
OrthographicCamera orthographicCamera;
|
||||||
|
|
||||||
|
public ViewportContext(boolean use2dPixelScaling) {
|
||||||
|
Gdx.app.debug("ViewportContext", "ctor");
|
||||||
|
if (use2dPixelScaling)
|
||||||
|
pixelScaler = new DefaultScreenPixelScaler();
|
||||||
|
else
|
||||||
|
pixelScaler = new NoScaleScreenPixelScaler();
|
||||||
|
pixelScaler.calculateScale(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
|
orthographicCamera = new OrthographicCamera(pixelScaler.getScaledWidth(), pixelScaler.getScaledHeight());
|
||||||
|
|
||||||
|
setDefaultPerspectiveCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Camera getPerspectiveCamera() {
|
||||||
|
return perspectiveCamera;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrthographicCamera getOrthographicCamera() {
|
||||||
|
return orthographicCamera;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPerspectiveCamera(Camera camera) {
|
||||||
|
if (camera == null)
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
perspectiveCamera = camera;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultPerspectiveCamera() {
|
||||||
|
PerspectiveCamera camera = new PerspectiveCamera(60.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
|
camera.position.set(0.0f, 0.0f, 0.0f);
|
||||||
|
camera.lookAt(MathHelpers.FORWARD_VECTOR3);
|
||||||
|
camera.near = 0.1f;
|
||||||
|
camera.far = 100.0f;
|
||||||
|
camera.update();
|
||||||
|
setPerspectiveCamera(camera);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPreRender() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPostRender() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onUpdate(float delta) {
|
||||||
|
perspectiveCamera.update();
|
||||||
|
orthographicCamera.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResize(int width, int height) {
|
||||||
|
Gdx.app.debug("ViewportContext", String.format("onResize(%d, %d)", width, height));
|
||||||
|
pixelScaler.calculateScale(width, height);
|
||||||
|
orthographicCamera.setToOrtho(false, pixelScaler.getScaledWidth(), pixelScaler.getScaledHeight());
|
||||||
|
perspectiveCamera.viewportWidth = width;
|
||||||
|
perspectiveCamera.viewportHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPause() {
|
||||||
|
Gdx.app.debug("ViewportContext", String.format("onPause"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResume() {
|
||||||
|
Gdx.app.debug("ViewportContext", String.format("onResume"));
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,10 @@ package com.blarg.gdx.graphics.screeneffects;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
import com.blarg.gdx.Services;
|
||||||
|
import com.blarg.gdx.graphics.ExtendedSpriteBatch;
|
||||||
|
import com.blarg.gdx.graphics.SolidColorTextureCache;
|
||||||
|
import com.blarg.gdx.graphics.ViewportContext;
|
||||||
|
|
||||||
public class DimScreenEffect extends ScreenEffect
|
public class DimScreenEffect extends ScreenEffect
|
||||||
{
|
{
|
||||||
|
@ -14,28 +17,36 @@ public class DimScreenEffect extends ScreenEffect
|
||||||
|
|
||||||
Color renderColor;
|
Color renderColor;
|
||||||
|
|
||||||
|
ExtendedSpriteBatch spriteBatch;
|
||||||
|
SolidColorTextureCache solidColorTextures;
|
||||||
|
ViewportContext viewportContext;
|
||||||
|
|
||||||
public DimScreenEffect()
|
public DimScreenEffect()
|
||||||
{
|
{
|
||||||
color = new Color(DEFAULT_DIM_COLOR);
|
color = new Color(DEFAULT_DIM_COLOR);
|
||||||
alpha = DEFAULT_DIM_ALPHA;
|
alpha = DEFAULT_DIM_ALPHA;
|
||||||
|
|
||||||
renderColor = new Color(color);
|
renderColor = new Color(color);
|
||||||
|
|
||||||
|
spriteBatch = Services.get(ExtendedSpriteBatch.class);
|
||||||
|
solidColorTextures = Services.get(SolidColorTextureCache.class);
|
||||||
|
viewportContext = Services.get(ViewportContext.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRender(float delta, RenderContext renderContext)
|
public void onRender(float delta)
|
||||||
{
|
{
|
||||||
renderColor.set(color);
|
renderColor.set(color);
|
||||||
renderColor.a = alpha;
|
renderColor.a = alpha;
|
||||||
Texture texture = renderContext.solidColorTextures.get(color);
|
Texture texture = solidColorTextures.get(color);
|
||||||
|
|
||||||
renderContext.spriteBatch.begin();
|
spriteBatch.begin();
|
||||||
renderContext.spriteBatch.setColor(renderColor);
|
spriteBatch.setColor(renderColor);
|
||||||
renderContext.spriteBatch.draw(
|
spriteBatch.draw(
|
||||||
texture,
|
texture,
|
||||||
0, 0,
|
0, 0,
|
||||||
renderContext.pixelScaler.getScaledWidth(), renderContext.pixelScaler.getScaledHeight()
|
viewportContext.pixelScaler.getScaledWidth(), viewportContext.pixelScaler.getScaledHeight()
|
||||||
);
|
);
|
||||||
renderContext.spriteBatch.end();
|
spriteBatch.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@ package com.blarg.gdx.graphics.screeneffects;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
import com.blarg.gdx.Services;
|
||||||
|
import com.blarg.gdx.graphics.ExtendedSpriteBatch;
|
||||||
|
import com.blarg.gdx.graphics.SolidColorTextureCache;
|
||||||
|
import com.blarg.gdx.graphics.ViewportContext;
|
||||||
|
|
||||||
public class FadeScreenEffect extends ScreenEffect
|
public class FadeScreenEffect extends ScreenEffect
|
||||||
{
|
{
|
||||||
|
@ -15,8 +18,16 @@ public class FadeScreenEffect extends ScreenEffect
|
||||||
float fadeToAlpha;
|
float fadeToAlpha;
|
||||||
boolean isDoneFading;
|
boolean isDoneFading;
|
||||||
|
|
||||||
|
ExtendedSpriteBatch spriteBatch;
|
||||||
|
SolidColorTextureCache solidColorTextures;
|
||||||
|
ViewportContext viewportContext;
|
||||||
|
|
||||||
public FadeScreenEffect() {
|
public FadeScreenEffect() {
|
||||||
color = new Color();
|
color = new Color();
|
||||||
|
|
||||||
|
spriteBatch = Services.get(ExtendedSpriteBatch.class);
|
||||||
|
solidColorTextures = Services.get(SolidColorTextureCache.class);
|
||||||
|
viewportContext = Services.get(ViewportContext.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDoneFading() {
|
public boolean isDoneFading() {
|
||||||
|
@ -54,19 +65,19 @@ public class FadeScreenEffect extends ScreenEffect
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRender(float delta, RenderContext renderContext)
|
public void onRender(float delta)
|
||||||
{
|
{
|
||||||
Texture texture = renderContext.solidColorTextures.get(Color.WHITE);
|
Texture texture = solidColorTextures.get(Color.WHITE);
|
||||||
color.a = alpha;
|
color.a = alpha;
|
||||||
|
|
||||||
renderContext.spriteBatch.begin();
|
spriteBatch.begin();
|
||||||
renderContext.spriteBatch.setColor(color);
|
spriteBatch.setColor(color);
|
||||||
renderContext.spriteBatch.draw(
|
spriteBatch.draw(
|
||||||
texture,
|
texture,
|
||||||
0, 0,
|
0, 0,
|
||||||
renderContext.pixelScaler.getScaledWidth(), renderContext.pixelScaler.getScaledHeight()
|
viewportContext.pixelScaler.getScaledWidth(), viewportContext.pixelScaler.getScaledHeight()
|
||||||
);
|
);
|
||||||
renderContext.spriteBatch.end();
|
spriteBatch.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,10 @@ package com.blarg.gdx.graphics.screeneffects;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
import com.blarg.gdx.Services;
|
||||||
|
import com.blarg.gdx.graphics.ExtendedSpriteBatch;
|
||||||
|
import com.blarg.gdx.graphics.SolidColorTextureCache;
|
||||||
|
import com.blarg.gdx.graphics.ViewportContext;
|
||||||
|
|
||||||
public class FlashScreenEffect extends ScreenEffect
|
public class FlashScreenEffect extends ScreenEffect
|
||||||
{
|
{
|
||||||
|
@ -17,6 +20,10 @@ public class FlashScreenEffect extends ScreenEffect
|
||||||
boolean isFlashingIn;
|
boolean isFlashingIn;
|
||||||
float alpha;
|
float alpha;
|
||||||
|
|
||||||
|
ExtendedSpriteBatch spriteBatch;
|
||||||
|
SolidColorTextureCache solidColorTextures;
|
||||||
|
ViewportContext viewportContext;
|
||||||
|
|
||||||
public float getAlpha() {
|
public float getAlpha() {
|
||||||
return alpha;
|
return alpha;
|
||||||
}
|
}
|
||||||
|
@ -27,22 +34,26 @@ public class FlashScreenEffect extends ScreenEffect
|
||||||
flashOutSpeed = DEFAULT_FLASH_SPEED;
|
flashOutSpeed = DEFAULT_FLASH_SPEED;
|
||||||
maximumIntensity = DEFAULT_MAX_INTENSITY;
|
maximumIntensity = DEFAULT_MAX_INTENSITY;
|
||||||
color = new Color(Color.WHITE);
|
color = new Color(Color.WHITE);
|
||||||
|
|
||||||
|
spriteBatch = Services.get(ExtendedSpriteBatch.class);
|
||||||
|
solidColorTextures = Services.get(SolidColorTextureCache.class);
|
||||||
|
viewportContext = Services.get(ViewportContext.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRender(float delta, RenderContext renderContext)
|
public void onRender(float delta)
|
||||||
{
|
{
|
||||||
Texture texture = renderContext.solidColorTextures.get(Color.WHITE);
|
Texture texture = solidColorTextures.get(Color.WHITE);
|
||||||
color.a = alpha;
|
color.a = alpha;
|
||||||
|
|
||||||
renderContext.spriteBatch.begin();
|
spriteBatch.begin();
|
||||||
renderContext.spriteBatch.setColor(color);
|
spriteBatch.setColor(color);
|
||||||
renderContext.spriteBatch.draw(
|
spriteBatch.draw(
|
||||||
texture,
|
texture,
|
||||||
0, 0,
|
0, 0,
|
||||||
renderContext.pixelScaler.getScaledWidth(), renderContext.pixelScaler.getScaledHeight()
|
viewportContext.pixelScaler.getScaledWidth(), viewportContext.pixelScaler.getScaledHeight()
|
||||||
);
|
);
|
||||||
renderContext.spriteBatch.end();
|
spriteBatch.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.blarg.gdx.graphics.screeneffects;
|
package com.blarg.gdx.graphics.screeneffects;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
|
||||||
|
|
||||||
public abstract class ScreenEffect implements Disposable
|
public abstract class ScreenEffect implements Disposable
|
||||||
{
|
{
|
||||||
|
@ -26,7 +25,7 @@ public abstract class ScreenEffect implements Disposable
|
||||||
public void onResize() {
|
public void onResize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(float delta, RenderContext renderContext) {
|
public void onRender(float delta) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(float delta) {
|
public void onUpdate(float delta) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.blarg.gdx.graphics.screeneffects;
|
package com.blarg.gdx.graphics.screeneffects;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
@ -104,25 +103,25 @@ public class ScreenEffectManager implements Disposable
|
||||||
effects.get(i).effect.onResize();
|
effects.get(i).effect.onResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRenderLocal(float delta, RenderContext renderContext) {
|
public void onRenderLocal(float delta) {
|
||||||
if (numLocalEffects == 0)
|
if (numLocalEffects == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < effects.size(); ++i) {
|
for (int i = 0; i < effects.size(); ++i) {
|
||||||
EffectInfo effectInfo = effects.get(i);
|
EffectInfo effectInfo = effects.get(i);
|
||||||
if (effectInfo.isLocal)
|
if (effectInfo.isLocal)
|
||||||
effectInfo.effect.onRender(delta, renderContext);
|
effectInfo.effect.onRender(delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRenderGlobal(float delta, RenderContext renderContext) {
|
public void onRenderGlobal(float delta) {
|
||||||
if (numGlobalEffects == 0)
|
if (numGlobalEffects == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < effects.size(); ++i) {
|
for (int i = 0; i < effects.size(); ++i) {
|
||||||
EffectInfo effectInfo = effects.get(i);
|
EffectInfo effectInfo = effects.get(i);
|
||||||
if (!effectInfo.isLocal)
|
if (!effectInfo.isLocal)
|
||||||
effectInfo.effect.onRender(delta, renderContext);
|
effectInfo.effect.onRender(delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.blarg.gdx.GameApp;
|
||||||
import com.blarg.gdx.events.Event;
|
import com.blarg.gdx.events.Event;
|
||||||
import com.blarg.gdx.events.EventHandler;
|
import com.blarg.gdx.events.EventHandler;
|
||||||
import com.blarg.gdx.events.EventManager;
|
import com.blarg.gdx.events.EventManager;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
|
||||||
import com.blarg.gdx.states.GameState;
|
import com.blarg.gdx.states.GameState;
|
||||||
|
|
||||||
public abstract class GameProcess extends EventHandler implements Disposable {
|
public abstract class GameProcess extends EventHandler implements Disposable {
|
||||||
|
@ -55,7 +54,7 @@ public abstract class GameProcess extends EventHandler implements Disposable {
|
||||||
public void onResize() {
|
public void onResize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(float delta, RenderContext renderContext) {
|
public void onRender(float delta) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(float delta) {
|
public void onUpdate(float delta) {
|
||||||
|
|
|
@ -2,11 +2,10 @@ package com.blarg.gdx.processes;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
import com.blarg.gdx.ReflectionUtils;
|
||||||
import com.blarg.gdx.Strings;
|
import com.blarg.gdx.Strings;
|
||||||
import com.blarg.gdx.events.EventManager;
|
import com.blarg.gdx.events.EventManager;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
|
||||||
import com.blarg.gdx.states.GameState;
|
import com.blarg.gdx.states.GameState;
|
||||||
import com.blarg.gdx.ReflectionUtils;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
@ -189,11 +188,11 @@ public class ProcessManager implements Disposable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(float delta, RenderContext renderContext) {
|
public void onRender(float delta) {
|
||||||
for (int i = 0; i < processes.size(); ++i) {
|
for (int i = 0; i < processes.size(); ++i) {
|
||||||
ProcessInfo processInfo = processes.get(i);
|
ProcessInfo processInfo = processes.get(i);
|
||||||
if (!processInfo.isInactive)
|
if (!processInfo.isInactive)
|
||||||
processInfo.process.onRender(delta, renderContext);
|
processInfo.process.onRender(delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.blarg.gdx.GameApp;
|
||||||
import com.blarg.gdx.events.Event;
|
import com.blarg.gdx.events.Event;
|
||||||
import com.blarg.gdx.events.EventHandler;
|
import com.blarg.gdx.events.EventHandler;
|
||||||
import com.blarg.gdx.events.EventManager;
|
import com.blarg.gdx.events.EventManager;
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
|
||||||
import com.blarg.gdx.graphics.screeneffects.ScreenEffectManager;
|
import com.blarg.gdx.graphics.screeneffects.ScreenEffectManager;
|
||||||
import com.blarg.gdx.processes.ProcessManager;
|
import com.blarg.gdx.processes.ProcessManager;
|
||||||
|
|
||||||
|
@ -80,12 +79,12 @@ public abstract class GameState extends EventHandler implements Disposable {
|
||||||
effectManager.onResize();
|
effectManager.onResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(float delta, RenderContext renderContext) {
|
public void onRender(float delta) {
|
||||||
// switch it up and do effects before processes here so that processes
|
// switch it up and do effects before processes here so that processes
|
||||||
// (which would commonly be used for UI overlay elements) don't get
|
// (which would commonly be used for UI overlay elements) don't get
|
||||||
// overwritten by local effects (e.g. flashes, etc.)
|
// overwritten by local effects (e.g. flashes, etc.)
|
||||||
effectManager.onRenderLocal(delta, renderContext);
|
effectManager.onRenderLocal(delta);
|
||||||
processManager.onRender(delta, renderContext);
|
processManager.onRender(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(float delta) {
|
public void onUpdate(float delta) {
|
||||||
|
|
|
@ -3,10 +3,9 @@ package com.blarg.gdx.states;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
import com.blarg.gdx.GameApp;
|
import com.blarg.gdx.GameApp;
|
||||||
|
import com.blarg.gdx.ReflectionUtils;
|
||||||
import com.blarg.gdx.Strings;
|
import com.blarg.gdx.Strings;
|
||||||
import com.blarg.gdx.events.EventManager;
|
import com.blarg.gdx.events.EventManager;
|
||||||
import com.blarg.gdx.ReflectionUtils;
|
|
||||||
import com.blarg.gdx.graphics.RenderContext;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
@ -254,12 +253,12 @@ public class StateManager implements Disposable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(float delta, RenderContext renderContext) {
|
public void onRender(float delta) {
|
||||||
for (int i = getTopNonOverlayIndex(); i != -1 && i < states.size(); ++i) {
|
for (int i = getTopNonOverlayIndex(); i != -1 && i < states.size(); ++i) {
|
||||||
StateInfo stateInfo = states.get(i);
|
StateInfo stateInfo = states.get(i);
|
||||||
if (!stateInfo.isInactive) {
|
if (!stateInfo.isInactive) {
|
||||||
stateInfo.state.onRender(delta, renderContext);
|
stateInfo.state.onRender(delta);
|
||||||
stateInfo.state.effectManager.onRenderGlobal(delta, renderContext);
|
stateInfo.state.effectManager.onRenderGlobal(delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue