Advertisement
Guest User

Untitled

a guest
May 29th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. package com.flappy.game.states;
  2. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  3.  
  4. import java.util.Stack;
  5.  
  6.  
  7. public class GameStateManager {
  8.     private Stack<State> states;
  9.  
  10.     public GameStateManager(){
  11.         states = new Stack<State>();
  12.     }
  13.  
  14.     public void push(State state){
  15.         states.push(state);
  16.     }
  17.  
  18.     public void pop(){
  19.         states.pop();
  20.     }
  21.  
  22.     public void set(State state){
  23.         states.pop();
  24.         states.push(state);
  25.     }
  26.  
  27.     public void update(float dt){
  28.         states.peek().update(dt);
  29.     }
  30.  
  31.     public void render(SpriteBatch sb){
  32.         states.peek().render(sb);
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement