Added new images and created nearly final version of main menu

This commit is contained in:
Allexit 2015-05-17 16:04:11 +03:00
parent d70e438647
commit ceb9a8d18f
8 changed files with 66 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,6 +1,8 @@
package com.saltosion.gladiator.gui.creators;
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.util.AppUtil;
import com.saltosion.gladiator.util.Name;
@ -12,9 +14,14 @@ public class MainMenuGUICreator implements GUICreator {
@Override
public void create() {
TextNode titleText = new TextNode("game_title", "Gladiator Brawler Game Thing!");
titleText.setPosition(0.23f, 0.8f);
AppUtil.guiManager.getRootNode().addChild(titleText);
ImageNode backgroundImg = new ImageNode("background_image",
SpriteLoader.loadSprite(Name.MENU_BACKGROUND));
backgroundImg.setPosition(.5f, .5f);
AppUtil.guiManager.getRootNode().addChild(backgroundImg);
GUINode menuNode = new GUINode("menu-node");
menuNode.setPosition(-.5f, -.5f);
backgroundImg.addChild(menuNode);
ButtonNode playButton = new ButtonNode("play_button", SpriteLoader.loadSprite(Name.BUTTON_BIG),
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
@ -27,11 +34,26 @@ public class MainMenuGUICreator implements GUICreator {
shouldPlay = true;
}
};
playButton.setPosition(0.5f, 0.5f);
playButton.setPosition(0.4f, 0.5f);
TextNode playButtonText = new TextNode("play_button_text", "Play");
playButtonText.setPosition(-0.0325f, 0.0175f);
playButton.addChild(playButtonText);
AppUtil.guiManager.getRootNode().addChild(playButton);
menuNode.addChild(playButton);
ImageNode titleImage = new ImageNode("title_image",
SpriteLoader.loadSprite(Name.TITLE_LOGO));
titleImage.setPosition(0.4f, 0.8f);
menuNode.addChild(titleImage);
ImageNode gplLogo = new ImageNode("gpl_logo",
SpriteLoader.loadSprite(Name.GPLV3_LOGO));
gplLogo.setPosition(0.3f, 0.15f);
menuNode.addChild(gplLogo);
ImageNode osiLogo = new ImageNode("osi_logo",
SpriteLoader.loadSprite(Name.OSI_LOGO));
osiLogo.setPosition(0.5f, 0.15f);
menuNode.addChild(osiLogo);
}
public boolean shouldPlay() {

View File

@ -0,0 +1,29 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.saltosion.gladiator.gui.nodes;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.saltosion.gladiator.gui.properties.ImageProperty;
/**
*
* @author somersby
*/
public class ImageNode extends GUINode implements ImageProperty {
private Sprite image;
public ImageNode(String ID, Sprite image) {
super(ID);
this.image = image;
}
@Override
public Sprite getImage() {
return this.image;
}
}

View File

@ -18,6 +18,10 @@ public class Name {
public static final String BUTTON_BIG_HOVER = "BUTTON_BIG_HOVER";
public static final String BUTTON_SMALL = "BUTTON_SMALL";
public static final String BUTTON_SMALL_HOVER = "BUTTON_SMALL_HOVER";
public static final String TITLE_LOGO = "TITLE_LOGO";
public static final String MENU_BACKGROUND = "MENU_BACKGROUND";
public static final String GPLV3_LOGO = "GPLV3_LOGO";
public static final String OSI_LOGO = "OSI_LOGO";
public static final String MOVE_LEFT = "MOVE_LEFT";
public static final String MOVE_RIGHT = "MOVE_RIGHT";

View File

@ -24,6 +24,11 @@ public class SpriteLoader {
loadTexture(Name.BUTTON_BIG_HOVER, "sprites/buttons/button_big_hover.png");
loadTexture(Name.BUTTON_SMALL, "sprites/buttons/button_small.png");
loadTexture(Name.BUTTON_SMALL_HOVER, "sprites/buttons/button_small_hover.png");
loadTexture(Name.TITLE_LOGO, "sprites/title_logo.png");
loadTexture(Name.MENU_BACKGROUND, "sprites/menu_background.png");
loadTexture(Name.GPLV3_LOGO, "sprites/gplv3_logo.png");
loadTexture(Name.OSI_LOGO, "sprites/osi_logo.png");
}
/**