forked from haxenme/nme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTilesheet.h
46 lines (34 loc) · 850 Bytes
/
Tilesheet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef NME_TILESHEET_H
#define NME_TILESHEET_H
#include <Graphics.h>
#include <nme/Object.h>
namespace nme
{
struct Tile
{
float mOx;
float mOy;
Rect mRect;
Surface *mSurface;
};
class Tilesheet : public Object
{
public:
Tilesheet(int inWidth,int inHeight,PixelFormat inFormat,bool inInitRef=false);
Tilesheet(Surface *inSurface,bool inInitRef=false);
Tilesheet *IncRef() { Object::IncRef(); return this; }
int AllocRect(int inW,int inH,float inOx = 0, float inOy = 0);
int addTileRect(const Rect &inRect,float inOx=0, float inOy=0);
const Tile &GetTile(int inID) { return mTiles[inID]; }
Surface &GetSurface() { return *mSheet; }
int Tiles() const { return mTiles.size(); }
private:
~Tilesheet();
int mCurrentX;
int mCurrentY;
int mMaxHeight;
QuickVec<Tile> mTiles;
Surface *mSheet;
};
}
#endif