Added "Quit" button
This commit is contained in:
parent
e465931b2d
commit
e1c15c2465
@ -1,5 +1,6 @@
|
||||
package com.saltosion.gladiator.gui.creators;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.saltosion.gladiator.gui.nodes.ButtonNode;
|
||||
import com.saltosion.gladiator.gui.nodes.GUINode;
|
||||
import com.saltosion.gladiator.gui.nodes.ImageNode;
|
||||
@ -42,6 +43,25 @@ public class MainMenuGUICreator implements GUICreator {
|
||||
playButton.addChild(playButtonText);
|
||||
menuNode.addChild(playButton);
|
||||
|
||||
ButtonNode quitButton = new ButtonNode("quit_button", SpriteLoader.loadSprite(Name.BUTTON_BIG),
|
||||
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
|
||||
@Override
|
||||
public void pressed(int x, int y, int mouseButton) {
|
||||
playButtonPressSound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void released(int x, int y, int mouseButton) {
|
||||
playButtonReleaseSound();
|
||||
Gdx.app.exit();
|
||||
}
|
||||
};
|
||||
quitButton.setPosition(0.4f, 0.35f);
|
||||
TextNode quitButtonText = new TextNode("quit_button_text", "Quit");
|
||||
quitButtonText.setPosition(-0.039f, 0.0175f);
|
||||
quitButton.addChild(quitButtonText);
|
||||
menuNode.addChild(quitButton);
|
||||
|
||||
ImageNode titleImage = new ImageNode("title_image",
|
||||
SpriteLoader.loadSprite(Name.TITLE_LOGO));
|
||||
titleImage.setPosition(0.4f, 0.8f);
|
||||
|
Loading…
Reference in New Issue
Block a user