1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 20:15:34 +00:00

Merge branch 'require-3.4-mygui' into 'master'

Raise required MyGUI version to 3.4.1

See merge request OpenMW/openmw!1484
This commit is contained in:
psi29a 2021-12-17 07:14:41 +00:00
commit 2f7b98cecb
11 changed files with 21 additions and 94 deletions

View file

@ -399,7 +399,7 @@ set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost 1.6.2 REQUIRED COMPONENTS ${BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS})
if(OPENMW_USE_SYSTEM_MYGUI)
find_package(MyGUI 3.2.2 REQUIRED)
find_package(MyGUI 3.4.1 REQUIRED)
endif()
find_package(SDL2 2.0.9 REQUIRED)
find_package(OpenAL REQUIRED)

View file

@ -907,12 +907,6 @@ protected:
return {};
MyGUI::IntPoint pos (left, top);
#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3)
// work around inconsistency in MyGUI where the mouse press coordinates aren't
// transformed by the current Layer (even though mouse *move* events are).
if(!move)
pos = mNode->getLayer()->getPosition(left, top);
#endif
pos.left -= mCroppedParent->getAbsoluteLeft ();
pos.top -= mCroppedParent->getAbsoluteTop ();
pos.top += mViewTop;

View file

@ -93,19 +93,6 @@ void KeyboardNavigation::_unlinkWidget(MyGUI::Widget *widget)
mCurrentFocus = nullptr;
}
#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3)
void styleFocusedButton(MyGUI::Widget* w)
{
if (w)
{
if (MyGUI::Button* b = w->castType<MyGUI::Button>(false))
{
b->_setWidgetState("highlighted");
}
}
}
#endif
bool isRootParent(MyGUI::Widget* widget, MyGUI::Widget* root)
{
while (widget && widget->getParent())
@ -128,9 +115,6 @@ void KeyboardNavigation::onFrame()
if (focus == mCurrentFocus)
{
#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3)
styleFocusedButton(mCurrentFocus);
#endif
return;
}
@ -143,19 +127,8 @@ void KeyboardNavigation::onFrame()
if (focus != mCurrentFocus)
{
#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3)
if (mCurrentFocus)
{
if (MyGUI::Button* b = mCurrentFocus->castType<MyGUI::Button>(false))
b->_setWidgetState("normal");
}
#endif
mCurrentFocus = focus;
}
#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3)
styleFocusedButton(mCurrentFocus);
#endif
}
void KeyboardNavigation::setDefaultFocus(MyGUI::Widget *window, MyGUI::Widget *defaultFocus)

View file

@ -1,12 +0,0 @@
#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUICOMPAT_H
#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUICOMPAT_H
#include <MyGUI_Prerequest.h>
#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0)
#define OPENMW_MYGUI_CONST_GETTER_3_4_1 const
#else
#define OPENMW_MYGUI_CONST_GETTER_3_4_1
#endif
#endif // OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUICOMPAT_H

View file

