getting started with the Game class - Vrekt/Lunar GitHub Wiki

The Game class is where everything in your project starts. It houses the gameloop, window preferences, and much more. Lets start by creating new instance of Game.

Game game = new Game(title, width, height, tickRate);
Game game = new Game(title, width, height, GameState, tickRate);
Game game = new Game(String title, int width, int height, FramePreferences pref, int tickRate);
Game game = new Game(String title, int width, int height, FramePreferences pref, GameState state, int tickRate)
  • title is the title of the window.
  • tickRate is the rate at which the game runs. Something good as a default is 60.
  • GameState is the GameState to use, this isn't required unless you don't want to push it to the stack later.
  • FramePreferences is an object which holds all settings for the window.

Now we need to 'start' the game. Simply do game.start(); to start the game.