diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 680ea9c86..f352547e0 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -44,7 +44,7 @@ add_openmw_dir (mwgui itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview tradeitemmodel companionitemmodel pickpocketitemmodel controllers savegamedialog recharge mode videowidget backgroundimage itemwidget screenfader debugwindow spellmodel spellview - draganddrop timeadvancer jailscreen myguiplatform myguirendermanager myguidatamanager myguitexture + draganddrop timeadvancer jailscreen ) add_openmw_dir (mwdialogue @@ -107,9 +107,6 @@ endif(WIN32) find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) -# for MyGUI platform -find_package(OpenGL REQUIRED) - if (NOT ANDROID) add_executable(openmw ${OPENMW_FILES} @@ -139,7 +136,6 @@ target_link_libraries(openmw ${BULLET_LIBRARIES} ${MYGUI_LIBRARIES} ${SDL2_LIBRARY} - ${OPENGL_gl_LIBRARY} "osg-ffmpeg-videoplayer" "oics" components diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index e2e09bdec..488c94501 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -343,7 +343,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) osg::ref_ptr guiRoot = new osg::Group; guiRoot->setNodeMask(MWRender::Mask_GUI); rootNode->addChild(guiRoot); - MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem->getTextureManager(), + MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem.get(), mCfgMgr.getLogPath().string() + std::string("/"), myguiResources, mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts, mFallbackMap); mEnvironment.setWindowManager (window); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index ce1314c6f..cac4939ed 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -26,8 +26,12 @@ #include +#include + #include +#include + #include #include @@ -91,13 +95,11 @@ #include "controllers.hpp" #include "jailscreen.hpp" -#include "myguiplatform.hpp" - namespace MWGui { WindowManager::WindowManager( - osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::TextureManager* textureManager + osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem , const std::string& logpath, const std::string& resourcePath, bool consoleOnlyScripts, Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map& fallbackMap) : mConsoleOnlyScripts(consoleOnlyScripts) @@ -173,7 +175,7 @@ namespace MWGui , mCurrentModals() , mFallbackMap(fallbackMap) { - mGuiPlatform = new Platform(viewer, guiRoot, textureManager); + mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getTextureManager()); mGuiPlatform->initialise(resourcePath, logpath); MyGUI::Gui* gui = new MyGUI::Gui; diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 738690bbc..894c81ec9 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -38,20 +38,6 @@ namespace Translation class Storage; } -namespace OEngine -{ - namespace GUI - { - class Layout; - class MyGUIManager; - } - - namespace Render - { - class OgreRenderer; - } -} - namespace osg { class Group; @@ -63,7 +49,7 @@ namespace osgViewer namespace Resource { - class TextureManager; + class ResourceSystem; } namespace SFO @@ -71,6 +57,11 @@ namespace SFO class CursorManager; } +namespace osgMyGUI +{ + class Platform; +} + namespace MWGui { class WindowBase; @@ -107,15 +98,13 @@ namespace MWGui class DebugWindow; class JailScreen; - class Platform; - class WindowManager : public MWBase::WindowManager { public: typedef std::pair Faction; typedef std::vector FactionList; - WindowManager(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::TextureManager* textureManager, + WindowManager(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem, const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts, Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map& fallbackMap); virtual ~WindowManager(); @@ -365,7 +354,7 @@ namespace MWGui virtual void cycleWeapon(bool next); private: - Platform* mGuiPlatform; + osgMyGUI::Platform* mGuiPlatform; bool mConsoleOnlyScripts; diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index a5e18dd49..775e3da19 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -223,6 +223,8 @@ namespace MWSound { if (found->first.size() >= pattern.size() && found->first.substr(0, pattern.size()) == pattern) filelist.push_back(found->first); + else + break; ++found; } diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index 26590c796..f7ef9b276 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -33,15 +33,9 @@ namespace Loading class Listener; } -namespace Render -{ - class OgreRenderer; -} - namespace MWRender { class SkyManager; - class CellRender; class RenderingManager; } @@ -59,7 +53,6 @@ namespace MWWorld private: - //OEngine::Render::OgreRenderer& mRenderer; CellStore* mCurrentCell; // the cell the player is in CellStoreCollection mActiveCells; bool mCellChanged; diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index e9655b12e..447bb1300 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -53,15 +53,9 @@ namespace Files class Collections; } -namespace Render -{ - class OgreRenderer; -} - namespace MWRender { class SkyManager; - class CellRender; class Animation; class Camera; } diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index cc913912f..563a77268 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -20,6 +20,8 @@ else (GIT_CHECKOUT) configure_file(${VERSION_HPP_IN} ${VERSION_HPP}) endif (GIT_CHECKOUT) +find_package(OpenGL REQUIRED) + # source files add_component_dir (settings @@ -116,6 +118,10 @@ add_component_dir (ogreinit ogreinit ogreplugin ) +add_component_dir (myguiplatform + myguirendermanager myguidatamanager myguiplatform myguitexture + ) + add_component_dir (widgets box imagebutton tags list numericeditbox sharedstatebutton windowcaption widgets ) @@ -170,6 +176,8 @@ target_link_libraries(components ${OGRE_LIBRARIES} ${OENGINE_LIBRARY} ${OPENSCENEGRAPH_LIBRARIES} + # For MyGUI platform + ${OPENGL_gl_LIBRARY} ) if (GIT_CHECKOUT) diff --git a/apps/openmw/mwgui/myguidatamanager.cpp b/components/myguiplatform/myguidatamanager.cpp similarity index 98% rename from apps/openmw/mwgui/myguidatamanager.cpp rename to components/myguiplatform/myguidatamanager.cpp index 5ba54b009..69bc3878d 100644 --- a/apps/openmw/mwgui/myguidatamanager.cpp +++ b/components/myguiplatform/myguidatamanager.cpp @@ -7,7 +7,7 @@ #include -namespace MWGui +namespace osgMyGUI { void DataManager::setResourcePath(const std::string &path) diff --git a/apps/openmw/mwgui/myguidatamanager.hpp b/components/myguiplatform/myguidatamanager.hpp similarity index 89% rename from apps/openmw/mwgui/myguidatamanager.hpp rename to components/myguiplatform/myguidatamanager.hpp index eaf60f8b9..5002f0fb7 100644 --- a/apps/openmw/mwgui/myguidatamanager.hpp +++ b/components/myguiplatform/myguidatamanager.hpp @@ -1,9 +1,9 @@ -#ifndef OPENMW_MWGUI_MYGUIDATAMANAGER_H -#define OPENMW_MWGUI_MYGUIDATAMANAGER_H +#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIDATAMANAGER_H +#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIDATAMANAGER_H #include -namespace MWGui +namespace osgMyGUI { diff --git a/apps/openmw/mwgui/myguiplatform.cpp b/components/myguiplatform/myguiplatform.cpp similarity index 100% rename from apps/openmw/mwgui/myguiplatform.cpp rename to components/myguiplatform/myguiplatform.cpp diff --git a/apps/openmw/mwgui/myguiplatform.hpp b/components/myguiplatform/myguiplatform.hpp similarity index 92% rename from apps/openmw/mwgui/myguiplatform.hpp rename to components/myguiplatform/myguiplatform.hpp index a2256e970..5079b23b0 100644 --- a/apps/openmw/mwgui/myguiplatform.hpp +++ b/components/myguiplatform/myguiplatform.hpp @@ -1,5 +1,5 @@ -#ifndef OPENMW_MWGUI_MYGUIPLATFORM_H -#define OPENMW_MWGUI_MYGUIPLATFORM_H +#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H +#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H #include "MyGUI_Prerequest.h" #include "MyGUI_LogManager.h" @@ -7,7 +7,7 @@ #include "myguirendermanager.hpp" #include "myguidatamanager.hpp" -namespace MWGui +namespace osgMyGUI { class Platform diff --git a/apps/openmw/mwgui/myguirendermanager.cpp b/components/myguiplatform/myguirendermanager.cpp similarity index 97% rename from apps/openmw/mwgui/myguirendermanager.cpp rename to components/myguiplatform/myguirendermanager.cpp index e5160bb5b..3ebbd957a 100644 --- a/apps/openmw/mwgui/myguirendermanager.cpp +++ b/components/myguiplatform/myguirendermanager.cpp @@ -48,24 +48,24 @@ namespace // Proxy to forward a Drawable's draw call to RenderManager::drawFrame class Renderable : public osg::Drawable { - MWGui::RenderManager *mParent; + osgMyGUI::RenderManager *mParent; virtual void drawImplementation(osg::RenderInfo &renderInfo) const { mParent->drawFrame(renderInfo); } public: - Renderable(MWGui::RenderManager *parent=nullptr) : mParent(parent) { } + Renderable(osgMyGUI::RenderManager *parent=nullptr) : mParent(parent) { } Renderable(const Renderable ©, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) : osg::Drawable(copy, copyop) , mParent(copy.mParent) { } - META_Object(MWGui, Renderable) + META_Object(osgMyGUI, Renderable) }; // Proxy to forward an OSG resize event to RenderManager::setViewSize class ResizeHandler : public osgGA::GUIEventHandler { - MWGui::RenderManager *mParent; + osgMyGUI::RenderManager *mParent; virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) { @@ -79,19 +79,19 @@ class ResizeHandler : public osgGA::GUIEventHandler { } public: - ResizeHandler(MWGui::RenderManager *parent=nullptr) : mParent(parent) { } + ResizeHandler(osgMyGUI::RenderManager *parent=nullptr) : mParent(parent) { } ResizeHandler(const ResizeHandler ©, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) : osg::Object(copy, copyop), osgGA::GUIEventHandler(copy, copyop) , mParent(copy.mParent) { } - META_Object(MWGui, ResizeHandler) + META_Object(osgMyGUI, ResizeHandler) }; } -namespace MWGui +namespace osgMyGUI { class OSGVertexBuffer : public MyGUI::IVertexBuffer diff --git a/apps/openmw/mwgui/myguirendermanager.hpp b/components/myguiplatform/myguirendermanager.hpp similarity index 95% rename from apps/openmw/mwgui/myguirendermanager.hpp rename to components/myguiplatform/myguirendermanager.hpp index 513edb5b7..05d0f9a5a 100644 --- a/apps/openmw/mwgui/myguirendermanager.hpp +++ b/components/myguiplatform/myguirendermanager.hpp @@ -1,5 +1,5 @@ -#ifndef OPENMW_MWGUI_MYGUIRENDERMANAGER_H -#define OPENMW_MWGUI_MYGUIRENDERMANAGER_H +#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIRENDERMANAGER_H +#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIRENDERMANAGER_H #include @@ -22,7 +22,7 @@ namespace osg class RenderInfo; } -namespace MWGui +namespace osgMyGUI { class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget diff --git a/apps/openmw/mwgui/myguitexture.cpp b/components/myguiplatform/myguitexture.cpp similarity index 99% rename from apps/openmw/mwgui/myguitexture.cpp rename to components/myguiplatform/myguitexture.cpp index d61e396f1..7de7ebfb0 100644 --- a/apps/openmw/mwgui/myguitexture.cpp +++ b/components/myguiplatform/myguitexture.cpp @@ -7,7 +7,7 @@ #include -namespace MWGui +namespace osgMyGUI { OSGTexture::OSGTexture(const std::string &name, Resource::TextureManager* textureManager) diff --git a/apps/openmw/mwgui/myguitexture.hpp b/components/myguiplatform/myguitexture.hpp similarity index 92% rename from apps/openmw/mwgui/myguitexture.hpp rename to components/myguiplatform/myguitexture.hpp index 5ae34a3d6..de385e94d 100644 --- a/apps/openmw/mwgui/myguitexture.hpp +++ b/components/myguiplatform/myguitexture.hpp @@ -1,5 +1,5 @@ -#ifndef OPENMW_MWGUI_MYGUITEXTURE_H -#define OPENMW_MWGUI_MYGUITEXTURE_H +#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUITEXTURE_H +#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUITEXTURE_H #include @@ -16,7 +16,7 @@ namespace Resource class TextureManager; } -namespace MWGui +namespace osgMyGUI { class OSGTexture : public MyGUI::ITexture { diff --git a/components/widgets/imagebutton.hpp b/components/widgets/imagebutton.hpp index bed6a2794..10150c6b1 100644 --- a/components/widgets/imagebutton.hpp +++ b/components/widgets/imagebutton.hpp @@ -1,5 +1,5 @@ -#ifndef MWGUI_IMAGEBUTTON_H -#define MWGUI_IMAGEBUTTON_H +#ifndef OPENMW_COMPONENTS_WIDGETS_IMAGEBUTTON_H +#define OPENMW_COMPONENTS_WIDGETS_IMAGEBUTTON_H #include diff --git a/components/widgets/list.hpp b/components/widgets/list.hpp index 72c8a733c..6ee2ef3f2 100644 --- a/components/widgets/list.hpp +++ b/components/widgets/list.hpp @@ -1,5 +1,5 @@ -#ifndef MWGUI_LIST_HPP -#define MWGUI_LIST_HPP +#ifndef OPENMW_COMPONENTS_WIDGETS_LIST_HPP +#define OPENMW_COMPONENTS_WIDGETS_LIST_HPP #include