summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/game.cpp b/src/game.cpp
index c934ed69..5b78bdb5 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -48,7 +48,7 @@
#include "gui/helpwindow.h"
#include "gui/inventorywindow.h"
#include "gui/shortcutwindow.h"
-#include "gui/minimap.h"
+#include "gui/minimapwindow.h"
#include "gui/ministatuswindow.h"
#include "gui/npcdialog.h"
#include "gui/okdialog.h"
@@ -63,10 +63,12 @@
#include "gui/textdialog.h"
#include "gui/tradewindow.h"
#include "gui/viewport.h"
+#include "gui/windowmenu.h"
#include "gui/widgets/chattab.h"
#include "gui/widgets/emoteshortcutcontainer.h"
#include "gui/widgets/itemshortcutcontainer.h"
+#include "gui/widgets/layout.h"
#include "net/gamehandler.h"
#include "net/net.h"
@@ -96,16 +98,13 @@ QuitDialog *quitDialog = NULL;
ChatWindow *chatWindow;
StatusWindow *statusWindow;
-MiniStatusWindow *miniStatusWindow;
InventoryWindow *inventoryWindow;
SkillDialog *skillDialog;
-Minimap *minimap;
EquipmentWindow *equipmentWindow;
TradeWindow *tradeWindow;
HelpWindow *helpWindow;
DebugWindow *debugWindow;
ShortcutWindow *itemShortcutWindow;
-ShortcutWindow *emoteShortcutWindow;
OutfitWindow *outfitWindow;
SpecialsWindow *specialsWindow;
SocialWindow *socialWindow;
@@ -147,8 +146,6 @@ static void createGuiWindows()
setupWindow->clearWindowsForReset();
// Create dialogs
- miniStatusWindow = new MiniStatusWindow;
- minimap = new Minimap;
chatWindow = new ChatWindow;
tradeWindow = new TradeWindow;
equipmentWindow = new EquipmentWindow(PlayerInfo::getEquipment());
@@ -159,11 +156,9 @@ static void createGuiWindows()
debugWindow = new DebugWindow;
itemShortcutWindow = new ShortcutWindow("ItemShortcut",
new ItemShortcutContainer);
- emoteShortcutWindow = new ShortcutWindow("EmoteShortcut",
- new EmoteShortcutContainer);
- outfitWindow = new OutfitWindow();
- specialsWindow = new SpecialsWindow();
- socialWindow = new SocialWindow();
+ outfitWindow = new OutfitWindow;
+ specialsWindow = new SpecialsWindow;
+ socialWindow = new SocialWindow;
localChatTab = new ChatTab(_("General"));
@@ -184,16 +179,13 @@ static void destroyGuiWindows()
del_0(localChatTab) // Need to do this first, so it can remove itself
del_0(chatWindow)
del_0(statusWindow)
- del_0(miniStatusWindow)
del_0(inventoryWindow)
del_0(skillDialog)
- del_0(minimap)
del_0(equipmentWindow)
del_0(tradeWindow)
del_0(helpWindow)
del_0(debugWindow)
del_0(itemShortcutWindow)
- del_0(emoteShortcutWindow)
del_0(outfitWindow)
del_0(specialsWindow)
del_0(socialWindow)
@@ -217,14 +209,22 @@ Game::Game():
viewport = new Viewport;
viewport->setSize(graphics->getWidth(), graphics->getHeight());
- gcn::Container *top = static_cast<gcn::Container*>(gui->getTop());
+ WindowContainer *top = static_cast<WindowContainer*>(gui->getTop());
top->add(viewport);
viewport->requestMoveToBottom();
- createGuiWindows();
-
mWindowMenu = new WindowMenu;
- windowContainer->add(mWindowMenu);
+ mMinimapWindow = new MinimapWindow;
+ mMiniStatusWindow = new MiniStatusWindow;
+
+ top->place(0, 0, mMinimapWindow);
+ top->place(1, 0, mMiniStatusWindow).setVAlign(Layout::LEFT);
+ top->place(3, 0, mWindowMenu)
+ .setHAlign(Layout::RIGHT)
+ .setVAlign(Layout::LEFT);
+ top->updateLayout();
+
+ createGuiWindows();
initEngines();
@@ -247,6 +247,11 @@ Game::~Game()
Event::trigger(Event::GameChannel, Event::Destructing);
delete mWindowMenu;
+ delete mMinimapWindow;
+ delete mMiniStatusWindow;
+
+ WindowContainer *top = static_cast<WindowContainer*>(gui->getTop());
+ top->clearLayout();
destroyGuiWindows();
@@ -665,9 +670,6 @@ void Game::handleInput()
case KeyboardConfig::KEY_WINDOW_SKILL:
requestedWindow = skillDialog;
break;
- case KeyboardConfig::KEY_WINDOW_MINIMAP:
- minimap->toggle();
- break;
case KeyboardConfig::KEY_WINDOW_CHAT:
requestedWindow = chatWindow;
break;
@@ -683,9 +685,6 @@ void Game::handleInput()
case KeyboardConfig::KEY_WINDOW_SOCIAL:
requestedWindow = socialWindow;
break;
- case KeyboardConfig::KEY_WINDOW_EMOTE_SHORTCUT:
- requestedWindow = emoteShortcutWindow;
- break;
case KeyboardConfig::KEY_WINDOW_OUTFIT:
requestedWindow = outfitWindow;
break;
@@ -937,7 +936,7 @@ void Game::changeMap(const std::string &mapPath)
}
// Notify the minimap and beingManager about the map change
- minimap->setMap(newMap);
+ mMinimapWindow->setMap(newMap);
actorSpriteManager->setMap(newMap);
particleEngine->setMap(newMap);
viewport->setMap(newMap);
@@ -981,8 +980,12 @@ int Game::getCurrentTileHeight() const
return DEFAULT_TILE_LENGTH;
}
+void Game::updateWindowMenuCaptions()
+{
+ mWindowMenu->updatePopUpCaptions();
+}
+
void Game::videoResized(int width, int height)
{
viewport->setSize(width, height);
- mWindowMenu->setPosition(width - 3 - mWindowMenu->getWidth(), 3);
}