Skip to content
Matthew 'siD' Van der Bijl edited this page Aug 6, 2014 · 4 revisions

Hello World!

Tutorial on making a window appear

import dwarf.Game;

/**
 * @author sid_th3_sl0th
 */
public class basicGame extends Game {

    public basicGame() {
        super();
    }

    @Override
    public void load() {

    }

    @Override
    public void update() {

    }

    @Override
    public void render() {

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new basicGame();
    }
}

the Game class can be found under dwarf/engine/core and offers a basic methods for create a basic application window.

the main game loops consist of three void function (load, update, draw). On starting the application the update loop shall run once and the game will update and render(draw) until the loop is broken. The super constructor can take three parameters (width, height, title), they do what you would expect them to do to the window and by default are 800, 600 and null.

and this is what is should give you:

just your average plain black window. to change you background colour use the function dwarf.graphics.util.setBackgroundColour(). it takes paramitors of what colour you want to be using RGB or RGBA but there are static colours for the basic ones.

and there you have it a window that you can set the background colour for.

Table of contents

[Javadoc](http: 95.85.60.226 javadoc )

Clone this wiki locally