package wge3.game;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public final class GameStateManager {
    
    private GameState currentState;
    
    private SpriteBatch batch;

    public GameStateManager() {
        batch = new SpriteBatch();
    }
    
    public void setState(int newState) {
        if (currentState != null) {
            currentState.dispose();
        }
        
        switch (newState) {
            case 0:
                // menu
                break;
                
            case 1:
                currentState = new PlayState(this);
                break;
                
            case 2:
                // preferences
                break;
        }
    }
    
    public void update(float delta) {
        currentState.update(delta);
    }
    
    public void draw() {
        currentState.draw(batch);
    }
}

@@ -458,15 +458,43 @@
     
-// menu
+currentState = new MenuState(this);
 %0A   
@@ -685,19 +685,50 @@
  // 
-preferences
+currentState = new PreferencesState(this);
 %0A   

Switch to MenuState.