From 4d74f85ae063c03a65b9f9c947be6645397ba0c0 Mon Sep 17 00:00:00 2001 From: Nicolay Korslund Date: Fri, 16 Jul 2010 22:27:50 +0200 Subject: [PATCH] Moved mwgui manager to components, ready for testing --- CMakeLists.txt | 11 ++++++----- apps/mygui_dev/main.cpp | 10 +++++----- apps/openmw/CMakeLists.txt | 6 ------ apps/openmw/engine.cpp | 4 ++-- apps/openmw/mwscript/guiextensions.cpp | 3 ++- apps/openmw/mwscript/interpretercontext.cpp | 2 +- {apps/openmw => components}/mwgui/guimanager.cpp | 2 ++ {apps/openmw => components}/mwgui/guimanager.hpp | 11 +++++++++++ components/{mw_gui => mwgui}/mw_layouts.hpp | 2 +- 9 files changed, 30 insertions(+), 21 deletions(-) rename {apps/openmw => components}/mwgui/guimanager.cpp (96%) rename {apps/openmw => components}/mwgui/guimanager.hpp (81%) rename components/{mw_gui => mwgui}/mw_layouts.hpp (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc6f3353a3..4d900978fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,8 +52,11 @@ source_group(components\\esm FILES ${ESM_HEADER}) # components/mw_gui set(MWGUI_HEADER - ${COMP_DIR}/mw_gui/mw_layouts.hpp) -source_group(components\\mw_gui FILES ${MWGUI_HEADER}) + ${COMP_DIR}/mwgui/mw_layouts.hpp + ${COMP_DIR}/mwgui/guimanager.hpp) +set(MWGUI + ${COMP_DIR}/mwgui/guimanager.cpp) +source_group(components\\mwgui FILES ${MWGUI_HEADER} ${MWGUI}) set(COMMANDSERVER ${COMP_DIR}/commandserver/command.hpp @@ -80,9 +83,7 @@ file(GLOB INTERPRETER_HEADER ${COMP_DIR}/interpreter/*.hpp) source_group(components\\interpreter FILES ${INTERPRETER} ${INTERPRETER_HEADER}) set(COMPONENTS ${BSA} ${NIF} ${NIFOGRE} ${ESM_STORE} ${MISC} - ${COMMANDSERVER} - ${COMPILER} - ${INTERPRETER}) + ${COMMANDSERVER} ${COMPILER} ${INTERPRETER} ${MWGUI}) set(COMPONENTS_HEADER ${BSA_HEADER} ${NIF_HEADER} ${NIFOGRE_HEADER} ${ESM_STORE_HEADER} ${ESM_HEADER} ${MISC_HEADER} ${COMPILER_HEADER} ${INTERPRETER_HEADER} ${MWGUI_HEADER}) diff --git a/apps/mygui_dev/main.cpp b/apps/mygui_dev/main.cpp index c21f1eb622..da39335ee4 100644 --- a/apps/mygui_dev/main.cpp +++ b/apps/mygui_dev/main.cpp @@ -7,7 +7,7 @@ using namespace std; #include -#include +#include #include #include @@ -74,10 +74,10 @@ int main() input.setEvent(Mangle::Input::EventPtr(evt)); cout << "Setting up the window layouts\n"; - MWGUI::HUD hud(w,h); - MWGUI::MapWindow map; - MWGUI::MainMenu menu(w,h); - MWGUI::StatsWindow stats; + MWGui::HUD hud(w,h); + MWGui::MapWindow map; + MWGui::MainMenu menu(w,h); + MWGui::StatsWindow stats; hud.setVisible(true); map.setVisible(true); diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 78b06d2b4b..473291535e 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -59,12 +59,6 @@ set(GAMESOUND_HEADER mwsound/soundmanager.hpp) source_group(apps\\openmw\\mwsound FILES ${GAMESOUND} ${GAMESOUND_HEADER}) -set(GAMEGUI - mwgui/guimanager.cpp) -set(GAMEGUI_HEADER - mwgui/guimanager.hpp) -source_group(apps\\openmw\\mwgui FILES ${GAMEGUI} ${GAMEGUI_HEADER}) - set(GAMEWORLD mwworld/world.cpp) set(GAMEWORLD_HEADER diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index a56c7838d5..7918c0cf88 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -7,6 +7,8 @@ #include #include +#include + #include "mwinput/inputmanager.hpp" #include "mwscript/scriptmanager.hpp" @@ -17,8 +19,6 @@ #include "mwsound/soundmanager.hpp" -#include "mwgui/guimanager.hpp" - #include "mwworld/world.hpp" #include "mwworld/ptr.hpp" #include "mwworld/environment.hpp" diff --git a/apps/openmw/mwscript/guiextensions.cpp b/apps/openmw/mwscript/guiextensions.cpp index 5758899a88..11a268cfb7 100644 --- a/apps/openmw/mwscript/guiextensions.cpp +++ b/apps/openmw/mwscript/guiextensions.cpp @@ -7,9 +7,10 @@ #include #include +#include + #include "interpretercontext.hpp" -#include "../mwgui/guimanager.hpp" namespace MWScript { diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 239c558bd9..cfa9acc570 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -9,7 +9,7 @@ #include "../mwworld/world.hpp" -#include "../mwgui/guimanager.hpp" +#include #include "locals.hpp" #include "globalscripts.hpp" diff --git a/apps/openmw/mwgui/guimanager.cpp b/components/mwgui/guimanager.cpp similarity index 96% rename from apps/openmw/mwgui/guimanager.cpp rename to components/mwgui/guimanager.cpp index b169ffac23..2ac98300a9 100644 --- a/apps/openmw/mwgui/guimanager.cpp +++ b/components/mwgui/guimanager.cpp @@ -3,6 +3,8 @@ #include +#include "mw_layouts.hpp" + namespace MWGui { void GuiManager::enableWindow (GuiWindow window) diff --git a/apps/openmw/mwgui/guimanager.hpp b/components/mwgui/guimanager.hpp similarity index 81% rename from apps/openmw/mwgui/guimanager.hpp rename to components/mwgui/guimanager.hpp index 2a27c9aa34..5e5d1cfddf 100644 --- a/apps/openmw/mwgui/guimanager.hpp +++ b/components/mwgui/guimanager.hpp @@ -3,8 +3,19 @@ namespace MWGui { + // Predeclarations, these are defined in mw_layouts.hpp + class HUD; + class MapWindow; + class MainMenu; + class StatsWindow; + class GuiManager { + HUD *hud; + MapWindow *map; + MainMenu *menu; + StatsWindow *stats; + public: enum GuiWindow diff --git a/components/mw_gui/mw_layouts.hpp b/components/mwgui/mw_layouts.hpp similarity index 99% rename from components/mw_gui/mw_layouts.hpp rename to components/mwgui/mw_layouts.hpp index 79feb80627..33b1bd7de3 100644 --- a/components/mw_gui/mw_layouts.hpp +++ b/components/mwgui/mw_layouts.hpp @@ -16,7 +16,7 @@ setVisible(). */ -namespace MWGUI +namespace MWGui { class HUD : public OEngine::GUI::Layout {