summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/setup.cpp7
-rw-r--r--src/gui/widgets/desktop.cpp8
-rw-r--r--src/gui/widgets/desktop.h6
-rw-r--r--src/main.cpp50
-rw-r--r--src/main.h6
5 files changed, 46 insertions, 31 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 50068c6e..b2474ead 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -21,6 +21,8 @@
#include "setup.h"
+#include "main.h"
+
#include "gui/setup_audio.h"
#include "gui/setup_colors.h"
#include "gui/setup_joystick.h"
@@ -29,6 +31,7 @@
#include "gui/setup_video.h"
#include "gui/widgets/button.h"
+#include "gui/widgets/label.h"
#include "gui/widgets/tabbedarea.h"
#include "utils/dtor.h"
@@ -101,6 +104,10 @@ Setup::Setup():
add(panel);
+ Label *version = new Label(Main::version);
+ version->setPosition(5, height - version->getHeight() - 5);
+ add(version);
+
center();
setInGame(false);
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index fc66ed93..4b806095 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -22,6 +22,7 @@
#include "gui/widgets/desktop.h"
#include "gui/palette.h"
+#include "gui/widgets/label.h"
#include "resources/image.h"
#include "resources/resourcemanager.h"
@@ -29,6 +30,7 @@
#include "graphics.h"
#include "log.h"
+#include "main.h"
Desktop::Desktop()
: mWallpaper(0)
@@ -36,12 +38,16 @@ Desktop::Desktop()
addWidgetListener(this);
Wallpaper::loadWallpapers();
+
+ versionLabel = new Label(Main::version);
+ add(versionLabel, 25, 2);
}
Desktop::~Desktop()
{
if (mWallpaper)
mWallpaper->decRef();
+ delete versionLabel;
}
void Desktop::reloadWallpaper()
@@ -73,6 +79,8 @@ void Desktop::draw(gcn::Graphics *graphics)
(getWidth() - mWallpaper->getWidth()) / 2,
(getHeight() - mWallpaper->getHeight()) / 2);
}
+
+ drawChildren(graphics);
}
void Desktop::setBestFittingWallpaper()
diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h
index ed68145a..7eabde54 100644
--- a/src/gui/widgets/desktop.h
+++ b/src/gui/widgets/desktop.h
@@ -22,10 +22,11 @@
#ifndef DESKTOP_H
#define DESKTOP_H
-#include <guichan/widget.hpp>
+#include <guichan/widgets/container.hpp>
#include <guichan/widgetlistener.hpp>
class Image;
+class Label;
/**
* Desktop widget, for drawing a background image and color.
@@ -38,7 +39,7 @@ class Image;
*
* \ingroup GUI
*/
-class Desktop : public gcn::Widget, gcn::WidgetListener
+class Desktop : public gcn::Container, gcn::WidgetListener
{
public:
Desktop();
@@ -57,6 +58,7 @@ class Desktop : public gcn::Widget, gcn::WidgetListener
void setBestFittingWallpaper();
Image *mWallpaper;
+ Label *versionLabel;
};
#endif // DESKTOP_H
diff --git a/src/main.cpp b/src/main.cpp
index d10403b5..a42e8b82 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -164,6 +164,20 @@ Graphics *graphics;
unsigned char state;
std::string errorMessage;
+namespace Main {
+#ifdef PACKAGE_VERSION
+#ifdef TMWSERV_SUPPORT
+const std::string version = strprintf("v%s (tmwserv)", PACKAGE_VERSION);
+#else
+const std::string version = strprintf("v%s (eAthena)", PACKAGE_VERSION);
+#endif
+#else
+const std::string version = _("Unknown Version");
+#endif
+}
+
+Desktop *desktop;
+
Sound sound;
Music *bgm;
@@ -580,10 +594,10 @@ static void printHelp()
static void printVersion()
{
#ifdef PACKAGE_VERSION
- std::cout << _("The Mana World version ") << PACKAGE_VERSION << std::endl;
+ std::cout << _("The Mana World version ") << Main::version << std::endl;
#else
- std::cout << _("The Mana World version ") <<
- _("(local build?, PACKAGE_VERSION is not defined)") << std::endl;
+ std::cout << _("The Mana World version ") << Main::version <<
+ _("(local build?)") << std::endl;
#endif
}
@@ -896,17 +910,7 @@ int main(int argc, char *argv[])
logger->setLogFile(homeDir + std::string("/tmw.log"));
// Log the tmw version
- logger->log("The Mana World %s (%s)",
-#ifdef PACKAGE_VERSION
- "v" PACKAGE_VERSION,
-#else
- "- version not defined",
-#endif
-#ifdef TMWSERV_SUPPORT
- "tmwserv");
-#else
- "eAthena");
-#endif
+ logger->log("The Mana World %s", Main::version.c_str());
initConfiguration(options);
logger->setLogToStandardOut(config.getValue("logToStandardOut", 0));
@@ -924,16 +928,8 @@ int main(int argc, char *argv[])
setupWindow = new Setup;
gcn::Container *top = static_cast<gcn::Container*>(gui->getTop());
- Desktop *desktop = new Desktop;
+ desktop = new Desktop;
top->add(desktop);
-#ifdef PACKAGE_VERSION
-#ifdef TMWSERV_SUPPORT
- gcn::Label *versionLabel = new Label(strprintf("%s (tmwserv)", PACKAGE_VERSION));
-#else
- gcn::Label *versionLabel = new Label(strprintf("%s (eAthena)", PACKAGE_VERSION));
-#endif
- top->add(versionLabel, 25, 2);
-#endif
ProgressBar *progressBar = new ProgressBar(0.0f, 100, 20, 168, 116, 31);
gcn::Label *progressLabel = new Label;
top->add(progressBar, 5, top->getHeight() - 5 - progressBar->getHeight());
@@ -1477,10 +1473,6 @@ int main(int argc, char *argv[])
case STATE_GAME:
sound.fadeOutMusic(1000);
-#ifdef PACKAGE_VERSION
- delete versionLabel;
- versionLabel = NULL;
-#endif
delete progressBar;
delete progressLabel;
delete setupButton;
@@ -1571,8 +1563,8 @@ int main(int argc, char *argv[])
}
delete guiPalette;
-
- //delete Net::getGeneralHandler();
+ top->remove(desktop);
+ delete desktop;
logger->log("Quitting");
exitEngine();
diff --git a/src/main.h b/src/main.h
index 4f29425f..95f779eb 100644
--- a/src/main.h
+++ b/src/main.h
@@ -128,4 +128,10 @@ extern char n_server, n_character;
extern unsigned char state;
extern std::string errorMessage;
+namespace Main {
+
+extern const std::string version;
+
+}
+
#endif