Skip to content

Application

Open Javadoc
  1. Initialization
  2. Input handling
  3. Updating
  4. Rendering
  5. Destruction

There are 3 different ways to create an application.

public class MyApplication extends Application {
public MyApplication() {
super("Hello world", 900, 600);
}
}
Application myApplication = new Application("Hello world", 900, 600);

The application builder is an implementation of the builder pattern. It allows you to construct an application step by step.

ApplicationBuilder applicationBuilder = new ApplicationBuilder();
applicationBuilder.setTitle("Hello world").setWindowSize(900, 600);
Application myApplication = applicationBuilder.build();

The run() method initializes the application and then starts it. This method will also catch any exceptions and log them.

myApplication.run();

Pausing an application changes its state to PAUSED and sets the time scale to 0f.

myApplication.pause();
myApplication.resume();
// Or
myApplication.togglePause();
myApplication.togglePause();

Calling the stop() method will safely terminate the application after the current frame has finished.

myApplication.stop();