Restore Irrlicht 1.9 support

This commit is contained in:
sfan5 2020-05-17 01:03:33 +02:00
parent 13b50f55a4
commit 3579dd2186
8 changed files with 56 additions and 14 deletions

@ -8,7 +8,13 @@
<string>minetest</string> <string>minetest</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>minetest-icon.icns</string> <string>minetest-icon.icns</string>
<key>CFBundleName</key>
<string>Minetest</string>
<key>CFBundleDisplayName</key>
<string>Minetest</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>net.minetest.minetest</string> <string>net.minetest.minetest</string>
<key>NSHighResolutionCapable</key>
<false/>
</dict> </dict>
</plist> </plist>

@ -35,7 +35,11 @@ void RenderingCoreInterlaced::initMaterial()
IShaderSource *s = client->getShaderSource(); IShaderSource *s = client->getShaderSource();
mat.UseMipMaps = false; mat.UseMipMaps = false;
mat.ZBuffer = false; mat.ZBuffer = false;
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
mat.ZWriteEnable = video::EZW_OFF;
#else
mat.ZWriteEnable = false; mat.ZWriteEnable = false;
#endif
u32 shader = s->getShader("3d_interlaced_merge", TILE_MATERIAL_BASIC); u32 shader = s->getShader("3d_interlaced_merge", TILE_MATERIAL_BASIC);
mat.MaterialType = s->getShaderInfo(shader).material; mat.MaterialType = s->getShaderInfo(shader).material;
for (int k = 0; k < 3; ++k) { for (int k = 0; k < 3; ++k) {

@ -325,9 +325,11 @@ static bool getWindowHandle(irr::video::IVideoDriver *driver, HWND &hWnd)
const video::SExposedVideoData exposedData = driver->getExposedVideoData(); const video::SExposedVideoData exposedData = driver->getExposedVideoData();
switch (driver->getDriverType()) { switch (driver->getDriverType()) {
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
case video::EDT_DIRECT3D8: case video::EDT_DIRECT3D8:
hWnd = reinterpret_cast<HWND>(exposedData.D3D8.HWnd); hWnd = reinterpret_cast<HWND>(exposedData.D3D8.HWnd);
break; break;
#endif
case video::EDT_DIRECT3D9: case video::EDT_DIRECT3D9:
hWnd = reinterpret_cast<HWND>(exposedData.D3D9.HWnd); hWnd = reinterpret_cast<HWND>(exposedData.D3D9.HWnd);
break; break;

@ -39,12 +39,13 @@ static video::SMaterial baseMaterial()
{ {
video::SMaterial mat; video::SMaterial mat;
mat.Lighting = false; mat.Lighting = false;
#if ENABLE_GLES #if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
mat.ZBuffer = video::ECFN_DISABLED; mat.ZBuffer = video::ECFN_DISABLED;
mat.ZWriteEnable = video::EZW_OFF;
#else #else
mat.ZWriteEnable = false;
mat.ZBuffer = video::ECFN_NEVER; mat.ZBuffer = video::ECFN_NEVER;
#endif #endif
mat.ZWriteEnable = false;
mat.AntiAliasing = 0; mat.AntiAliasing = 0;
mat.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; mat.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
mat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; mat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;

@ -506,6 +506,13 @@ video::SColor GUIButton::getOverrideColor() const
return OverrideColor; return OverrideColor;
} }
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
video::SColor GUIButton::getActiveColor() const
{
return video::SColor(0,0,0,0); // unused?
}
#endif
void GUIButton::enableOverrideColor(bool enable) void GUIButton::enableOverrideColor(bool enable)
{ {
OverrideColorEnabled = enable; OverrideColorEnabled = enable;

@ -69,6 +69,12 @@ using namespace irr;
class ISimpleTextureSource; class ISimpleTextureSource;
#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8)
#define OVERRIDE_19
#else
#define OVERRIDE_19 override
#endif
class GUIButton : public gui::IGUIButton class GUIButton : public gui::IGUIButton
{ {
public: public:
@ -97,22 +103,27 @@ public:
virtual gui::IGUIFont* getActiveFont() const override; virtual gui::IGUIFont* getActiveFont() const override;
//! Sets another color for the button text. //! Sets another color for the button text.
virtual void setOverrideColor(video::SColor color); virtual void setOverrideColor(video::SColor color) OVERRIDE_19;
//! Gets the override color //! Gets the override color
virtual video::SColor getOverrideColor(void) const; virtual video::SColor getOverrideColor(void) const OVERRIDE_19;
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
//! Gets the currently used text color
virtual video::SColor getActiveColor() const override;
#endif
//! Sets if the button text should use the override color or the color in the gui skin. //! Sets if the button text should use the override color or the color in the gui skin.
virtual void enableOverrideColor(bool enable); virtual void enableOverrideColor(bool enable) OVERRIDE_19;
//! Checks if an override color is enabled //! Checks if an override color is enabled
virtual bool isOverrideColorEnabled(void) const; virtual bool isOverrideColorEnabled(void) const OVERRIDE_19;
// PATCH // PATCH
//! Sets an image which should be displayed on the button when it is in the given state. //! Sets an image which should be displayed on the button when it is in the given state.
virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state, virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state,
video::ITexture* image=nullptr, video::ITexture* image=nullptr,
const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)); const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) OVERRIDE_19;
//! Sets an image which should be displayed on the button when it is in normal state. //! Sets an image which should be displayed on the button when it is in normal state.
virtual void setImage(video::ITexture* image=nullptr) override; virtual void setImage(video::ITexture* image=nullptr) override;
@ -141,7 +152,7 @@ public:
*/ */
virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index,
video::SColor color=video::SColor(255,255,255,255), video::SColor color=video::SColor(255,255,255,255),
bool loop=false, bool scale=false); bool loop=false, bool scale=false) OVERRIDE_19;
#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8) #if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8)
void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop) override { void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop) override {
@ -150,16 +161,16 @@ public:
#endif #endif
//! Get the sprite-index for the given state or -1 when no sprite is set //! Get the sprite-index for the given state or -1 when no sprite is set
virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const; virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19;
//! Get the sprite color for the given state. Color is only used when a sprite is set. //! Get the sprite color for the given state. Color is only used when a sprite is set.
virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const; virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19;
//! Returns if the sprite in the given state does loop //! Returns if the sprite in the given state does loop
virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const; virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19;
//! Returns if the sprite in the given state is scaled //! Returns if the sprite in the given state is scaled
virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const; virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19;
//! Sets if the button should behave like a push button. Which means it //! Sets if the button should behave like a push button. Which means it
//! can be in two states: Normal or Pressed. With a click on the button, //! can be in two states: Normal or Pressed. With a click on the button,
@ -199,13 +210,13 @@ public:
virtual bool isScalingImage() const override; virtual bool isScalingImage() const override;
//! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event //! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickShiftState() const virtual bool getClickShiftState() const OVERRIDE_19
{ {
return ClickShiftState; return ClickShiftState;
} }
//! Get if the control key was pressed in last EGET_BUTTON_CLICKED event //! Get if the control key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickControlState() const virtual bool getClickControlState() const OVERRIDE_19
{ {
return ClickControlState; return ClickControlState;
} }

@ -255,6 +255,12 @@ video::SColor StaticText::getOverrideColor() const
return ColoredText.getDefaultColor(); return ColoredText.getDefaultColor();
} }
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
video::SColor StaticText::getActiveColor() const
{
return getOverrideColor();
}
#endif
//! Sets if the static text should use the overide color or the //! Sets if the static text should use the overide color or the
//! color in the gui skin. //! color in the gui skin.

@ -140,6 +140,11 @@ namespace gui
virtual video::SColor getOverrideColor() const; virtual video::SColor getOverrideColor() const;
#endif #endif
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
//! Gets the currently used text color
virtual video::SColor getActiveColor() const;
#endif
//! Sets if the static text should use the overide color or the //! Sets if the static text should use the overide color or the
//! color in the gui skin. //! color in the gui skin.
virtual void enableOverrideColor(bool enable); virtual void enableOverrideColor(bool enable);