author | koda |
Wed, 02 Nov 2011 19:17:07 +0100 | |
changeset 6264 | 62d59a87daad |
parent 6242 | 27297c421bbc |
child 6574 | ec059b55aa72 |
permissions | -rw-r--r-- |
2012 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2009 Kristian Lehmann <email@thexception.net> |
|
4976 | 4 |
* Copyright (c) 2009-2011 Andrey Korotaev <unC0Rr@gmail.com> |
2012 | 5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation; version 2 of the License |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
18 |
*/ |
|
19 |
||
20 |
#ifndef BGWIDGET_H |
|
21 |
#define BGWIDGET_H |
|
22 |
||
23 |
#include <QWidget> |
|
24 |
//#include <QGLWidget> |
|
25 |
#include <QPainter> |
|
26 |
#include <QTimer> |
|
27 |
#include <QPaintEvent> |
|
28 |
#include <QTime> |
|
29 |
#include <QPoint> |
|
30 |
||
6241 | 31 |
#define SPRITE_MAX 10 |
2012 | 32 |
|
33 |
#define ANIMATION_INTERVAL 40 |
|
34 |
||
35 |
class SpritePosition |
|
36 |
{ |
|
37 |
public: |
|
6242 | 38 |
SpritePosition(QWidget * parent, int sw, int sh); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
39 |
~SpritePosition(); |
2012 | 40 |
private: |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
41 |
float fX; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
42 |
float fY; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
43 |
float fXMov; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
44 |
float fYMov; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
45 |
int iAngle; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
46 |
QWidget * wParent; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
47 |
int iSpriteHeight; |
6242 | 48 |
int iSpriteWidth; |
2012 | 49 |
public: |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
50 |
void move(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
51 |
void reset(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
52 |
QPoint pos(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
53 |
int getAngle(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
54 |
void init(); |
2012 | 55 |
}; |
56 |
||
57 |
class BGWidget : public QWidget |
|
58 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
59 |
Q_OBJECT |
2012 | 60 |
public: |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
61 |
BGWidget(QWidget * parent); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
62 |
~BGWidget(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
63 |
void startAnimation(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
64 |
void stopAnimation(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
65 |
void init(); |
2012 | 66 |
private: |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
67 |
QImage sprite; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
68 |
QTimer * timerAnimation; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
69 |
SpritePosition * spritePositions[SPRITE_MAX]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
70 |
QImage * rotatedSprites[360]; |
2012 | 71 |
protected: |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
72 |
void paintEvent(QPaintEvent * event); |
2012 | 73 |
private slots: |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
74 |
void animate(); |
2012 | 75 |
}; |
76 |
||
77 |
#endif // BGWIDGET_H |