From 3579dd21867598ff30867ebd68b690c85ba14f9b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 17 May 2020 01:03:33 +0200 Subject: Restore Irrlicht 1.9 support --- src/gui/guiButton.cpp | 7 +++++++ src/gui/guiButton.h | 35 +++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) (limited to 'src/gui') diff --git a/src/gui/guiButton.cpp b/src/gui/guiButton.cpp index b98e5de82..d6dbddf54 100644 --- a/src/gui/guiButton.cpp +++ b/src/gui/guiButton.cpp @@ -506,6 +506,13 @@ video::SColor GUIButton::getOverrideColor() const 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) { OverrideColorEnabled = enable; diff --git a/src/gui/guiButton.h b/src/gui/guiButton.h index 4e1b04aac..834405f51 100644 --- a/src/gui/guiButton.h +++ b/src/gui/guiButton.h @@ -69,6 +69,12 @@ using namespace irr; 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 { public: @@ -97,22 +103,27 @@ public: virtual gui::IGUIFont* getActiveFont() const override; //! 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 - 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. - virtual void enableOverrideColor(bool enable); + virtual void enableOverrideColor(bool enable) OVERRIDE_19; //! Checks if an override color is enabled - virtual bool isOverrideColorEnabled(void) const; + virtual bool isOverrideColorEnabled(void) const OVERRIDE_19; // PATCH //! 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, video::ITexture* image=nullptr, - const core::rect& sourceRect=core::rect(0,0,0,0)); + const core::rect& sourceRect=core::rect(0,0,0,0)) OVERRIDE_19; //! Sets an image which should be displayed on the button when it is in normal state. virtual void setImage(video::ITexture* image=nullptr) override; @@ -141,7 +152,7 @@ public: */ virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, 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) void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop) override { @@ -150,16 +161,16 @@ public: #endif //! 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. - 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 - 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 - 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 //! can be in two states: Normal or Pressed. With a click on the button, @@ -199,13 +210,13 @@ public: virtual bool isScalingImage() const override; //! 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; } //! 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; } -- cgit v1.2.3