00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _SPRITE_
00019 #define _SPRITE_
00020
00021 #include <iostream>
00022 #include <string>
00023
00027 struct Sprite
00028 {
00032 Sprite()
00033 :_nFrameCount(0), _nFrameWidth(0), _nFrameHeight(0), _nFramesPerRow(0)
00034 {
00035 }
00036
00040 Sprite(const std::string image, const int nFrameCount = 0, const int nFrameWidth = 0, const int nFrameHeight = 0,
00041 const int nFramesPerRow = 0)
00042 :_image(image), _nFrameCount(nFrameCount), _nFrameWidth(nFrameWidth), _nFrameHeight(nFrameHeight), _nFramesPerRow(nFramesPerRow)
00043 {
00044 }
00045
00046 std::string _image;
00047 int _nFrameCount;
00048 int _nFrameWidth;
00049 int _nFrameHeight;
00050 int _nFramesPerRow;
00051 };
00052
00053 inline std::ostream & operator<<(std::ostream & os, const Sprite & sprite)
00054 {
00055 os << sprite._image << " " << sprite._nFrameCount << " " << sprite._nFrameWidth << " " <<
00056 sprite._nFrameHeight << " " << sprite._nFramesPerRow << " ";
00057
00058 return os;
00059 }
00060
00061 inline std::istream & operator>>(std::istream & is, Sprite & sprite)
00062 {
00063 is >> sprite._image >> sprite._nFrameCount >> sprite._nFrameWidth >> sprite._nFrameHeight >> sprite._nFramesPerRow;
00064
00065 return is;
00066 }
00067
00068 #endif