added background effect for the inventory items

svn-id: r47980
This commit is contained in:
Vladimir Menshakov 2010-02-07 18:05:55 +00:00
parent 024e762bdb
commit 049436313c
2 changed files with 13 additions and 0 deletions

View File

@ -255,9 +255,21 @@ void Inventory::Item::free() {
surface.free();
}
void Inventory::Item::backgroundEffect(Graphics::Surface *s) {
uint w = rect.right - rect.left, h = rect.bottom - rect.top;
byte *line = (byte *)s->getBasePtr(rect.left, rect.top);
for(uint y = 0; y < h; ++y, line += s->pitch) {
byte *dst = line;
for(uint x = 0; x < w; ++x, ++dst) {
*dst = (*dst == 232)? 214: 224;
}
}
}
void Inventory::Item::render(Inventory *inventory, InventoryObject *obj, Graphics::Surface *dst, int delta) {
Resources *res = Resources::instance();
backgroundEffect(dst);
rect.render(dst, hovered ? 233 : 234);
if (obj->animated) {
if (animation.empty()) {

View File

@ -70,6 +70,7 @@ private:
Item() : hovered(false) {}
void free();
void backgroundEffect(Graphics::Surface *s);
void render(Inventory *inventory, InventoryObject *obj, Graphics::Surface *surface, int delta);
} graphics[24];