Skip to content

Commit

Permalink
KOTOR: Fix for button text disappearing in character menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius committed Jul 1, 2017
1 parent b52966e commit a58cda1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/engines/kotor/gui/widgets/button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace KotOR {

WidgetButton::WidgetButton(::Engines::GUI &gui, const Common::UString &tag) :
KotORWidget(gui, tag), _permanentHighlight(false), _disableHighlight(false),
_disableHoverSound(false), _hovered(false) {
_disableHoverSound(false), _hovered(false), _highlighted(false) {
}

WidgetButton::~WidgetButton() {
Expand All @@ -51,17 +51,23 @@ void WidgetButton::setPermanentHighlight(bool permanentHighlight) {
_permanentHighlight = permanentHighlight;

if (_permanentHighlight) {
startHighlight();
if (!_highlighted)
startHighlight();
} else {
stopHighlight();
if (_highlighted)
stopHighlight();
}
}

void WidgetButton::setDisableHighlight(bool disableHighlight) {
_disableHighlight = disableHighlight;

if (_disableHighlight) {
stopHighlight();
if (_highlighted)
stopHighlight();
} else {
if (_hovered)
startHighlight();
}
}

Expand Down Expand Up @@ -131,6 +137,8 @@ void WidgetButton::startHighlight() {
_quad->setColor(r, g, b, a);
getQuadHighlightableComponent()->setHighlighted(true);
}

_highlighted = true;
}

void WidgetButton::stopHighlight() {
Expand All @@ -142,6 +150,8 @@ void WidgetButton::stopHighlight() {
getQuadHighlightableComponent()->setHighlighted(false);
_quad->setColor(_unselectedR, _unselectedG, _unselectedB, _unselectedA);
}

_highlighted = false;
}

void WidgetButton::setDefaultHighlighting(Graphics::Aurora::Highlightable *highlightable) {
Expand Down
1 change: 1 addition & 0 deletions src/engines/kotor/gui/widgets/button.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class WidgetButton : public KotORWidget {
float _unselectedR, _unselectedG, _unselectedB, _unselectedA;

bool _hovered;
bool _highlighted;

void setDefaultHighlighting(Graphics::Aurora::Highlightable *highlightable);

Expand Down

0 comments on commit a58cda1

Please sign in to comment.