diff --git a/src/game/gui/ingame/abilities.cpp b/src/game/gui/ingame/abilities.cpp index 3a8bf433..01e5ec6d 100644 --- a/src/game/gui/ingame/abilities.cpp +++ b/src/game/gui/ingame/abilities.cpp @@ -126,9 +126,11 @@ void AbilitiesMenu::refreshPortraits() { Control &btnChange1 = getControl("BTN_CHANGE1"); btnChange1.setBorderFill(partyMember1 ? partyMember1->portrait() : nullptr); + btnChange1.setHilightFill(partyMember1 ? partyMember1->portrait() : nullptr); Control &btnChange2 = getControl("BTN_CHANGE2"); btnChange2.setBorderFill(partyMember2 ? partyMember2->portrait() : nullptr); + btnChange2.setHilightFill(partyMember2 ? partyMember2->portrait() : nullptr); } void AbilitiesMenu::onClick(const string &control) { diff --git a/src/game/gui/ingame/character.cpp b/src/game/gui/ingame/character.cpp index 6c857066..02f8a036 100644 --- a/src/game/gui/ingame/character.cpp +++ b/src/game/gui/ingame/character.cpp @@ -131,9 +131,11 @@ void CharacterMenu::refreshPortraits() { Control &btnChange1 = getControl("BTN_CHANGE1"); btnChange1.setBorderFill(partyMember1 ? partyMember1->portrait() : nullptr); + btnChange1.setHilightFill(partyMember1 ? partyMember1->portrait() : nullptr); Control &btnChange2 = getControl("BTN_CHANGE2"); btnChange2.setBorderFill(partyMember2 ? partyMember2->portrait() : nullptr); + btnChange2.setHilightFill(partyMember2 ? partyMember2->portrait() : nullptr); } void CharacterMenu::onClick(const string &control) { diff --git a/src/game/gui/ingame/inventory.cpp b/src/game/gui/ingame/inventory.cpp index b5590cea..ca49ccd7 100644 --- a/src/game/gui/ingame/inventory.cpp +++ b/src/game/gui/ingame/inventory.cpp @@ -70,9 +70,11 @@ void InventoryMenu::refreshPortraits() { Control &btnChange1 = getControl("BTN_CHANGE1"); btnChange1.setBorderFill(partyMember1 ? partyMember1->portrait() : nullptr); + btnChange1.setHilightFill(partyMember1 ? partyMember1->portrait() : nullptr); Control &btnChange2 = getControl("BTN_CHANGE2"); btnChange2.setBorderFill(partyMember2 ? partyMember2->portrait() : nullptr); + btnChange2.setHilightFill(partyMember2 ? partyMember2->portrait() : nullptr); } void InventoryMenu::onClick(const string &control) { diff --git a/src/gui/control/control.cpp b/src/gui/control/control.cpp index e91bbd58..04a0d80c 100644 --- a/src/gui/control/control.cpp +++ b/src/gui/control/control.cpp @@ -604,6 +604,27 @@ void Control::setHilightColor(const glm::vec3 &color) { _hilight->color = color; } +void Control::setHilightFill(const string &resRef) { + shared_ptr texture; + if (!resRef.empty()) { + texture = Textures::instance().get(resRef, TextureType::GUI); + } + setHilightFill(texture); +} + +void Control::setHilightFill(const shared_ptr &texture) { + if (!texture && _hilight) { + _hilight->fill.reset(); + return; + } + if (texture) { + if (!_hilight) { + _hilight = make_shared(); + } + _hilight->fill = texture; + } +} + void Control::setText(const Text &text) { _text = text; updateTextLines(); diff --git a/src/gui/control/control.h b/src/gui/control/control.h index 5c8484f1..33d7eb12 100644 --- a/src/gui/control/control.h +++ b/src/gui/control/control.h @@ -137,6 +137,8 @@ public: void setHeight(int height); void setHilight(const Border &hilight); void setHilightColor(const glm::vec3 &color); + void setHilightFill(const std::string &resRef); + void setHilightFill(const std::shared_ptr &texture); void setPadding(int padding); void setScene3D(std::unique_ptr scene); void setText(const Text &text);