Sprite2D: Add TypeID.
[gemrb.git] / gemrb / core / Sprite2D.h
blob99651130bf388d83e56a07bd266513baecb0775f
1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 /**
22 * @file Sprite2D.h
23 * Declares Sprite2D, class representing bitmap data
24 * @author The GemRB Project
27 #ifndef SPRITE2D_H
28 #define SPRITE2D_H
30 #include "exports.h"
31 #include "RGBAColor.h"
32 #include "Palette.h"
33 #include "TypeID.h"
35 class AnimationFactory;
37 /**
38 * @class Sprite2D
39 * Class representing bitmap data.
40 * Objects of this class are usually created by Video driver.
43 class Sprite2D_BAM_Internal {
44 public:
45 Sprite2D_BAM_Internal() { pal = 0; }
46 ~Sprite2D_BAM_Internal() { if (pal) { pal->Release(); pal = 0; } }
48 Palette* pal;
49 bool RLE;
50 int transindex;
51 bool flip_hor;
52 bool flip_ver;
54 // The AnimationFactory in which the data for this sprite is stored.
55 // (Used for refcounting of the data.)
56 AnimationFactory* source;
59 class GEM_EXPORT Sprite2D {
60 public:
61 static TypeID ID;
62 public:
63 /** Pointer to the Driver Video Structure */
64 void* vptr;
65 bool BAM;
66 const void* pixels;
67 int XPos, YPos, Width, Height, Bpp;
68 Sprite2D(void);
69 ~Sprite2D(void);
70 bool IsPixelTransparent(unsigned short x, unsigned short y);
71 Palette *GetPalette();
72 void SetPalette(Palette *pal);
73 Color GetPixel(unsigned short x, unsigned short y);
74 public: // public only for SDLVideo
75 int RefCount;
76 public:
77 void acquire() { ++RefCount; }
78 void release();
81 #endif // ! SPRITE2D_H