summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-11-21 03:38:52 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-03 23:49:57 +0100
commit0f2eef4278b258bb59968686b48f7de0ecd923e3 (patch)
treec7a0e159ee5490d4b34f8048a3b2dcb7230d0189 /src/main.cpp
parent074236254a3e648914142e21a53b41fbc35e58d8 (diff)
downloadmana-0f2eef4278b258bb59968686b48f7de0ecd923e3.tar.gz
mana-0f2eef4278b258bb59968686b48f7de0ecd923e3.tar.bz2
mana-0f2eef4278b258bb59968686b48f7de0ecd923e3.tar.xz
mana-0f2eef4278b258bb59968686b48f7de0ecd923e3.zip
Added the setup button to show when the client is loaded, since all of
the settings in it can be changed on client startup and aren't game specific.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7da504ec..c192b041 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -64,6 +64,7 @@
#include "gui/ok_dialog.h"
#include "gui/progressbar.h"
#include "gui/register.h"
+#include "gui/setup.h"
#include "gui/updatewindow.h"
#include "gui/textfield.h"
@@ -86,6 +87,16 @@
#include <SDL_syswm.h>
#endif
+namespace {
+ struct SetupListener : public gcn::ActionListener
+ {
+ /**
+ * Called when receiving actions from widget.
+ */
+ void action(const gcn::ActionEvent &event);
+ } listener;
+}
+
// Account infos
char n_server, n_character;
@@ -111,6 +122,8 @@ LoginData loginData;
LockedArray<LocalPlayer*> charInfo(MAX_SLOT + 1);
+extern Window *setupWindow;
+
// This anonymous namespace hides whatever is inside from other modules.
namespace {
@@ -408,6 +421,7 @@ void exit_engine()
delete gui;
delete graphics;
+ delete setupWindow;
// Shutdown libxml
xmlCleanupParser();
@@ -675,6 +689,7 @@ int main(int argc, char *argv[])
Game *game = NULL;
Window *currentDialog = NULL;
Image *login_wallpaper = NULL;
+ setupWindow = new Setup();
gcn::Container *top = static_cast<gcn::Container*>(gui->getTop());
#ifdef PACKAGE_VERSION
@@ -687,6 +702,9 @@ int main(int argc, char *argv[])
top->add(progressLabel, 15 + progressBar->getWidth(),
progressBar->getY() + 4);
progressBar->setVisible(false);
+ gcn::Button *setup = new Button("Setup", "Setup", &listener);
+ setup->setPosition(top->getWidth() - setup->getWidth() - 3, 3);
+ top->add(setup);
sound.playMusic("Magick - Real.ogg");
@@ -964,3 +982,22 @@ int main(int argc, char *argv[])
PHYSFS_deinit();
return 0;
}
+
+void SetupListener::action(const gcn::ActionEvent &event)
+{
+ Window *window = NULL;
+
+ if (event.getId() == "Setup")
+ {
+ window = setupWindow;
+ }
+
+ if (window)
+ {
+ window->setVisible(!window->isVisible());
+ if (window->isVisible())
+ {
+ window->requestMoveToTop();
+ }
+ }
+}