diff options
-rw-r--r-- | src/game.cpp | 10 | ||||
-rw-r--r-- | src/gui/gui.cpp | 8 | ||||
-rw-r--r-- | src/gui/gui.h | 1 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp index 62e7c515..08dacaa1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -129,6 +129,7 @@ ChannelManager *channelManager = NULL; CommandHandler *commandHandler = NULL; Particle *particleEngine = NULL; EffectManager *effectManager = NULL; +Viewport *viewport = NULL; /**< Viewport on the map. */ ChatTab *localChatTab = NULL; @@ -274,6 +275,14 @@ Game::Game(): disconnectedDialog = NULL; + // Create the viewport + viewport = new Viewport(); + viewport->setDimension(gcn::Rectangle(0, 0, graphics->getWidth(), + graphics->getHeight())); + + gcn::Container *top = static_cast<gcn::Container*>(gui->getTop()); + top->add(viewport); + createGuiWindows(); mWindowMenu = new WindowMenu; @@ -334,6 +343,7 @@ Game::~Game() delete commandHandler; delete joystick; delete particleEngine; + delete viewport; viewport->setMap(NULL); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 9a260b57..f99d6a21 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -46,7 +46,6 @@ // Guichan stuff Gui *gui = 0; -Viewport *viewport = 0; /**< Viewport on the map. */ SDLInput *guiInput = 0; // Bolded font @@ -138,12 +137,6 @@ Gui::Gui(Graphics *graphics): setUseCustomCursor(config.getValue("customcursor", 1) == 1); mConfigListener = new GuiConfigListener(this); config.addListener("customcursor", mConfigListener); - - // Create the viewport - viewport = new Viewport; - viewport->setDimension(gcn::Rectangle(0, 0, - graphics->getWidth(), graphics->getHeight())); - guiTop->add(viewport); } Gui::~Gui() @@ -157,7 +150,6 @@ Gui::~Gui() delete mGuiFont; delete boldFont; delete mInfoParticleFont; - delete viewport; delete getTop(); delete guiInput; diff --git a/src/gui/gui.h b/src/gui/gui.h index 31ac76f0..de29eb20 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -30,7 +30,6 @@ class Graphics; class GuiConfigListener; class ImageSet; class SDLInput; -class Viewport; /** * \defgroup GUI Core GUI related classes (widgets) |