diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-09 03:21:39 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-09 03:21:39 +0000 |
commit | 7593d6c71e2331c3e43c732db60ad03ee4d5385d (patch) | |
tree | 3ad242a957b6a500319d7bdae15149c553521ee4 /src/graphic | |
parent | 81cf85e9ec1d37dc6e8dd9883f42bb50dace9135 (diff) | |
download | mana-7593d6c71e2331c3e43c732db60ad03ee4d5385d.tar.gz mana-7593d6c71e2331c3e43c732db60ad03ee4d5385d.tar.bz2 mana-7593d6c71e2331c3e43c732db60ad03ee4d5385d.tar.xz mana-7593d6c71e2331c3e43c732db60ad03ee4d5385d.zip |
Added Spriteset::get() and Spriteset::size() to hide the member vector and remove the weird mySpriteset->spriteset stuff.
Diffstat (limited to 'src/graphic')
-rw-r--r-- | src/graphic/spriteset.cpp | 4 | ||||
-rw-r--r-- | src/graphic/spriteset.h | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/graphic/spriteset.cpp b/src/graphic/spriteset.cpp index 96ba4313..b008a701 100644 --- a/src/graphic/spriteset.cpp +++ b/src/graphic/spriteset.cpp @@ -33,12 +33,12 @@ Spriteset::Spriteset(Image *img, int width, int height) { for (int x = 0; x + width <= img->getWidth(); x += width) { - spriteset.push_back(img->getSubImage(x, y, width, height)); + mSpriteset.push_back(img->getSubImage(x, y, width, height)); } } } Spriteset::~Spriteset() { - for_each(spriteset.begin(), spriteset.end(), make_dtor(spriteset)); + for_each(mSpriteset.begin(), mSpriteset.end(), make_dtor(mSpriteset)); } diff --git a/src/graphic/spriteset.h b/src/graphic/spriteset.h index 2f4e50ca..08ff65f5 100644 --- a/src/graphic/spriteset.h +++ b/src/graphic/spriteset.h @@ -34,9 +34,6 @@ class Image; */ class Spriteset { public: - // Vector storing the whole spriteset. - std::vector<Image*> spriteset; - /* * Cuts the passed image in a grid of sub images. */ @@ -46,6 +43,15 @@ class Spriteset { * Destructor. */ ~Spriteset(); + + typedef std::vector<Image*>::size_type size_type; + Image* get(size_type i) { return mSpriteset[i]; } + + size_type size() { return mSpriteset.size(); } + + private: + // Vector storing the whole spriteset. + std::vector<Image*> mSpriteset; }; #endif |