MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
mgdl-wii-sprites.h
1
5#ifndef _GDL_WII_SPRITES_H
6#define _GDL_WII_SPRITES_H
7
8#include <mgdl/wii/mgdl-wii-image.h>
9#include <mgdl/mgdl-color.h>
10
11namespace gdl {
12
13
20typedef struct {
21 short w;
22 short h;
23 short cx;
24 short cy;
27 GXTexObj *texObj;
28} Sprite;
29
31
37class SpriteSet {
38
39 Sprite *spriteList;
40 ImageWii **sheetList;
41 short numSprites;
42 short numSheets;
43
44public:
45
46
48 SpriteSet();
49
50
52
56 virtual ~SpriteSet();
57
58
60
72 bool LoadSprites(const char *fileName, const char *sheetsDir, u_int filterMode, u_int format);
73
74 /*
75 Changed: 13.4.2024
76 muffintrap: added function to load spriteset from image
77 because RT Engine is quite old and there is no documentation
78 */
80
93 bool LoadSprites(short spritesPerRow, short spriteHeight, ImageWii *spriteSheet);
94
96
99 short NumSprites();
100
101
103
108 const Sprite *SpriteInfo(short index);
109
110
112
126 void Put(short x, short y, int index, u_int col, short cx = 0, short cy = 0, float scale = 1.f, float angle = 0.f);
127
128
129
131
143 void PutS(short x1, short y1, short x2, short y2, short index, u_int col);
144
145 private:
146
147 /*
148 Changed 13.4.2024
149 muffintrap: moved TSM_entry to header and
150 created a function used by both versions of LoadSprites
151 */
153
156 typedef struct {
157 short sheetnum;
158 short tx1,ty1;
159 short tx2,ty2;
160 short px,py;
161 } TSM_entry;
162
164
168 void LoadTSM_Entry(TSM_entry &entry, short index);
169
170};
171
175}
176
177#endif // _GDL_WII_SPRITES_H
Image handling class.
Definition mgdl-wii-image.h:47
Sprite set handling class.
Definition mgdl-wii-sprites.h:37
short NumSprites()
Returns the number of sprites in the currently loaded sprite set.
Definition wii-sprites.cpp:276
void PutS(short x1, short y1, short x2, short y2, short index, u_int col)
Draws a sprite as a stretchable rectangle.
Definition wii-sprites.cpp:295
const Sprite * SpriteInfo(short index)
Returns a pointer to a sprite entry object.
Definition wii-sprites.cpp:282
SpriteSet()
Constructor.
Definition wii-sprites.cpp:36
virtual ~SpriteSet()
Deconstructor.
Definition wii-sprites.cpp:45
void Put(short x, short y, int index, u_int col, short cx=0, short cy=0, float scale=1.f, float angle=0.f)
Draws a sprite onto the screen.
Definition wii-sprites.cpp:288
bool LoadSprites(const char *fileName, const char *sheetsDir, u_int filterMode, u_int format)
Loads a sprite set file.
Definition wii-sprites.cpp:123
Color struct and functions.
Library namespace.
Definition wii-globals.cpp:12
Sprite entry structure.
Definition mgdl-wii-sprites.h:20
short cy
Y pivot offset of sprite.
Definition mgdl-wii-sprites.h:24
wii::TEX2f32 * tList
Texcoord array pointer.
Definition mgdl-wii-sprites.h:26
short h
Height of sprite in pixels.
Definition mgdl-wii-sprites.h:22
short cx
X pivot offset of sprite.
Definition mgdl-wii-sprites.h:23
short w
Width of sprite in pixels.
Definition mgdl-wii-sprites.h:21
GXTexObj * texObj
Pointer to associated texture object.
Definition mgdl-wii-sprites.h:27
wii::VERT2s16 * vList
Vertex array pointer.
Definition mgdl-wii-sprites.h:25
UV texture coordinate.
Definition mgdl-wii-types.h:63
2D vertex coordinate.
Definition mgdl-wii-types.h:53