diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-28 01:04:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-28 01:43:09 +0300 |
commit | d16d5931663e856879ffb100423b0dedf0177b1e (patch) | |
tree | c6b8c696a8127b7ee19747004dbc0189f62bb715 /src/client.cpp | |
parent | 8149c3498148832fc6cfa20b1e2158310d7541b6 (diff) | |
download | manaplus-d16d5931663e856879ffb100423b0dedf0177b1e.tar.gz manaplus-d16d5931663e856879ffb100423b0dedf0177b1e.tar.bz2 manaplus-d16d5931663e856879ffb100423b0dedf0177b1e.tar.xz manaplus-d16d5931663e856879ffb100423b0dedf0177b1e.zip |
Add Close button on start screen under Android.
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/client.cpp b/src/client.cpp index 3d433dc04..0159469f3 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -265,6 +265,7 @@ Client::Client(const Options &options) : mVideoButton(nullptr), mThemesButton(nullptr), mPerfomanceButton(nullptr), + mCloseButton(nullptr), mState(STATE_CHOOSE_SERVER), mOldState(STATE_START), mIcon(nullptr), @@ -822,6 +823,12 @@ int Client::testsExec() const #endif } +#define ADDBUTTON(var, object) var = object; \ + x -= var->getWidth() + 6; \ + var->setPosition(x, 3); \ + top->add(var); + + int Client::gameExec() { int lastTickTime = tick_time; @@ -1004,29 +1011,20 @@ int Client::gameExec() mDesktop = new Desktop(nullptr); top->add(mDesktop); int x = top->getWidth(); - mSetupButton = new Button(mDesktop, _("Setup"), "Setup", this); - x -= mSetupButton->getWidth() + 3; - mSetupButton->setPosition(x, 3); - top->add(mSetupButton); - + ADDBUTTON(mSetupButton, new Button(mDesktop, + _("Setup"), "Setup", this)) #ifndef WIN32 - mPerfomanceButton = new Button(mDesktop, - _("Perfomance"), "Perfomance", this); - x -= mPerfomanceButton->getWidth() + 6; - mPerfomanceButton->setPosition(x, 3); - top->add(mPerfomanceButton); - - mVideoButton = new Button(mDesktop, _("Video"), "Video", this); - x -= mVideoButton->getWidth() + 6; - mVideoButton->setPosition(x, 3); - top->add(mVideoButton); - - mThemesButton = new Button(mDesktop, _("Themes"), "Themes", this); - x -= mThemesButton->getWidth() + 6; - mThemesButton->setPosition(x, 3); - top->add(mThemesButton); + ADDBUTTON(mPerfomanceButton, new Button(mDesktop, + _("Perfomance"), "Perfomance", this)) + ADDBUTTON(mVideoButton, new Button(mDesktop, + _("Video"), "Video", this)) + ADDBUTTON(mThemesButton, new Button(mDesktop, + _("Themes"), "Themes", this)) +#ifdef ANDROID + ADDBUTTON(mCloseButton, new Button(mDesktop, + _("Close"), "close", this)) +#endif #endif - mDesktop->setSize(mainGraphics->getWidth(), mainGraphics->getHeight()); } @@ -1575,14 +1573,17 @@ void Client::optionChanged(const std::string &name) void Client::action(const gcn::ActionEvent &event) { std::string tab; + const std::string &eventId = event.getId(); - if (event.getId() == "Setup") + if (eventId == "close") + setState(STATE_FORCE_QUIT); + else if (eventId == "Setup") tab = ""; - else if (event.getId() == "Video") + else if (eventId == "Video") tab = "Video"; - else if (event.getId() == "Themes") + else if (eventId == "Themes") tab = "Theme"; - else if (event.getId() == "Perfomance") + else if (eventId == "Perfomance") tab = "Perfomance"; else return; |