LibGDX's application life cycle and interface
The application life cycle in LibGDX is a well-defined set of distinct system states. The list of these states is pretty short: create, resize, render, pause, resume, and dispose.
LibGDX defines an ApplicationListener
interface that contains six methods, one for each system state. The following code listing is a copy that is directly taken from LibGDX's sources. For the sake of readability, all comments have been stripped:
public interface ApplicationListener { public void create (); public void resize (int width, int height); public void render (); public void pause (); public void resume (); public void dispose (); }
All you need to do is implement these methods in your main class of the shared game code project. LibGDX will then call each of these methods at the right time.
Tip
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased...