From 781b3c9f17708cc5fe08eb3c9ee38d596364d97c Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Thu, 4 Mar 2010 22:41:19 -0700 Subject: Split Palette into Theme and UserPalette MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Themes can now control the colors they use. Colors in the Viewport (being names, particles, etc) can still be changed by the user. Also make ProgressBars more easily colored. DyePalette was made more flexible in the process. Also fixes comparing strings of different lengths insensitively. Reviewed-by: Thorbjørn Lindeijer --- src/gui/skilldialog.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gui/skilldialog.cpp') diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 76ddd7b0..da244208 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -71,6 +71,7 @@ struct SkillInfo std::string skillExp; float progress; + gcn::Color color; ~SkillInfo() { @@ -146,8 +147,8 @@ public: Graphics *graphics = static_cast(gcnGraphics); - graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT, - (int)(mAlpha * 255.0f))); + graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT, + (int) (mAlpha * 255.0f))); graphics->setFont(getFont()); // Draw filled rectangle around the selected list element @@ -158,7 +159,7 @@ public: } // Draw the list elements - graphics->setColor(guiPalette->getColor(Palette::TEXT)); + graphics->setColor(Theme::getThemeColor(Theme::TEXT)); for (int i = 0, y = 1; i < model->getNumberOfElements(); ++i, y += getRowHeight()) @@ -429,6 +430,8 @@ void SkillInfo::update() progress = 0.0f; } + color = Theme::getProgressColor(Theme::PROG_EXP, progress); + if (updateVisibility) { model->updateVisibilities(); @@ -452,7 +455,6 @@ void SkillInfo::draw(Graphics *graphics, int y, int width) { gcn::Rectangle rect(33, y + 15, width - 33, 17); - ProgressBar::render(graphics, rect, gcn::Color(143, 192, 211), - progress, skillExp); + ProgressBar::render(graphics, rect, color, progress, skillExp); } } -- cgit v1.2.3-70-g09d2