onRender()'s 'delta' param renamed to better reflect its purpose
This commit is contained in:
parent
8def4a12d6
commit
216ee98acc
|
@ -60,12 +60,12 @@ public abstract class GameApp implements Disposable {
|
|||
viewportContext.onResize(width, height);
|
||||
}
|
||||
|
||||
public void onRender(float delta) {
|
||||
public void onRender(float interpolation) {
|
||||
viewportContext.onPreRender();
|
||||
spriteBatch.setProjectionMatrix(viewportContext.getOrthographicCamera().combined);
|
||||
spriteBatch.setPixelScale(viewportContext.pixelScaler.getScale());
|
||||
|
||||
stateManager.onRender(delta);
|
||||
stateManager.onRender(interpolation);
|
||||
|
||||
viewportContext.onPostRender();
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@ public interface GameLooper {
|
|||
int getUpdateFrequency();
|
||||
|
||||
float getUpdateDelta();
|
||||
float getRenderDelta();
|
||||
float getRenderInterpolation();
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ public class GdxGameAppListener implements ApplicationListener, GameLooper {
|
|||
int updateFrequency;
|
||||
float maxFrameTime;
|
||||
|
||||
float accumulator;
|
||||
float accumulator = 0.0f;
|
||||
|
||||
float updateDelta = 0.0f;
|
||||
float renderDelta = 0.0f;
|
||||
float renderInterpolation = 0.0f;
|
||||
|
||||
Class<? extends GameApp> gameAppType;
|
||||
GameApp gameApp;
|
||||
|
@ -65,10 +65,10 @@ public class GdxGameAppListener implements ApplicationListener, GameLooper {
|
|||
accumulator -= updateDelta;
|
||||
}
|
||||
|
||||
renderDelta = accumulator / updateDelta;
|
||||
renderInterpolation = accumulator / updateDelta;
|
||||
|
||||
gameApp.onUpdateFrame(frameTime);
|
||||
gameApp.onRender(renderDelta);
|
||||
gameApp.onRender(renderInterpolation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -109,7 +109,7 @@ public class GdxGameAppListener implements ApplicationListener, GameLooper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getRenderDelta() {
|
||||
return renderDelta;
|
||||
public float getRenderInterpolation() {
|
||||
return renderInterpolation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public abstract class ComponentSystem extends EventHandler implements Disposable
|
|||
public void onResize() {
|
||||
}
|
||||
|
||||
public void onRender(float delta) {
|
||||
public void onRender(float interpolation) {
|
||||
}
|
||||
|
||||
public void onUpdateGameState(float delta) {
|
||||
|
|
|
@ -307,9 +307,9 @@ public class EntityManager implements Disposable {
|
|||
componentSystems.get(i).onResize();
|
||||
}
|
||||
|
||||
public void onRender(float delta) {
|
||||
public void onRender(float interpolation) {
|
||||
for (int i = 0; i < componentSystems.size; ++i)
|
||||
componentSystems.get(i).onRender(delta);
|
||||
componentSystems.get(i).onRender(interpolation);
|
||||
}
|
||||
|
||||
public void onUpdateGameState(float delta) {
|
||||
|
|
|
@ -6,10 +6,6 @@ import ca.blarg.gdx.graphics.SolidColorTextureCache;
|
|||
import ca.blarg.gdx.graphics.ViewportContext;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import ca.blarg.gdx.Services;
|
||||
import ca.blarg.gdx.graphics.ExtendedSpriteBatch;
|
||||
import ca.blarg.gdx.graphics.SolidColorTextureCache;
|
||||
import ca.blarg.gdx.graphics.ViewportContext;
|
||||
|
||||
public class DimScreenEffect extends ScreenEffect
|
||||
{
|
||||
|
@ -38,7 +34,7 @@ public class DimScreenEffect extends ScreenEffect
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onRender(float delta)
|
||||
public void onRender(float interpolation)
|
||||
{
|
||||
renderColor.set(color);
|
||||
renderColor.a = alpha;
|
||||
|
|
|
@ -65,7 +65,7 @@ public class FadeScreenEffect extends ScreenEffect
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onRender(float delta)
|
||||
public void onRender(float interpolation)
|
||||
{
|
||||
Texture texture = solidColorTextures.get(Color.WHITE);
|
||||
color.a = alpha;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class FlashScreenEffect extends ScreenEffect
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onRender(float delta)
|
||||
public void onRender(float interpolation)
|
||||
{
|
||||
Texture texture = solidColorTextures.get(Color.WHITE);
|
||||
color.a = alpha;
|
||||
|
|
|
@ -25,7 +25,7 @@ public abstract class ScreenEffect implements Disposable
|
|||
public void onResize() {
|
||||
}
|
||||
|
||||
public void onRender(float delta) {
|
||||
public void onRender(float interpolation) {
|
||||
}
|
||||
|
||||
public void onUpdateGameState(float delta) {
|
||||
|
|
|
@ -103,25 +103,25 @@ public class ScreenEffectManager implements Disposable
|
|||
effects.get(i).effect.onResize();
|
||||
}
|
||||
|
||||
public void onRenderLocal(float delta) {
|
||||
public void onRenderLocal(float interpolation) {
|
||||
if (numLocalEffects == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < effects.size(); ++i) {
|
||||
EffectInfo effectInfo = effects.get(i);
|
||||
if (effectInfo.isLocal)
|
||||
effectInfo.effect.onRender(delta);
|
||||
effectInfo.effect.onRender(interpolation);
|
||||
}
|
||||
}
|
||||
|
||||
public void onRenderGlobal(float delta) {
|
||||
public void onRenderGlobal(float interpolation) {
|
||||
if (numGlobalEffects == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < effects.size(); ++i) {
|
||||
EffectInfo effectInfo = effects.get(i);
|
||||
if (!effectInfo.isLocal)
|
||||
effectInfo.effect.onRender(delta);
|
||||
effectInfo.effect.onRender(interpolation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public abstract class GameProcess extends EventHandler implements Disposable {
|
|||
public void onResize() {
|
||||
}
|
||||
|
||||
public void onRender(float delta) {
|
||||
public void onRender(float interpolation) {
|
||||
}
|
||||
|
||||
public void onUpdateGameState(float delta) {
|
||||
|
|
|
@ -188,11 +188,11 @@ public class ProcessManager implements Disposable {
|
|||
}
|
||||
}
|
||||
|
||||
public void onRender(float delta) {
|
||||
public void onRender(float interpolation) {
|
||||
for (int i = 0; i < processes.size(); ++i) {
|
||||
ProcessInfo processInfo = processes.get(i);
|
||||
if (!processInfo.isInactive)
|
||||
processInfo.process.onRender(delta);
|
||||
processInfo.process.onRender(interpolation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,12 +79,12 @@ public abstract class GameState extends EventHandler implements Disposable {
|
|||
effectManager.onResize();
|
||||
}
|
||||
|
||||
public void onRender(float delta) {
|
||||
public void onRender(float interpolation) {
|
||||
// switch it up and do effects before processes here so that processes
|
||||
// (which would commonly be used for UI overlay elements) don't get
|
||||
// overwritten by local effects (e.g. flashes, etc.)
|
||||
effectManager.onRenderLocal(delta);
|
||||
processManager.onRender(delta);
|
||||
effectManager.onRenderLocal(interpolation);
|
||||
processManager.onRender(interpolation);
|
||||
}
|
||||
|
||||
public void onUpdateGameState(float delta) {
|
||||
|
|
|
@ -253,12 +253,12 @@ public class StateManager implements Disposable {
|
|||
}
|
||||
}
|
||||
|
||||
public void onRender(float delta) {
|
||||
public void onRender(float interpolation) {
|
||||
for (int i = getTopNonOverlayIndex(); i != -1 && i < states.size(); ++i) {
|
||||
StateInfo stateInfo = states.get(i);
|
||||
if (!stateInfo.isInactive) {
|
||||
stateInfo.state.onRender(delta);
|
||||
stateInfo.state.effectManager.onRenderGlobal(delta);
|
||||
stateInfo.state.onRender(interpolation);
|
||||
stateInfo.state.effectManager.onRenderGlobal(interpolation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue