Skip to content

Latest commit

 

History

History
49 lines (30 loc) · 3.22 KB

README.md

File metadata and controls

49 lines (30 loc) · 3.22 KB

What is libgdx-screenmanager?

Release Build GWT Compatible Discord Support

This library is a screen manager for libGDX games. It allows comfortably changing the rendered screen while using transition effects. The library's easy to use nature makes it possible to integrate libgdx-screenmanager into any project without much effort.

Features

A small example using different transitions. Look at the showcases folder for more gifs.
  • Allows easily changing the rendered screen: game.getScreenManager().pushScreen(screen, transition)
  • Adds screen transition effects for when a screen is changed. The included transitions can be found here. Furthermore, transition shaders are supported as well. See the GL Transitions project for a collection of some very well made ones.
  • Automatically registers/unregisters a screen's input processors whenever the screen is shown/hidden
  • The whole library is well documented and includes tests for everything that isn't graphical

Example code

The following example shows how to use libgdx-screenmanager in your code. You can find the full example here.

The library is very easy to use: The game has to extend ManagedGame, all screens have to inherit from ManagedScreen. To push a screen, game.getScreenManager().pushScreen(screen, transition) has to be called. If no transition should be used, just call pushScreen(screen, null).

public class MyGdxGame extends ManagedGame<ManagedScreen, ScreenTransition> {

	@Override
	public final void create() {
		super.create();

		// Do some basic stuff
		this.batch = new SpriteBatch();

		// Push the first screen using a blending transition
		this.screenManager.pushScreen(new GreenScreen(), new BlendingScreenTransition(batch, 1F));

		Gdx.app.debug("Game", "Initialization finished.");
	}

}

Some additional notes:

  • Input processors should be added in a screen via ManagedScreen#addInputProcessor(...). This has the advantage that they are automatically registered/unregistered when the screen is shown/hidden.

Documentation

In the wiki you can find articles detailing the usage of the library and its inner workings.