Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.flappy.game.states;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- import java.util.Stack;
- public class GameStateManager {
- private Stack<State> states;
- public GameStateManager(){
- states = new Stack<State>();
- }
- public void push(State state){
- states.push(state);
- }
- public void pop(){
- states.pop();
- }
- public void set(State state){
- states.pop();
- states.push(state);
- }
- public void update(float dt){
- states.peek().update(dt);
- }
- public void render(SpriteBatch sb){
- states.peek().render(sb);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement