Move MyGUI platform to components

c++11
scrawl 10 years ago
parent db7fe1952d
commit a59940a2c7

@ -44,7 +44,7 @@ add_openmw_dir (mwgui
itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview
tradeitemmodel companionitemmodel pickpocketitemmodel controllers savegamedialog tradeitemmodel companionitemmodel pickpocketitemmodel controllers savegamedialog
recharge mode videowidget backgroundimage itemwidget screenfader debugwindow spellmodel spellview recharge mode videowidget backgroundimage itemwidget screenfader debugwindow spellmodel spellview
draganddrop timeadvancer jailscreen myguiplatform myguirendermanager myguidatamanager myguitexture draganddrop timeadvancer jailscreen
) )
add_openmw_dir (mwdialogue add_openmw_dir (mwdialogue
@ -107,9 +107,6 @@ endif(WIN32)
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
# for MyGUI platform
find_package(OpenGL REQUIRED)
if (NOT ANDROID) if (NOT ANDROID)
add_executable(openmw add_executable(openmw
${OPENMW_FILES} ${OPENMW_FILES}
@ -139,7 +136,6 @@ target_link_libraries(openmw
${BULLET_LIBRARIES} ${BULLET_LIBRARIES}
${MYGUI_LIBRARIES} ${MYGUI_LIBRARIES}
${SDL2_LIBRARY} ${SDL2_LIBRARY}
${OPENGL_gl_LIBRARY}
"osg-ffmpeg-videoplayer" "osg-ffmpeg-videoplayer"
"oics" "oics"
components components

@ -343,7 +343,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
osg::ref_ptr<osg::Group> guiRoot = new osg::Group; osg::ref_ptr<osg::Group> guiRoot = new osg::Group;
guiRoot->setNodeMask(MWRender::Mask_GUI); guiRoot->setNodeMask(MWRender::Mask_GUI);
rootNode->addChild(guiRoot); 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, mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts, mFallbackMap); mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts, mFallbackMap);
mEnvironment.setWindowManager (window); mEnvironment.setWindowManager (window);

@ -26,8 +26,12 @@
#include <components/fontloader/fontloader.hpp> #include <components/fontloader/fontloader.hpp>
#include <components/resource/resourcesystem.hpp>
#include <components/translation/translation.hpp> #include <components/translation/translation.hpp>
#include <components/myguiplatform/myguiplatform.hpp>
#include <components/widgets/widgets.hpp> #include <components/widgets/widgets.hpp>
#include <components/widgets/tags.hpp> #include <components/widgets/tags.hpp>
@ -91,13 +95,11 @@
#include "controllers.hpp" #include "controllers.hpp"
#include "jailscreen.hpp" #include "jailscreen.hpp"
#include "myguiplatform.hpp"
namespace MWGui namespace MWGui
{ {
WindowManager::WindowManager( 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, , const std::string& logpath, const std::string& resourcePath, bool consoleOnlyScripts,
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string, std::string>& fallbackMap) Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string, std::string>& fallbackMap)
: mConsoleOnlyScripts(consoleOnlyScripts) : mConsoleOnlyScripts(consoleOnlyScripts)
@ -173,7 +175,7 @@ namespace MWGui
, mCurrentModals() , mCurrentModals()
, mFallbackMap(fallbackMap) , mFallbackMap(fallbackMap)
{ {
mGuiPlatform = new Platform(viewer, guiRoot, textureManager); mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getTextureManager());
mGuiPlatform->initialise(resourcePath, logpath); mGuiPlatform->initialise(resourcePath, logpath);
MyGUI::Gui* gui = new MyGUI::Gui; MyGUI::Gui* gui = new MyGUI::Gui;

@ -38,20 +38,6 @@ namespace Translation
class Storage; class Storage;
} }
namespace OEngine
{
namespace GUI
{
class Layout;
class MyGUIManager;
}
namespace Render
{
class OgreRenderer;
}
}
namespace osg namespace osg
{ {
class Group; class Group;
@ -63,7 +49,7 @@ namespace osgViewer
namespace Resource namespace Resource
{ {
class TextureManager; class ResourceSystem;
} }
namespace SFO namespace SFO
@ -71,6 +57,11 @@ namespace SFO
class CursorManager; class CursorManager;
} }
namespace osgMyGUI
{
class Platform;
}
namespace MWGui namespace MWGui
{ {
class WindowBase; class WindowBase;
@ -107,15 +98,13 @@ namespace MWGui
class DebugWindow; class DebugWindow;
class JailScreen; class JailScreen;
class Platform;
class WindowManager : public MWBase::WindowManager class WindowManager : public MWBase::WindowManager
{ {
public: public:
typedef std::pair<std::string, int> Faction; typedef std::pair<std::string, int> Faction;
typedef std::vector<Faction> FactionList; typedef std::vector<Faction> 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, const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts,
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string,std::string>& fallbackMap); Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string,std::string>& fallbackMap);
virtual ~WindowManager(); virtual ~WindowManager();
@ -365,7 +354,7 @@ namespace MWGui
virtual void cycleWeapon(bool next); virtual void cycleWeapon(bool next);
private: private:
Platform* mGuiPlatform; osgMyGUI::Platform* mGuiPlatform;
bool mConsoleOnlyScripts; bool mConsoleOnlyScripts;

@ -223,6 +223,8 @@ namespace MWSound
{ {
if (found->first.size() >= pattern.size() && found->first.substr(0, pattern.size()) == pattern) if (found->first.size() >= pattern.size() && found->first.substr(0, pattern.size()) == pattern)
filelist.push_back(found->first); filelist.push_back(found->first);
else
break;
++found; ++found;
} }

@ -33,15 +33,9 @@ namespace Loading
class Listener; class Listener;
} }
namespace Render
{
class OgreRenderer;
}
namespace MWRender namespace MWRender
{ {
class SkyManager; class SkyManager;
class CellRender;
class RenderingManager; class RenderingManager;
} }
@ -59,7 +53,6 @@ namespace MWWorld
private: private:
//OEngine::Render::OgreRenderer& mRenderer;
CellStore* mCurrentCell; // the cell the player is in CellStore* mCurrentCell; // the cell the player is in
CellStoreCollection mActiveCells; CellStoreCollection mActiveCells;
bool mCellChanged; bool mCellChanged;

@ -53,15 +53,9 @@ namespace Files
class Collections; class Collections;
} }
namespace Render
{
class OgreRenderer;
}
namespace MWRender namespace MWRender
{ {
class SkyManager; class SkyManager;
class CellRender;
class Animation; class Animation;
class Camera; class Camera;
} }

@ -20,6 +20,8 @@ else (GIT_CHECKOUT)
configure_file(${VERSION_HPP_IN} ${VERSION_HPP}) configure_file(${VERSION_HPP_IN} ${VERSION_HPP})
endif (GIT_CHECKOUT) endif (GIT_CHECKOUT)
find_package(OpenGL REQUIRED)
# source files # source files
add_component_dir (settings add_component_dir (settings
@ -116,6 +118,10 @@ add_component_dir (ogreinit
ogreinit ogreplugin ogreinit ogreplugin
) )
add_component_dir (myguiplatform
myguirendermanager myguidatamanager myguiplatform myguitexture
)
add_component_dir (widgets add_component_dir (widgets
box imagebutton tags list numericeditbox sharedstatebutton windowcaption widgets box imagebutton tags list numericeditbox sharedstatebutton windowcaption widgets
) )
@ -170,6 +176,8 @@ target_link_libraries(components
${OGRE_LIBRARIES} ${OGRE_LIBRARIES}
${OENGINE_LIBRARY} ${OENGINE_LIBRARY}
${OPENSCENEGRAPH_LIBRARIES} ${OPENSCENEGRAPH_LIBRARIES}
# For MyGUI platform
${OPENGL_gl_LIBRARY}
) )
if (GIT_CHECKOUT) if (GIT_CHECKOUT)

@ -7,7 +7,7 @@
#include <iostream> #include <iostream>
namespace MWGui namespace osgMyGUI
{ {
void DataManager::setResourcePath(const std::string &path) void DataManager::setResourcePath(const std::string &path)

@ -1,9 +1,9 @@
#ifndef OPENMW_MWGUI_MYGUIDATAMANAGER_H #ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIDATAMANAGER_H
#define OPENMW_MWGUI_MYGUIDATAMANAGER_H #define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIDATAMANAGER_H
#include <MyGUI_DataManager.h> #include <MyGUI_DataManager.h>
namespace MWGui namespace osgMyGUI
{ {

@ -1,5 +1,5 @@
#ifndef OPENMW_MWGUI_MYGUIPLATFORM_H #ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
#define OPENMW_MWGUI_MYGUIPLATFORM_H #define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIPLATFORM_H
#include "MyGUI_Prerequest.h" #include "MyGUI_Prerequest.h"
#include "MyGUI_LogManager.h" #include "MyGUI_LogManager.h"
@ -7,7 +7,7 @@
#include "myguirendermanager.hpp" #include "myguirendermanager.hpp"
#include "myguidatamanager.hpp" #include "myguidatamanager.hpp"
namespace MWGui namespace osgMyGUI
{ {
class Platform class Platform

@ -48,24 +48,24 @@ namespace
// Proxy to forward a Drawable's draw call to RenderManager::drawFrame // Proxy to forward a Drawable's draw call to RenderManager::drawFrame
class Renderable : public osg::Drawable { class Renderable : public osg::Drawable {
MWGui::RenderManager *mParent; osgMyGUI::RenderManager *mParent;
virtual void drawImplementation(osg::RenderInfo &renderInfo) const virtual void drawImplementation(osg::RenderInfo &renderInfo) const
{ mParent->drawFrame(renderInfo); } { mParent->drawFrame(renderInfo); }
public: public:
Renderable(MWGui::RenderManager *parent=nullptr) : mParent(parent) { } Renderable(osgMyGUI::RenderManager *parent=nullptr) : mParent(parent) { }
Renderable(const Renderable &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY) Renderable(const Renderable &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
: osg::Drawable(copy, copyop) : osg::Drawable(copy, copyop)
, mParent(copy.mParent) , mParent(copy.mParent)
{ } { }
META_Object(MWGui, Renderable) META_Object(osgMyGUI, Renderable)
}; };
// Proxy to forward an OSG resize event to RenderManager::setViewSize // Proxy to forward an OSG resize event to RenderManager::setViewSize
class ResizeHandler : public osgGA::GUIEventHandler { class ResizeHandler : public osgGA::GUIEventHandler {
MWGui::RenderManager *mParent; osgMyGUI::RenderManager *mParent;
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
{ {
@ -79,19 +79,19 @@ class ResizeHandler : public osgGA::GUIEventHandler {
} }
public: public:
ResizeHandler(MWGui::RenderManager *parent=nullptr) : mParent(parent) { } ResizeHandler(osgMyGUI::RenderManager *parent=nullptr) : mParent(parent) { }
ResizeHandler(const ResizeHandler &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY) ResizeHandler(const ResizeHandler &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
: osg::Object(copy, copyop), osgGA::GUIEventHandler(copy, copyop) : osg::Object(copy, copyop), osgGA::GUIEventHandler(copy, copyop)
, mParent(copy.mParent) , mParent(copy.mParent)
{ } { }
META_Object(MWGui, ResizeHandler) META_Object(osgMyGUI, ResizeHandler)
}; };
} }
namespace MWGui namespace osgMyGUI
{ {
class OSGVertexBuffer : public MyGUI::IVertexBuffer class OSGVertexBuffer : public MyGUI::IVertexBuffer

@ -1,5 +1,5 @@
#ifndef OPENMW_MWGUI_MYGUIRENDERMANAGER_H #ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIRENDERMANAGER_H
#define OPENMW_MWGUI_MYGUIRENDERMANAGER_H #define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIRENDERMANAGER_H
#include <MyGUI_RenderManager.h> #include <MyGUI_RenderManager.h>
@ -22,7 +22,7 @@ namespace osg
class RenderInfo; class RenderInfo;
} }
namespace MWGui namespace osgMyGUI
{ {
class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget

@ -7,7 +7,7 @@
#include <components/resource/texturemanager.hpp> #include <components/resource/texturemanager.hpp>
namespace MWGui namespace osgMyGUI
{ {
OSGTexture::OSGTexture(const std::string &name, Resource::TextureManager* textureManager) OSGTexture::OSGTexture(const std::string &name, Resource::TextureManager* textureManager)

@ -1,5 +1,5 @@
#ifndef OPENMW_MWGUI_MYGUITEXTURE_H #ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUITEXTURE_H
#define OPENMW_MWGUI_MYGUITEXTURE_H #define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUITEXTURE_H
#include <MyGUI_ITexture.h> #include <MyGUI_ITexture.h>
@ -16,7 +16,7 @@ namespace Resource
class TextureManager; class TextureManager;
} }
namespace MWGui namespace osgMyGUI
{ {
class OSGTexture : public MyGUI::ITexture { class OSGTexture : public MyGUI::ITexture {

@ -1,5 +1,5 @@
#ifndef MWGUI_IMAGEBUTTON_H #ifndef OPENMW_COMPONENTS_WIDGETS_IMAGEBUTTON_H
#define MWGUI_IMAGEBUTTON_H #define OPENMW_COMPONENTS_WIDGETS_IMAGEBUTTON_H
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>

@ -1,5 +1,5 @@
#ifndef MWGUI_LIST_HPP #ifndef OPENMW_COMPONENTS_WIDGETS_LIST_HPP
#define MWGUI_LIST_HPP #define OPENMW_COMPONENTS_WIDGETS_LIST_HPP
#include <MyGUI_ScrollView.h> #include <MyGUI_ScrollView.h>

Loading…
Cancel
Save