@ -15,7 +15,7 @@ void DataManager::setResourcePath(const std::string &path)
mResourcePath = path;
}
MyGUI::IDataStream *DataManager::getData(const std::string &name) OPENMW_MYGUI_CONST_GETTER_3_4_1
MyGUI::IDataStream *DataManager::getData(const std::string &name) const
{
std::string fullpath = getDataPath(name);
std::unique_ptr<boost::filesystem::ifstream> stream;
@ -34,13 +34,13 @@ void DataManager::freeData(MyGUI::IDataStream *data)
delete data;
}
bool DataManager::isDataExist(const std::string &name) OPENMW_MYGUI_CONST_GETTER_3_4_1
bool DataManager::isDataExist(const std::string &name) const
{
std::string fullpath = mResourcePath + "/" + name;
return boost::filesystem::exists(fullpath);
}
const MyGUI::VectorString &DataManager::getDataListNames(const std::string &pattern) OPENMW_MYGUI_CONST_GETTER_3_4_1
const MyGUI::VectorString &DataManager::getDataListNames(const std::string &pattern) const
{
// TODO: pattern matching (unused?)
static MyGUI::VectorString strings;
@ -49,7 +49,7 @@ const MyGUI::VectorString &DataManager::getDataListNames(const std::string &patt
return strings;
}
const std::string &DataManager::getDataPath(const std::string &name) OPENMW_MYGUI_CONST_GETTER_3_4_1
const std::string &DataManager::getDataPath(const std::string &name) const
{
static std::string result;
result.clear();

View file

@ -3,8 +3,6 @@
#include <MyGUI_DataManager.h>
#include "myguicompat.h"
namespace osgMyGUI
{
@ -19,7 +17,7 @@ public:
/** Get data stream from specified resource name.
@param _name Resource name (usually file name).
*/
MyGUI::IDataStream* getData(const std::string& _name) OPENMW_MYGUI_CONST_GETTER_3_4_1 override;
MyGUI::IDataStream* getData(const std::string& _name) const override;
/** Free data stream.
@param _data Data stream.
@ -29,18 +27,18 @@ public:
/** Is data with specified name exist.
@param _name Resource name.
*/
bool isDataExist(const std::string& _name) OPENMW_MYGUI_CONST_GETTER_3_4_1 override;
bool isDataExist(const std::string& _name) const override;
/** Get all data names with names that matches pattern.
@param _pattern Pattern to match (for example "*.layout").
*/
const MyGUI::VectorString& getDataListNames(const std::string& _pattern) OPENMW_MYGUI_CONST_GETTER_3_4_1 override;
const MyGUI::VectorString& getDataListNames(const std::string& _pattern) const override;
/** Get full path to data.
@param _name Resource name.
@return Return full path to specified data.
*/
const std::string& getDataPath(const std::string& _name) OPENMW_MYGUI_CONST_GETTER_3_4_1 override;
const std::string& getDataPath(const std::string& _name) const override;
private:
std::string mResourcePath;

View file

@ -15,7 +15,6 @@
#include <components/shader/shadermanager.hpp>
#include <components/sceneutil/nodecallback.hpp>
#include "myguicompat.h"
#include "myguitexture.hpp"
#define MYGUI_PLATFORM_LOG_SECTION "Platform"
@ -276,7 +275,7 @@ public:
osg::VertexBufferObject* getVertexBuffer();
void setVertexCount(size_t count) override;
size_t getVertexCount() OPENMW_MYGUI_CONST_GETTER_3_4_1 override;
size_t getVertexCount() const override;
MyGUI::Vertex *lock() override;
void unlock() override;
@ -303,7 +302,7 @@ void OSGVertexBuffer::setVertexCount(size_t count)
mNeedVertexCount = count;
}
size_t OSGVertexBuffer::getVertexCount() OPENMW_MYGUI_CONST_GETTER_3_4_1
size_t OSGVertexBuffer::getVertexCount() const
{
return mNeedVertexCount;
}
@ -586,7 +585,6 @@ bool RenderManager::checkTexture(MyGUI::ITexture* _texture)
return true;
}
#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0)
void RenderManager::registerShader(
const std::string& _shaderName,
const std::string& _vertexProgramFile,
@ -594,6 +592,5 @@ void RenderManager::registerShader(
{
MYGUI_PLATFORM_LOG(Warning, "osgMyGUI::RenderManager::registerShader is not implemented");
}
#endif
}

View file

@ -5,8 +5,6 @@
#include <osg/ref_ptr>
#include "myguicompat.h"
namespace Resource
{
class ImageManager;
@ -79,7 +77,7 @@ public:
const MyGUI::IntSize& getViewSize() const override { return mViewSize; }
/** @see RenderManager::getVertexFormat */
MyGUI::VertexColourType getVertexFormat() OPENMW_MYGUI_CONST_GETTER_3_4_1 override
MyGUI::VertexColourType getVertexFormat() const override
{ return mVertexFormat; }
/** @see RenderManager::isFormatSupported */
@ -112,21 +110,13 @@ public:
void setInjectState(osg::StateSet* stateSet);
/** @see IRenderTarget::getInfo */
const MyGUI::RenderTargetInfo& getInfo() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mInfo; }
const MyGUI::RenderTargetInfo& getInfo() const override { return mInfo; }
bool checkTexture(MyGUI::ITexture* _texture);
// setViewSize() is a part of MyGUI::RenderManager interface since 3.4.0 release
#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3, 4, 0)
void setViewSize(int width, int height);
#else
void setViewSize(int width, int height) override;
#endif
// registerShader() is a part of MyGUI::RenderManager interface since 3.4.1 release
#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0)
void registerShader(const std::string& _shaderName, const std::string& _vertexProgramFile, const std::string& _fragmentProgramFile) override;
#endif
/*internal:*/

View file

@ -165,8 +165,6 @@ namespace osgMyGUI
return nullptr;
}
#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0)
void OSGTexture::setShader(const std::string& _shaderName)
{ Log(Debug::Warning) << "OSGTexture::setShader is not implemented"; }
#endif
}

View file

@ -5,12 +5,6 @@
#include <osg/ref_ptr>
#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0)
#define OPENMW_MYGUI_CONST_GETTER_3_4_1 const
#else
#define OPENMW_MYGUI_CONST_GETTER_3_4_1
#endif
namespace osg
{
class Image;
@ -57,21 +51,18 @@ namespace osgMyGUI
void* lock(MyGUI::TextureUsage access) override;
void unlock() override;
bool isLocked() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mLockedImage.valid(); }
bool isLocked() const override { return mLockedImage.valid(); }
int getWidth() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mWidth; }
int getHeight() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mHeight; }
int getWidth() const override { return mWidth; }
int getHeight() const override { return mHeight; }
MyGUI::PixelFormat getFormat() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mFormat; }
MyGUI::TextureUsage getUsage() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mUsage; }
size_t getNumElemBytes() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mNumElemBytes; }
MyGUI::PixelFormat getFormat() const override { return mFormat; }
MyGUI::TextureUsage getUsage() const override { return mUsage; }
size_t getNumElemBytes() const override { return mNumElemBytes; }
MyGUI::IRenderTarget *getRenderTarget() override;
// setShader() is a part of MyGUI::RenderManager interface since 3.4.1 release
#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0)
void setShader(const std::string& _shaderName) override;
#endif
void setShader(const std::string& _shaderName) override;
/*internal:*/
osg::Texture2D *getTexture() const { return mTexture.get(); }

View file

@ -3,8 +3,6 @@
#include <MyGUI_RenderManager.h>
#include <algorithm>
#include "myguicompat.h"
namespace osgMyGUI
{
@ -39,7 +37,7 @@ namespace osgMyGUI
mTarget->doRender(_buffer, _texture, _count);
}
const MyGUI::RenderTargetInfo& getInfo() OPENMW_MYGUI_CONST_GETTER_3_4_1 override
const MyGUI::RenderTargetInfo& getInfo() const override
{
mInfo = mTarget->getInfo();
mInfo.hOffset = mHOffset;