forked from Kolyah35/minecraft-pe-0.6.1
FEAT: Option button in PauseScreen
This commit is contained in:
@@ -153,8 +153,12 @@ void OptionsScreen::buttonClicked(Button* button) {
|
|||||||
|
|
||||||
if (button == btnClose) {
|
if (button == btnClose) {
|
||||||
minecraft->options.save();
|
minecraft->options.save();
|
||||||
|
if (minecraft->screen != NULL) {
|
||||||
|
minecraft->setScreen(NULL);
|
||||||
|
} else {
|
||||||
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
|
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (button->id > 1 && button->id < 7) {
|
else if (button->id > 1 && button->id < 7) {
|
||||||
int categoryButton = button->id - categoryButtons[0]->id;
|
int categoryButton = button->id - categoryButtons[0]->id;
|
||||||
selectCategory(categoryButton);
|
selectCategory(categoryButton);
|
||||||
|
|||||||
@@ -5,12 +5,16 @@
|
|||||||
#include "../../../util/Mth.h"
|
#include "../../../util/Mth.h"
|
||||||
#include "../../../network/RakNetInstance.h"
|
#include "../../../network/RakNetInstance.h"
|
||||||
#include "../../../network/ServerSideNetworkHandler.h"
|
#include "../../../network/ServerSideNetworkHandler.h"
|
||||||
|
#include "client/Options.h"
|
||||||
|
#include "client/gui/components/Button.h"
|
||||||
|
#include "client/gui/screens/OptionsScreen.h"
|
||||||
|
|
||||||
PauseScreen::PauseScreen(bool wasBackPaused)
|
PauseScreen::PauseScreen(bool wasBackPaused)
|
||||||
: saveStep(0),
|
: saveStep(0),
|
||||||
visibleTime(0),
|
visibleTime(0),
|
||||||
bContinue(0),
|
bContinue(0),
|
||||||
bQuit(0),
|
bQuit(0),
|
||||||
|
bOptions(0),
|
||||||
bQuitAndSaveLocally(0),
|
bQuitAndSaveLocally(0),
|
||||||
bServerVisibility(0),
|
bServerVisibility(0),
|
||||||
// bThirdPerson(0),
|
// bThirdPerson(0),
|
||||||
@@ -39,18 +43,21 @@ PauseScreen::~PauseScreen() {
|
|||||||
delete bQuit;
|
delete bQuit;
|
||||||
delete bQuitAndSaveLocally;
|
delete bQuitAndSaveLocally;
|
||||||
delete bServerVisibility;
|
delete bServerVisibility;
|
||||||
|
delete bOptions;
|
||||||
// delete bThirdPerson;
|
// delete bThirdPerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseScreen::init() {
|
void PauseScreen::init() {
|
||||||
if (minecraft->useTouchscreen()) {
|
if (minecraft->useTouchscreen()) {
|
||||||
bContinue = new Touch::TButton(1, "Back to game");
|
bContinue = new Touch::TButton(1, "Back to game");
|
||||||
|
bOptions = new Touch::TButton(5, "Options");
|
||||||
bQuit = new Touch::TButton(2, "Quit to title");
|
bQuit = new Touch::TButton(2, "Quit to title");
|
||||||
bQuitAndSaveLocally = new Touch::TButton(3, "Quit and copy map");
|
bQuitAndSaveLocally = new Touch::TButton(3, "Quit and copy map");
|
||||||
bServerVisibility = new Touch::TButton(4, "");
|
bServerVisibility = new Touch::TButton(4, "");
|
||||||
// bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view");
|
// bThirdPerson = new Touch::TButton(5, "Toggle 3:rd person view");
|
||||||
} else {
|
} else {
|
||||||
bContinue = new Button(1, "Back to game");
|
bContinue = new Button(1, "Back to game");
|
||||||
|
bOptions = new Button(5, "Options");
|
||||||
bQuit = new Button(2, "Quit to title");
|
bQuit = new Button(2, "Quit to title");
|
||||||
bQuitAndSaveLocally = new Button(3, "Quit and copy map");
|
bQuitAndSaveLocally = new Button(3, "Quit and copy map");
|
||||||
bServerVisibility = new Button(4, "");
|
bServerVisibility = new Button(4, "");
|
||||||
@@ -59,7 +66,7 @@ void PauseScreen::init() {
|
|||||||
|
|
||||||
buttons.push_back(bContinue);
|
buttons.push_back(bContinue);
|
||||||
buttons.push_back(bQuit);
|
buttons.push_back(bQuit);
|
||||||
|
buttons.push_back(bOptions);
|
||||||
// bSound.updateImage(&minecraft->options);
|
// bSound.updateImage(&minecraft->options);
|
||||||
bThirdPerson.updateImage(&minecraft->options);
|
bThirdPerson.updateImage(&minecraft->options);
|
||||||
bHideGui.updateImage(&minecraft->options);
|
bHideGui.updateImage(&minecraft->options);
|
||||||
@@ -99,21 +106,24 @@ void PauseScreen::setupPositions() {
|
|||||||
saveStep = 0;
|
saveStep = 0;
|
||||||
int yBase = 16;
|
int yBase = 16;
|
||||||
|
|
||||||
bContinue->width = bQuit->width = /*bThirdPerson->w =*/ 160;
|
bContinue->width = bOptions->width = bQuit->width = /*bThirdPerson->w =*/ 160;
|
||||||
bQuitAndSaveLocally->width = bServerVisibility->width = 160;
|
bQuitAndSaveLocally->width = bServerVisibility->width = 160;
|
||||||
|
|
||||||
bContinue->x = (width - bContinue->width) / 2;
|
bContinue->x = (width - bContinue->width) / 2;
|
||||||
bContinue->y = yBase + 32 * 1;
|
bContinue->y = yBase + 32 * 1;
|
||||||
|
|
||||||
|
bOptions->x = (width - bOptions->width) / 2;
|
||||||
|
bOptions->y = yBase + 32 * 2;
|
||||||
|
|
||||||
bQuit->x = (width - bQuit->width) / 2;
|
bQuit->x = (width - bQuit->width) / 2;
|
||||||
bQuit->y = yBase + 32 * 2;
|
bQuit->y = yBase + 32 * 3;
|
||||||
|
|
||||||
#if APPLE_DEMO_PROMOTION
|
#if APPLE_DEMO_PROMOTION
|
||||||
bQuit->y += 16;
|
bQuit->y += 16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2;
|
bQuitAndSaveLocally->x = bServerVisibility->x = (width - bQuitAndSaveLocally->width) / 2;
|
||||||
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 3;
|
bQuitAndSaveLocally->y = bServerVisibility->y = yBase + 32 * 4;
|
||||||
|
|
||||||
// bSound.y = bThirdPerson.y = 8;
|
// bSound.y = bThirdPerson.y = 8;
|
||||||
// bSound.x = 4;
|
// bSound.x = 4;
|
||||||
@@ -157,7 +167,9 @@ void PauseScreen::buttonClicked(Button* button) {
|
|||||||
if (button->id == bQuitAndSaveLocally->id) {
|
if (button->id == bQuitAndSaveLocally->id) {
|
||||||
minecraft->leaveGame(true);
|
minecraft->leaveGame(true);
|
||||||
}
|
}
|
||||||
|
if (button->id == bOptions->id) {
|
||||||
|
minecraft->setScreen(new OptionsScreen());
|
||||||
|
}
|
||||||
if (button->id == bServerVisibility->id) {
|
if (button->id == bServerVisibility->id) {
|
||||||
if (minecraft->raknetInstance && minecraft->netCallback && minecraft->raknetInstance->isServer()) {
|
if (minecraft->raknetInstance && minecraft->netCallback && minecraft->raknetInstance->isServer()) {
|
||||||
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) minecraft->netCallback;
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) minecraft->netCallback;
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ private:
|
|||||||
Button* bQuit;
|
Button* bQuit;
|
||||||
Button* bQuitAndSaveLocally;
|
Button* bQuitAndSaveLocally;
|
||||||
Button* bServerVisibility;
|
Button* bServerVisibility;
|
||||||
// Button* bThirdPerson;
|
Button* bOptions;
|
||||||
|
|
||||||
|
// Button* bThirdPerson;
|
||||||
|
|
||||||
// OptionButton bSound;
|
// OptionButton bSound;
|
||||||
OptionButton bThirdPerson;
|
OptionButton bThirdPerson;
|
||||||
|
|||||||
Reference in New Issue
Block a user