Added ui to the engine and buttons and implemented them in the game fixed also a mouse position problem
This commit is contained in:
parent
515281351c
commit
728a68cc48
35 changed files with 436 additions and 23 deletions
|
|
@ -9,11 +9,18 @@ import ei.engine.scene.Node;
|
|||
import ei.engine.scene.Sprite;
|
||||
import ei.game.player.Player;
|
||||
|
||||
/**
|
||||
* This clas handles the hud of the game
|
||||
* @author Ziver
|
||||
*
|
||||
*/
|
||||
public class InGameHud {
|
||||
private Node hudNode;
|
||||
private BitmapText money;
|
||||
private Player player;
|
||||
private ProgressBar buildBar;
|
||||
private InGameBuildHud buildHud;
|
||||
private Sprite buildBack;
|
||||
|
||||
public InGameHud(Player p){
|
||||
player = p;
|
||||
|
|
@ -30,7 +37,7 @@ public class InGameHud {
|
|||
money.setLocation(new Vector2f(LWJGLGameWindow.getWidth()-money.getBound().width,5));
|
||||
hudNode.add(money);
|
||||
|
||||
Sprite buildBack = new Sprite("BuildBackground","data/hud/buildmenu.png");
|
||||
buildBack = new Sprite("BuildBackground","data/hud/buildmenu.png");
|
||||
buildBack.setLocation(new Vector2f(
|
||||
LWJGLGameWindow.getWidth()/2,
|
||||
LWJGLGameWindow.getHeight()-buildBack.getSize().getY()/2));
|
||||
|
|
@ -43,6 +50,10 @@ public class InGameHud {
|
|||
LWJGLGameWindow.getWidth()/2+50,
|
||||
LWJGLGameWindow.getHeight()-55));
|
||||
hudNode.add(buildBar.getNode());
|
||||
|
||||
buildHud = new InGameBuildHud((int)(buildBack.getLocation().getX()-buildBack.getSize().getX()/4),
|
||||
(int)(buildBack.getLocation().getY()+10));
|
||||
hudNode.add(buildHud.getNode());
|
||||
}
|
||||
|
||||
public void update(){
|
||||
|
|
@ -59,4 +70,12 @@ public class InGameHud {
|
|||
public Node getNode(){
|
||||
return hudNode;
|
||||
}
|
||||
|
||||
public InGameBuildHud getBuildHud(){
|
||||
return buildHud;
|
||||
}
|
||||
|
||||
public Sprite getBuildBar(){
|
||||
return buildBack;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue