2007-04-23 16:26:39 +00:00
|
|
|
package ei.game.hud;
|
|
|
|
|
|
|
|
|
|
import ei.engine.LWJGLGameWindow;
|
|
|
|
|
import ei.engine.effects.BitmapText;
|
|
|
|
|
import ei.engine.math.Vector2f;
|
|
|
|
|
import ei.engine.scene.Node;
|
2007-04-23 19:33:27 +00:00
|
|
|
import ei.engine.scene.Sprite;
|
2007-04-23 16:26:39 +00:00
|
|
|
import ei.game.player.Player;
|
|
|
|
|
|
|
|
|
|
public class InGameHud {
|
|
|
|
|
private Node hudNode;
|
|
|
|
|
private BitmapText money;
|
|
|
|
|
private Player player;
|
|
|
|
|
|
|
|
|
|
public InGameHud(Player p){
|
|
|
|
|
player = p;
|
|
|
|
|
|
|
|
|
|
hudNode = new Node("Hud");
|
|
|
|
|
|
2007-04-23 19:33:27 +00:00
|
|
|
Sprite moneyBack = new Sprite("MoneyBackground","data/hud/money.png");
|
|
|
|
|
moneyBack.setLocation(new Vector2f(
|
|
|
|
|
LWJGLGameWindow.getWidth()-moneyBack.getSize().getX()/2,
|
|
|
|
|
moneyBack.getSize().getY()/2));
|
|
|
|
|
hudNode.add(moneyBack);
|
|
|
|
|
|
2007-04-23 16:26:39 +00:00
|
|
|
money = new BitmapText("MoneyMeter");
|
2007-04-23 19:33:27 +00:00
|
|
|
money.setLocation(new Vector2f(LWJGLGameWindow.getWidth()-money.getBound().width,5));
|
2007-04-23 16:26:39 +00:00
|
|
|
hudNode.add(money);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void update(){
|
|
|
|
|
money.setText(""+player.getKredits());
|
2007-04-23 19:33:27 +00:00
|
|
|
money.setLocation(new Vector2f(LWJGLGameWindow.getWidth()-money.getBound().width,5));
|
2007-04-23 16:26:39 +00:00
|
|
|
|
|
|
|
|
player.addKredits(100);
|
|
|
|
|
|
|
|
|
|
hudNode.setLocation(new Vector2f(
|
|
|
|
|
LWJGLGameWindow.getCamera().getLocation().getX(),
|
|
|
|
|
LWJGLGameWindow.getCamera().getLocation().getY()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Node getNode(){
|
|
|
|
|
return hudNode;
|
|
|
|
|
}
|
|
|
|
|
}
|