Skip to content

GameCore API

Sven Arends edited this page Dec 31, 2016 · 1 revision

#GameCore API GameCore gc = new GameCore(new LibZ());

  • This creates a new game instance

The following methods could be called on a 'GameCore'

.start()

  • Start the game
  • Usage: gc.start();

.stop()

  • Stop the game
  • Usage: gc.stop();

.setTitle(String title)

  • Set the title of the window
  • Usage: gc.setTitle("Hello LibZ!");

.getTitle()

  • Returns the title set with .setTitle(String title)
  • Usage: String title = gc.getTitle();

.setFullscreen(boolean fullscreen)

  • Override the width and height for windowed fullscreen
  • Usage: .setFullscreen(true);

.isFullscreen()

  • Returns the value set using .setFullscreen(boolean fullscreen)
  • Usage: boolean fullscreen = gc.isFullscreen();

.setWidth(int width)

  • Set the screen width
  • Usage: gc.setWidth(1280);

.getWidth()

  • Returns the screen width
  • Usage: int width = gc.getWidth();

.setHeight(int height)

  • Set the screen height
  • Usage: gc.setHeight(720);

.getHeight()

  • Returns the screen height
  • Usage: int height = gc.getHeight();

.setSize(int width, int height)

  • Set the screen size
  • Usage: gc.setSize(1280, 720);

.setSize(Dimension size)

  • Set the screen size
  • Usage: gc.setSize(new Dimension(1280, 720));

.setDecorated(boolean decorated)

  • add / remove the default title bar
  • Usage: gc.setDecorated(boolean decorated);

.isDecorated()

  • Returns the value set using .setDecorated(boolean decorated)
  • Usage: boolean decorated = gc.isDecorated();

.getScreen()

  • Returns the screen instance
  • Usage; Screen screen = gc.getScreen();

.getRender()

  • Returns the render instance
  • Usage: Render render = gc.getRender();

.getInput()

  • Returns the input handler
  • Usage: InputHandler input = gc.getInput();

.getFPS()

  • Returns the current FPS
  • Usage: int fps = gc.getFPS();

.getTPS()

  • Returns the current TPS
  • Usage: int tps = gc.getTPS();

.getCamera()

  • Returns the camera
  • Usage: Camera cam = gc.getCamera();

.getEntities()

  • Returns all entities
  • Usage: ArrayList<Entity> entities = gc.getEntities();

Private functions

.init()

  • Initialize everything

.lockScreenSize()

  • prevent the screen from resizing

.update()

  • Update the game

.render()

  • Render a frame
Clone this wiki locally