summaryrefslogtreecommitdiff
path: root/src/flooritem.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-04-22 07:15:35 -0600
committerJared Adams <jaxad0127@gmail.com>2010-04-23 08:33:25 -0600
commitc22ea2f169f58e765fc699fcd71bfd3a3cd4f859 (patch)
tree9e19b57d562d3fe24cd69e6441db41162aa6d3e4 /src/flooritem.cpp
parent93d4de19fdffb6d568c907729449f169c3520c7b (diff)
downloadmana-c22ea2f169f58e765fc699fcd71bfd3a3cd4f859.tar.gz
mana-c22ea2f169f58e765fc699fcd71bfd3a3cd4f859.tar.bz2
mana-c22ea2f169f58e765fc699fcd71bfd3a3cd4f859.tar.xz
mana-c22ea2f169f58e765fc699fcd71bfd3a3cd4f859.zip
Add an Actor class to replace the Sprite class
The Actor class manages the Map reference, position vector, and alpha float. These are the common parts from it's children.
Diffstat (limited to 'src/flooritem.cpp')
-rw-r--r--src/flooritem.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/flooritem.cpp b/src/flooritem.cpp
index c3442a86..e5a9d215 100644
--- a/src/flooritem.cpp
+++ b/src/flooritem.cpp
@@ -32,24 +32,17 @@ FloorItem::FloorItem(int id,
int x,
int y,
Map *map):
- mId(id),
- mX(x),
- mY(y),
- mMap(map),
- mAlpha(1.0f)
+ mId(id)
{
+ setMap(map);
+ mPos.x = x * map->getTileWidth();
+ mPos.y = y * map->getTileHeight();
// Create a corresponding item instance
mItem = new Item(itemId);
-
- // Add ourselves to the map
- mMapSprite = mMap->addSprite(this);
}
FloorItem::~FloorItem()
{
- // Remove ourselves from the map
- mMap->removeSprite(mMapSprite);
-
delete mItem;
}
@@ -73,7 +66,7 @@ void FloorItem::draw(Graphics *graphics, int offsetX, int offsetY) const
if (mAlpha != image->getAlpha())
image->setAlpha(mAlpha);
- graphics->drawImage(image, mX * mMap->getTileWidth() + offsetX,
- mY * mMap->getTileHeight() + offsetY);
+ graphics->drawImage(image, getPixelX() + offsetX,
+ getPixelY() + offsetY);
}
}