updated all menus and fixed titlelogo.

This commit is contained in:
Allexit 2015-05-17 16:26:47 +03:00
parent ceb9a8d18f
commit 49d4040b96
3 changed files with 28 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,6 +1,8 @@
package com.saltosion.gladiator.gui.creators; package com.saltosion.gladiator.gui.creators;
import com.saltosion.gladiator.gui.nodes.ButtonNode; import com.saltosion.gladiator.gui.nodes.ButtonNode;
import com.saltosion.gladiator.gui.nodes.GUINode;
import com.saltosion.gladiator.gui.nodes.ImageNode;
import com.saltosion.gladiator.gui.nodes.TextNode; import com.saltosion.gladiator.gui.nodes.TextNode;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Name; import com.saltosion.gladiator.util.Name;
@ -12,13 +14,18 @@ public class GameOverGUICreator implements GUICreator {
@Override @Override
public void create() { public void create() {
TextNode titleText = new TextNode("game_title", "Gladiator Brawler Game Thing!"); ImageNode backgroundImg = new ImageNode("background_image",
titleText.setPosition(0.23f, 0.8f); SpriteLoader.loadSprite(Name.MENU_BACKGROUND));
AppUtil.guiManager.getRootNode().addChild(titleText); backgroundImg.setPosition(.5f, .5f);
AppUtil.guiManager.getRootNode().addChild(backgroundImg);
GUINode menuNode = new GUINode("menu-node");
menuNode.setPosition(-.5f, -.5f);
backgroundImg.addChild(menuNode);
TextNode gameOverText = new TextNode("game_over", "Game over"); TextNode gameOverText = new TextNode("game_over", "Game over");
gameOverText.setPosition(0.415f, 0.6f); gameOverText.setPosition(0.315f, 0.6f);
AppUtil.guiManager.getRootNode().addChild(gameOverText); menuNode.addChild(gameOverText);
ButtonNode playButton = new ButtonNode("return_button", SpriteLoader.loadSprite(Name.BUTTON_BIG), ButtonNode playButton = new ButtonNode("return_button", SpriteLoader.loadSprite(Name.BUTTON_BIG),
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) { SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
@ -31,11 +38,11 @@ public class GameOverGUICreator implements GUICreator {
shouldReturn = true; shouldReturn = true;
} }
}; };
playButton.setPosition(0.5f, 0.4f); playButton.setPosition(0.4f, 0.4f);
TextNode playButtonText = new TextNode("return_button_text", "Main Menu"); TextNode playButtonText = new TextNode("return_button_text", "Main Menu");
playButtonText.setPosition(-0.09f, 0.0175f); playButtonText.setPosition(-0.09f, 0.0175f);
playButton.addChild(playButtonText); playButton.addChild(playButtonText);
AppUtil.guiManager.getRootNode().addChild(playButton); menuNode.addChild(playButton);
} }
public boolean shouldReturn() { public boolean shouldReturn() {

View File

@ -1,6 +1,8 @@
package com.saltosion.gladiator.gui.creators; package com.saltosion.gladiator.gui.creators;
import com.saltosion.gladiator.gui.nodes.ButtonNode; import com.saltosion.gladiator.gui.nodes.ButtonNode;
import com.saltosion.gladiator.gui.nodes.GUINode;
import com.saltosion.gladiator.gui.nodes.ImageNode;
import com.saltosion.gladiator.gui.nodes.TextNode; import com.saltosion.gladiator.gui.nodes.TextNode;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Name; import com.saltosion.gladiator.util.Name;
@ -12,13 +14,18 @@ public class WinGUICreator implements GUICreator {
@Override @Override
public void create() { public void create() {
TextNode titleText = new TextNode("game_title", "Gladiator Brawler Game Thing!"); ImageNode backgroundImg = new ImageNode("background_image",
titleText.setPosition(0.23f, 0.8f); SpriteLoader.loadSprite(Name.MENU_BACKGROUND));
AppUtil.guiManager.getRootNode().addChild(titleText); backgroundImg.setPosition(.5f, .5f);
AppUtil.guiManager.getRootNode().addChild(backgroundImg);
GUINode menuNode = new GUINode("menu-node");
menuNode.setPosition(-.5f, -.5f);
backgroundImg.addChild(menuNode);
TextNode gameOverText = new TextNode("win", "You win!"); TextNode gameOverText = new TextNode("win", "You win!");
gameOverText.setPosition(0.415f, 0.6f); gameOverText.setPosition(0.315f, 0.6f);
AppUtil.guiManager.getRootNode().addChild(gameOverText); menuNode.addChild(gameOverText);
ButtonNode playButton = new ButtonNode("return_button", SpriteLoader.loadSprite(Name.BUTTON_BIG), ButtonNode playButton = new ButtonNode("return_button", SpriteLoader.loadSprite(Name.BUTTON_BIG),
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) { SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
@ -31,11 +38,11 @@ public class WinGUICreator implements GUICreator {
shouldReturn = true; shouldReturn = true;
} }
}; };
playButton.setPosition(0.5f, 0.4f); playButton.setPosition(0.4f, 0.4f);
TextNode playButtonText = new TextNode("return_button_text", "Main Menu"); TextNode playButtonText = new TextNode("return_button_text", "Main Menu");
playButtonText.setPosition(-0.09f, 0.0175f); playButtonText.setPosition(-0.09f, 0.0175f);
playButton.addChild(playButtonText); playButton.addChild(playButtonText);
AppUtil.guiManager.getRootNode().addChild(playButton); menuNode.addChild(playButton);
} }
public boolean shouldReturn() { public boolean shouldReturn() {