Skip to content

2. Project setup and loading demos

Hyrdaboo edited this page Jul 6, 2023 · 1 revision

Getting Started

First go to releases and download the latest release. How to setup your project obviously depends on your IDE you are using but in this tutorial I'll be using eclipse.

  • Extract the archive somewhere on your computer
  • Open up eclipse
  • Click Create a project > Java project
  • Name it whatever you like and click finish

Configuring build path

  • Right click on your project and click Build Path > Configure build path
  • In the libraries tab click on Add External JARs

  • Choose DwarfGameEngine.jar that you have extracted earlier and click Apply and Close
  • Now create a new Class name it Main and copy-pase this code:
import Demos.DemoSceneLoader;

public class Main {

	public static void main(String[] args) {
		DemoSceneLoader loader = new DemoSceneLoader();
		loader.Initialize(1280, 720, 0);
	}
	
}

This will load the demos for you to look at. However there is a small problem that we need to solve and that is the Content Assist not working. It's because we haven't told it which source file the jar uses so let's do that now

  • Go to BuildPath again and choose the jar we added earlier and expand it. Click on Source attachment

  • Choose External Location > External File and choose the DwarfGameEngineSrc.jar that you have extracted earlier
  • Now the Content Assist should work!
  • One last step we should before we can check out the demos is we need to add the DemoResource folder to the project. It is located in the archive with the jars so drag and drop it into your project and you are good to go. It should all look like this:

In the next tutorial we'll look at how we can create our own scenes

Clone this wiki locally