summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-09 13:57:30 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-09 13:57:30 +0300
commit28999e7571b66733dcf0ddbc7e376c2c3fc1bfae (patch)
treed507a9857af937ab93f1a6414d3311ee6b0aef43 /src/gui/windows
parent7cccaaa192c2ed274b3aa9d26788479f6fbed611 (diff)
downloadmanaplus-28999e7571b66733dcf0ddbc7e376c2c3fc1bfae.tar.gz
manaplus-28999e7571b66733dcf0ddbc7e376c2c3fc1bfae.tar.bz2
manaplus-28999e7571b66733dcf0ddbc7e376c2c3fc1bfae.tar.xz
manaplus-28999e7571b66733dcf0ddbc7e376c2c3fc1bfae.zip
Add text colors for mp bar.
New theme colors: MP_BAR, MP_BAR_OUTLINE, NO_MP_BAR, NO_MP_BAR_OUTLINE
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/ministatuswindow.cpp3
-rw-r--r--src/gui/windows/statuswindow.cpp22
2 files changed, 22 insertions, 3 deletions
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index 0141354ee..8186f1e04 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -65,7 +65,8 @@ MiniStatusWindow::MiniStatusWindow() :
mHpBar(createBar(0, 100, 0, Theme::HP_BAR, Theme::PROG_HP,
"hp bar", _("health bar"))),
mMpBar(Net::getGameHandler()->canUseMagicBar()
- ? createBar(0, 100, 0, Theme::PROGRESS_BAR,
+ ? createBar(0, 100, 0, Net::getPlayerHandler()->canUseMagic()
+ ? Theme::MP_BAR : Theme::NO_MP_BAR,
Net::getPlayerHandler()->canUseMagic()
// TRANSLATORS: status bar name
? Theme::PROG_MP : Theme::PROG_NO_MP, "mp bar", _("mana bar"))
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 19d862443..bf93efbee 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -209,11 +209,21 @@ StatusWindow::StatusWindow() :
max = PlayerInfo::getAttribute(PlayerInfo::MAX_MP);
// TRANSLATORS: status window label
mMpLabel = new Label(this, _("MP:"));
+ const bool useMagic = Net::getPlayerHandler()->canUseMagic();
mMpBar = new ProgressBar(this, max ? static_cast<float>(
PlayerInfo::getAttribute(PlayerInfo::MAX_MP))
/ static_cast<float>(max) : static_cast<float>(0),
- 80, 0, Net::getPlayerHandler()->canUseMagic() ?
- Theme::PROG_MP : Theme::PROG_NO_MP);
+ 80, 0, useMagic ? Theme::PROG_MP : Theme::PROG_NO_MP);
+ if (useMagic)
+ {
+ mMpBar->setColor(Theme::getThemeColor(Theme::MP_BAR),
+ Theme::getThemeColor(Theme::MP_BAR_OUTLINE));
+ }
+ else
+ {
+ mMpBar->setColor(Theme::getThemeColor(Theme::NO_MP_BAR),
+ Theme::getThemeColor(Theme::NO_MP_BAR_OUTLINE));
+ }
}
else
{
@@ -523,9 +533,17 @@ void StatusWindow::updateMPBar(ProgressBar *const bar, const bool showMax)
prog = static_cast<float>(mp) / static_cast<float>(maxMp);
if (Net::getPlayerHandler()->canUseMagic())
+ {
+ bar->setColor(Theme::getThemeColor(Theme::MP_BAR),
+ Theme::getThemeColor(Theme::MP_BAR_OUTLINE));
bar->setProgressPalette(Theme::PROG_MP);
+ }
else
+ {
+ bar->setColor(Theme::getThemeColor(Theme::NO_MP_BAR),
+ Theme::getThemeColor(Theme::NO_MP_BAR_OUTLINE));
bar->setProgressPalette(Theme::PROG_NO_MP);
+ }
bar->setProgress(prog);
}