Intro.java
01 package rtype;
02 
03 import org.lwjgl.input.Keyboard;
04 import org.lwjgl.opengl.Display;
05 import org.lwjgl.util.vector.Vector2f;
06 
07 import rtype.entity.IEntity;
08 import rtype.entity.Planet;
09 import rtype.entity.Text;
10 
11 public class Intro {
12 
13   private Layer layer; 
14   private Prototyp prototyp;
15   boolean introOn = true;
16   
17   public Intro(Prototyp prototyp)
18   {
19     this.prototyp = prototyp;
20     
21     Planet planet= new Planet(IEntity.PLANET);
22       planet.spawn(new Vector2f(320,0),new Vector2f(7f*-1,0),Prototyp.background);
23     
24     layer = new Layer();
25     
26     Text title = new Text (" . Prototyp .");
27     Text commandLabel = new Text("- Commands -");
28     Text commandLabel0 = new Text("P            : Pause.");
29     Text commandLabel1 = new Text("F1           : Start homing missile.");
30     Text commandLabel2 = new Text("F2           : Start enemy waves.");
31     Text commandLabel3 = new Text("X            : Detach/Move Orb.");
32     Text commandLabel4 = new Text("Arrow key    : Move.");
33     Text commandLabel5 = new Text("Space        : Fire ( maintain to charge).");
34     Text commandLabel6 = new Text("Press SPACE to Start !!");
35     Vector2f immobile = new Vector2f(0,0);
36     
37     int pointY = 240;
38     int pointX = -270;
39     int interspace = 20;
40     
41     title.spawn(new Vector2f(pointX+160,pointY -=interspace*4), immobile, layer);
42     commandLabel.spawn(new Vector2f(pointX+200,pointY -=interspace*4), immobile, layer);
43     commandLabel0.spawn(new Vector2f(pointX,pointY -=interspace*2), immobile, layer);
44     commandLabel1.spawn(new Vector2f(pointX,pointY -=interspace), immobile, layer);
45     commandLabel2.spawn(new Vector2f(pointX,pointY -=interspace), immobile, layer);
46     commandLabel3.spawn(new Vector2f(pointX,pointY -=interspace), immobile, layer);
47     commandLabel4.spawn(new Vector2f(pointX,pointY -=interspace), immobile, layer);
48     commandLabel5.spawn(new Vector2f(pointX,pointY -=interspace), immobile, layer);
49     commandLabel6.spawn(new Vector2f(pointX+150,pointY -=interspace*3), immobile, layer);
50 
51     
52     KeyListener space = new KeyListener()
53     {
54         public void onKeyUp()
55         {
56           introOn = false;
57           Prototyp.timer.resume();
58         }
59     };
60     
61     EventManager.instance().addListener(Keyboard.KEY_SPACE,space);
62   }
63   
64   public void play()
65   {
66       Prototyp.timer.pause();
67 
68       while (introOn)
69       {
70         
71         prototyp.update();
72             
73         prototyp.render();
74         layer.render();
75         
76         Display.update();
77         
78         if (prototyp.exitRequested())
79         {
80           introOn = false;
81           prototyp.gameOff = true;
82         }
83         
84         EventManager.instance().checkEvents();
85       }
86 
87       EventManager.instance().clear();
88   }
89 }