diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-04-22 07:15:35 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-04-23 08:33:25 -0600 |
commit | c22ea2f169f58e765fc699fcd71bfd3a3cd4f859 (patch) | |
tree | 9e19b57d562d3fe24cd69e6441db41162aa6d3e4 /src/flooritem.h | |
parent | 93d4de19fdffb6d568c907729449f169c3520c7b (diff) | |
download | mana-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.h')
-rw-r--r-- | src/flooritem.h | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/src/flooritem.h b/src/flooritem.h index ec8c37cd..17b7b54d 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -23,9 +23,6 @@ #define FLOORITEM_H #include "map.h" -#include "sprite.h" - -#include <list> class Graphics; class Image; @@ -34,7 +31,7 @@ class Item; /** * An item lying on the floor. */ -class FloorItem : public Sprite +class FloorItem : public Actor { public: /** @@ -57,7 +54,8 @@ class FloorItem : public Sprite /** * Returns instance ID of this item. */ - int getId() const { return mId; } + int getId() const + { return mId; } /** * Returns the item ID. @@ -71,53 +69,19 @@ class FloorItem : public Sprite Item *getItem() const; /** - * Returns the x coordinate in tiles. - */ - int getX() const { return mX; } - - /** - * Returns the y coordinate in tiles. - */ - int getY() const { return mY; } - - /** - * Returns the pixel y coordinate. - * - * @see Sprite::getPixelY() - */ - int getPixelY() const - { return mY * mMap->getTileHeight() + mMap->getTileHeight() / 2; } - - /** * Draws this floor item to the given graphics context. * - * @see Sprite::draw(Graphics, int, int) + * @see Actor::draw(Graphics, int, int) */ void draw(Graphics *graphics, int offsetX, int offsetY) const; - /** - * Sets the alpha value of the floor item - */ - void setAlpha(float alpha) - { mAlpha = alpha; } - - /** - * Returns the current alpha opacity of the floor item. - */ - virtual float getAlpha() const - { return mAlpha; } - /** We consider flooritems (at least for now) to be one layer-sprites */ virtual int getNumberOfLayers() const { return 1; } private: int mId; - int mX, mY; Item *mItem; - MapSprite mMapSprite; - Map *mMap; - float mAlpha; }; #endif |