GUIButton: Use default member initializers

This commit is contained in:
Desour 2023-08-12 18:03:00 +02:00 committed by sfan5
parent 7f9de5db0b
commit 2903f692ba
2 changed files with 26 additions and 35 deletions

View File

@ -27,15 +27,10 @@ using namespace gui;
//! constructor //! constructor
GUIButton::GUIButton(IGUIEnvironment* environment, IGUIElement* parent, GUIButton::GUIButton(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc, s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc,
bool noclip) bool noclip) :
: IGUIButton(environment, parent, id, rectangle), IGUIButton(environment, parent, id, rectangle),
SpriteBank(0), OverrideFont(0), TSrc(tsrc)
OverrideColorEnabled(false), OverrideColor(video::SColor(101,255,255,255)),
ClickTime(0), HoverTime(0), FocusTime(0),
ClickShiftState(false), ClickControlState(false),
IsPushButton(false), Pressed(false),
UseAlphaChannel(false), DrawBorder(true), ScaleImage(false), TSrc(tsrc)
{ {
setNotClipped(noclip); setNotClipped(noclip);

View File

@ -185,11 +185,9 @@ protected:
struct ButtonImage struct ButtonImage
{ {
ButtonImage() : Texture(0), SourceRect(core::rect<s32>(0,0,0,0)) ButtonImage() = default;
{
}
ButtonImage(const ButtonImage& other) : Texture(0), SourceRect(core::rect<s32>(0,0,0,0)) ButtonImage(const ButtonImage& other)
{ {
*this = other; *this = other;
} }
@ -220,8 +218,8 @@ protected:
} }
video::ITexture* Texture; video::ITexture* Texture = nullptr;
core::rect<s32> SourceRect; core::rect<s32> SourceRect = core::rect<s32>(0,0,0,0);
}; };
gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed, const ButtonImage* images) const; gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed, const ButtonImage* images) const;
@ -230,43 +228,41 @@ private:
struct ButtonSprite struct ButtonSprite
{ {
ButtonSprite() : Index(-1), Loop(false), Scale(false) bool operator==(const ButtonSprite &other) const
{
}
bool operator==(const ButtonSprite& other) const
{ {
return Index == other.Index && Color == other.Color && Loop == other.Loop && Scale == other.Scale; return Index == other.Index && Color == other.Color && Loop == other.Loop && Scale == other.Scale;
} }
s32 Index; s32 Index = -1;
video::SColor Color; video::SColor Color;
bool Loop; bool Loop = false;
bool Scale; bool Scale = false;
}; };
ButtonSprite ButtonSprites[gui::EGBS_COUNT]; ButtonSprite ButtonSprites[gui::EGBS_COUNT];
gui::IGUISpriteBank* SpriteBank; gui::IGUISpriteBank* SpriteBank = nullptr;
ButtonImage ButtonImages[gui::EGBIS_COUNT]; ButtonImage ButtonImages[gui::EGBIS_COUNT];
std::array<StyleSpec, StyleSpec::NUM_STATES> Styles; std::array<StyleSpec, StyleSpec::NUM_STATES> Styles;
gui::IGUIFont* OverrideFont; gui::IGUIFont* OverrideFont = nullptr;
bool OverrideColorEnabled; bool OverrideColorEnabled = false;
video::SColor OverrideColor; video::SColor OverrideColor = video::SColor(101,255,255,255);
u32 ClickTime, HoverTime, FocusTime; u32 ClickTime = 0;
u32 HoverTime = 0;
u32 FocusTime = 0;
bool ClickShiftState; bool ClickShiftState = false;
bool ClickControlState; bool ClickControlState = false;
bool IsPushButton; bool IsPushButton = false;
bool Pressed; bool Pressed = false;
bool UseAlphaChannel; bool UseAlphaChannel = false;
bool DrawBorder; bool DrawBorder = true;
bool ScaleImage; bool ScaleImage = false;
video::SColor Colors[4]; video::SColor Colors[4];
// PATCH // PATCH