-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspriteGrid.hh
executable file
·60 lines (44 loc) · 1.24 KB
/
spriteGrid.hh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef SPRITEGRID
#define SPRITEGRID
#include <QWidget>
#include <QImage>
#include <QPixmap>
#include "GE5Widget.hh"
#include <QMouseEvent>
#define NRSPRITESHOR 8
#define NRSPRITESVER 16
class spriteGrid : public QWidget
{
Q_OBJECT
public:
spriteGrid(QWidget *parent = 0);
void setDataSource(GE5Widget* datasource);
void mousePressEvent ( QMouseEvent * e );
char getSpritesinfo(int a);
char getSpritescol(int a,int b,int c);
char getSpritespat(int a,int b,int c);
/* spritesinfo[x]=how many sprites needed
*/
QImage image;
public slots:
void spriteClicked(int x,int y);
void resetGrid();
void updateImage();
void save2file( QString *filename );
void loadFromGE5( QString *filename );
void save2GE5( QString *filename );
signals:
void spriteChanged(int x,int y,int spritenr);
protected:
void paintEvent( QPaintEvent* );
private:
void updateActiveGrid();
void avoidBitOverlap(int *a,int *b);
void convert(int x,int y,int spritenr);
int activeGridItem;
GE5Widget* m_datasource;
char spritespat[4][32][NRSPRITESVER*NRSPRITESHOR];
char spritescol[4][16][NRSPRITESVER*NRSPRITESHOR];
char spritesinfo[NRSPRITESVER*NRSPRITESHOR];
};
#endif // SPRITEGRID