01 package tutorial;
02 import javax.media.opengl.GL;
03 import javax.media.opengl.GLDrawable;
04
05 import de.rico.engine.game.AbstractBaseGame;
06
07 /**
08 * A class that shows how to create the basic structure of a
09 * new 3d application
10 * @author Frank Bruns
11 *
12 */
13 public class NewApplication extends AbstractBaseGame
14 {
15 /**
16 * Constructor for the new game.
17 * @param title title for the window bar
18 * @param maxFps maximum possible framerate
19 */
20 public NewApplication(String title, int maxFps)
21 {
22 super(title, maxFps);
23 }
24
25 /* (non-Javadoc)
26 * @see de.rico.engine.game.AbstractBaseGame#initResources(javax.media.opengl.GLDrawable, javax.media.opengl.GL, int, int)
27 */
28 @Override
29 public void initResources(GLDrawable gld, GL gl, int width, int height)
30 {
31 // initialise your game resources here
32 }
33
34 /* (non-Javadoc)
35 * @see de.rico.engine.game.AbstractBaseGame#update(long)
36 */
37 @Override
38 public void update(long elapsedTime)
39 {
40 // update your game resources here
41 }
42
43 /* (non-Javadoc)
44 * @see de.rico.engine.game.AbstractBaseGame#draw(javax.media.opengl.GL)
45 */
46 @Override
47 public void draw(GL gl)
48 {
49 // draw your game resources here
50 }
51
52 public static void main(String args[])
53 {
54 // create a new game
55 NewApplication game = new NewApplication("Test Game", 100);
56
57 // initialise the camera --> needs to be done!
58 game.initCamera(0f, 0f, 0f, 0f, 0f, 0.1f, 200f);
59
60 // show framerate --> this is optional
61 game.setDisplayFPS(true);
62
63 // finally start the game
64 game.start(game);
65 }
66 }
|