ScreenEffects should also have both onUpdateGameState and onUpdateFrame
This commit is contained in:
parent
bf659f7bc2
commit
8def4a12d6
|
@ -1,13 +1,11 @@
|
|||
package ca.blarg.gdx.graphics.screeneffects;
|
||||
|
||||
import ca.blarg.gdx.Services;
|
||||
import ca.blarg.gdx.graphics.ExtendedSpriteBatch;
|
||||
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;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
|
||||
public class FadeScreenEffect extends ScreenEffect
|
||||
{
|
||||
|
@ -83,7 +81,7 @@ public class FadeScreenEffect extends ScreenEffect
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(float delta)
|
||||
public void onUpdateFrame(float delta)
|
||||
{
|
||||
if (isDoneFading)
|
||||
return;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package ca.blarg.gdx.graphics.screeneffects;
|
||||
|
||||
import ca.blarg.gdx.graphics.ExtendedSpriteBatch;
|
||||
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;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
|
||||
public class FlashScreenEffect extends ScreenEffect
|
||||
{
|
||||
|
@ -58,7 +57,7 @@ public class FlashScreenEffect extends ScreenEffect
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(float delta)
|
||||
public void onUpdateFrame(float delta)
|
||||
{
|
||||
if (isFlashingIn) {
|
||||
alpha += (delta * flashInSpeed);
|
||||
|
|
|
@ -28,7 +28,10 @@ public abstract class ScreenEffect implements Disposable
|
|||
public void onRender(float delta) {
|
||||
}
|
||||
|
||||
public void onUpdate(float delta) {
|
||||
public void onUpdateGameState(float delta) {
|
||||
}
|
||||
|
||||
public void onUpdateFrame(float delta) {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
|
|
@ -125,7 +125,7 @@ public class ScreenEffectManager implements Disposable
|
|||
}
|
||||
}
|
||||
|
||||
public void onUpdate(float delta) {
|
||||
public void onUpdateGameState(float delta) {
|
||||
int i = 0;
|
||||
while (i < effects.size()) {
|
||||
EffectInfo effectInfo = effects.get(i);
|
||||
|
@ -133,12 +133,17 @@ public class ScreenEffectManager implements Disposable
|
|||
// index doesn't change, we're removing one, so next index now equals this index
|
||||
remove(i);
|
||||
} else {
|
||||
effectInfo.effect.onUpdate(delta);
|
||||
effectInfo.effect.onUpdateFrame(delta);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onUpdateFrame(float delta) {
|
||||
for (int i = 0; i < effects.size(); ++i)
|
||||
effects.get(i).effect.onUpdateFrame(delta);
|
||||
}
|
||||
|
||||
/*** misc ***/
|
||||
|
||||
private <T extends ScreenEffect> int getIndexFor(Class<T> effectType) {
|
||||
|
|
|
@ -88,11 +88,12 @@ public abstract class GameState extends EventHandler implements Disposable {
|
|||
}
|
||||
|
||||
public void onUpdateGameState(float delta) {
|
||||
effectManager.onUpdateGameState(delta);
|
||||
processManager.onUpdateGameState(delta);
|
||||
}
|
||||
|
||||
public void onUpdateFrame(float delta) {
|
||||
effectManager.onUpdate(delta);
|
||||
effectManager.onUpdateFrame(delta);
|
||||
processManager.onUpdateFrame(delta);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue