diff options
author | sniper <sniper@livecd.janhome.net> | 2009-03-11 15:35:54 +0100 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-12 18:53:16 -0600 |
commit | 4260cb92571842c6336537bf0d0c47c4f011ac0f (patch) | |
tree | 6c9ce9d69dc6914bb9948b152171d216a801f7c9 /src/gui/table.cpp | |
parent | f3796c231d5bcac6850fb9afc8db652361e3fceb (diff) | |
download | mana-client-4260cb92571842c6336537bf0d0c47c4f011ac0f.tar.gz mana-client-4260cb92571842c6336537bf0d0c47c4f011ac0f.tar.bz2 mana-client-4260cb92571842c6336537bf0d0c47c4f011ac0f.tar.xz mana-client-4260cb92571842c6336537bf0d0c47c4f011ac0f.zip |
Extending the internal handling of colors
The internal storage for colors was in the file color.h/color.cpp. It
mainly managed the colors in the chat.
The Color class was extended to be more generic now and it stores
gcn::Color objects instead of integers now. A lot of new colortypes are
now available, though not many of them are used for now, that will come
in the next patches.
The Color class was renamed to Palette and color.{h,cpp} to
palette.{h,cpp} to better describe its purpose.
The color config gui now lists the new colors, even changes them, but the
result is not displayed properly for now.
Diffstat (limited to 'src/gui/table.cpp')
-rw-r--r-- | src/gui/table.cpp | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/src/gui/table.cpp b/src/gui/table.cpp index 274f9a48..ece470b1 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -23,7 +23,7 @@ #include <guichan/graphics.hpp> #include <guichan/key.hpp> -#include "color.h" +#include "palette.h" #include "table.h" #include "../configuration.h" @@ -273,11 +273,8 @@ void GuiTable::draw(gcn::Graphics* graphics) if (mOpaque) { - const int red = getBackgroundColor().r; - const int green = getBackgroundColor().g; - const int blue = getBackgroundColor().b; - const int alpha = (int)(mAlpha * 255.0f); - graphics->setColor(gcn::Color(red, green, blue, alpha)); + graphics->setColor(guiPalette->getColor(Palette::BACKGROUND, + (int)(mAlpha * 255.0f))); graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); } @@ -324,15 +321,8 @@ void GuiTable::draw(gcn::Graphics* graphics) if (!mLinewiseMode && c == mSelectedColumn && r == mSelectedRow) { - bool valid; - const int red = - (textColor->getColor('H', valid) >> 16) & 0xFF; - const int green = - (textColor->getColor('H', valid) >> 8) & 0xFF; - const int blue = textColor->getColor('H', valid) & 0xFF; - const int alpha = (int)(mAlpha * 127.0f); - - graphics->setColor(gcn::Color(red, green, blue, alpha)); + graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT, + (int)(mAlpha * 127.0f))); graphics->fillRectangle(bounds); } @@ -346,17 +336,8 @@ void GuiTable::draw(gcn::Graphics* graphics) if (mLinewiseMode && r == mSelectedRow) { - bool valid; - const int red = - (textColor->getColor('H', valid) >> 16) & 0xFF; - const int green = - (textColor->getColor('H', valid) >> 8) & 0xFF; - const int blue = textColor->getColor('H', valid) & 0xFF; - const int alpha = (int)(mAlpha * 127.0f); - - graphics->setColor(gcn::Color(red, green, blue, alpha)); - graphics->fillRectangle(gcn::Rectangle(0, y_offset, - x_offset, height)); + graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT, + (int)(mAlpha * 127.0f))); } y_offset += height; |