summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-11-21 03:38:52 +0000
committerIra Rice <irarice@gmail.com>2008-11-21 03:38:52 +0000
commitbe621542a7330c43c6d586286c4ef7411f83b6ea (patch)
tree2be77363e552ed17d070d9f509705b98da44de03 /src/main.cpp
parent22aa43fac05d9a7f61f776bd03230b36ed853ad5 (diff)
downloadmana-be621542a7330c43c6d586286c4ef7411f83b6ea.tar.gz
mana-be621542a7330c43c6d586286c4ef7411f83b6ea.tar.bz2
mana-be621542a7330c43c6d586286c4ef7411f83b6ea.tar.xz
mana-be621542a7330c43c6d586286c4ef7411f83b6ea.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 bebf4591..b1bfa4c1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -59,6 +59,7 @@
#include "gui/ok_dialog.h"
#include "gui/progressbar.h"
#include "gui/register.h"
+#include "gui/setup.h"
#include "gui/textfield.h"
#include "gui/updatewindow.h"
@@ -94,6 +95,16 @@
#include <sys/stat.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;
@@ -120,6 +131,8 @@ LockedArray<LocalPlayer*> charInfo(MAX_SLOT + 1);
Colour *textColour;
+extern Window *setupWindow;
+
// This anonymous namespace hides whatever is inside from other modules.
namespace {
@@ -417,6 +430,7 @@ void exit_engine()
delete gui;
delete graphics;
+ delete setupWindow;
// Shutdown libxml
xmlCleanupParser();
@@ -699,6 +713,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
@@ -711,6 +726,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");
@@ -1018,3 +1036,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();
+ }
+ }
+}