mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-20 06:53:30 +00:00
Add "Quit Game" button
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "OptionsScreen.h"
|
||||
#include "PauseScreen.h"
|
||||
#include "PrerenderTilesScreen.h" // test button
|
||||
#include "../components/ImageButton.h"
|
||||
|
||||
#include "../../../util/Mth.h"
|
||||
|
||||
@@ -25,7 +26,8 @@
|
||||
StartMenuScreen::StartMenuScreen()
|
||||
: bHost( 2, 0, 0, 160, 24, "Start Game"),
|
||||
bJoin( 3, 0, 0, 160, 24, "Join Game"),
|
||||
bOptions( 4, 0, 0, 78, 22, "Options")
|
||||
bOptions( 4, 0, 0, 78, 22, "Options"),
|
||||
bQuit( 5, "")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,10 +56,18 @@ void StartMenuScreen::init()
|
||||
tabButtons.push_back(&bOptions);
|
||||
#endif
|
||||
|
||||
#ifdef DEMO_MODE
|
||||
buttons.push_back(&bBuy);
|
||||
tabButtons.push_back(&bBuy);
|
||||
#endif
|
||||
// add quit button (top right X icon) – match OptionsScreen style
|
||||
{
|
||||
ImageDef def;
|
||||
def.name = "gui/touchgui.png";
|
||||
def.width = 34;
|
||||
def.height = 26;
|
||||
def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height));
|
||||
bQuit.setImageDef(def, true);
|
||||
bQuit.scaleWhenPressed = false;
|
||||
buttons.push_back(&bQuit);
|
||||
// don't include in tab navigation
|
||||
}
|
||||
|
||||
copyright = "\xffMojang AB";//. Do not distribute!";
|
||||
|
||||
@@ -100,8 +110,9 @@ void StartMenuScreen::setupPositions() {
|
||||
bJoin.x = (width - bJoin.width) / 2;
|
||||
bOptions.x = (width - bJoin.width) / 2;
|
||||
|
||||
copyrightPosX = width - minecraft->font->width(copyright) - 1;
|
||||
versionPosX = (width - minecraft->font->width(version)) / 2;// - minecraft->font->width(version) - 2;
|
||||
// position quit icon at top-right (use image-defined size)
|
||||
bQuit.x = width - bQuit.width;
|
||||
bQuit.y = 0;
|
||||
}
|
||||
|
||||
void StartMenuScreen::tick() {
|
||||
@@ -130,6 +141,10 @@ void StartMenuScreen::buttonClicked(Button* button) {
|
||||
{
|
||||
minecraft->setScreen(new OptionsScreen());
|
||||
}
|
||||
if (button == &bQuit)
|
||||
{
|
||||
minecraft->quit();
|
||||
}
|
||||
}
|
||||
|
||||
bool StartMenuScreen::isInGameScreen() { return false; }
|
||||
|
||||
Reference in New Issue
Block a user