diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-07-19 15:12:06 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-07-19 15:12:06 +0000 |
commit | 4050f8c0bced625a95d542d30647c3f8bbf2267b (patch) | |
tree | 420d65a5ed6a2155762b4e13a4c90ab2df9f888e /src/graphic/spriteset.cpp | |
parent | da3a1fd114dd7b8e5e8c880bd987506acc16ac42 (diff) | |
download | mana-4050f8c0bced625a95d542d30647c3f8bbf2267b.tar.gz mana-4050f8c0bced625a95d542d30647c3f8bbf2267b.tar.bz2 mana-4050f8c0bced625a95d542d30647c3f8bbf2267b.tar.xz mana-4050f8c0bced625a95d542d30647c3f8bbf2267b.zip |
Merged new_animation branch until r2415 into trunk.
Diffstat (limited to 'src/graphic/spriteset.cpp')
-rw-r--r-- | src/graphic/spriteset.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/graphic/spriteset.cpp b/src/graphic/spriteset.cpp index b008a701..3b190f31 100644 --- a/src/graphic/spriteset.cpp +++ b/src/graphic/spriteset.cpp @@ -23,6 +23,8 @@ #include "spriteset.h" +#include "../log.h" + #include "../resources/image.h" #include "../utils/dtor.h" @@ -36,9 +38,25 @@ Spriteset::Spriteset(Image *img, int width, int height) mSpriteset.push_back(img->getSubImage(x, y, width, height)); } } + mWidth = width; + mHeight = height; } Spriteset::~Spriteset() { for_each(mSpriteset.begin(), mSpriteset.end(), make_dtor(mSpriteset)); } + +Image * +Spriteset::get(size_type i) +{ + if (i > mSpriteset.size()) + { + logger->log("Warning: Sprite #%i does not exist in this spriteset", i); + return NULL; + } + else + { + return mSpriteset[i]; + } +} |