All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.blastedstudios.gdxworld.util.GDXGame Maven / Gradle / Ivy

The newest version!
package com.blastedstudios.gdxworld.util;

import java.util.Stack;

import com.badlogic.gdx.Game;
import com.blastedstudios.gdxworld.ui.AbstractScreen;

public abstract class GDXGame extends Game {
	private Stack screenStack = new Stack<>();
	
	public AbstractScreen peekScreen(){
		return screenStack.peek();
	}

	public void pushScreen(AbstractScreen screen){
		screenStack.push(screen);
		setScreen(screen);
	}
	
	public AbstractScreen popScreen(){
		AbstractScreen previous = screenStack.pop();
		if(!screenStack.isEmpty())
			setScreen(screenStack.peek());
		return previous;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy