author | volkan |
Sun, 14 Jul 2013 20:57:30 +0200 | |
changeset 9358 | 676adcae85a5 |
parent 9080 | 9b42757d7e71 |
child 9998 | 736015b847e3 |
permissions | -rw-r--r-- |
2012 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2009 Kristian Lehmann <email@thexception.net> |
|
9080 | 4 |
* Copyright (c) 2004-2013 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 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
37 |
public: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
38 |
SpritePosition(QWidget * parent, int sw, int sh); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
39 |
~SpritePosition(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
40 |
private: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
41 |
float fX; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
42 |
float fY; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
43 |
float fXMov; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
44 |
float fYMov; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
45 |
int iAngle; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
46 |
QWidget * wParent; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
47 |
int iSpriteHeight; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
48 |
int iSpriteWidth; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
49 |
public: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
50 |
void move(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
51 |
void reset(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
52 |
QPoint pos(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
53 |
int getAngle(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
54 |
void init(); |
2012 | 55 |
}; |
56 |
||
57 |
class BGWidget : public QWidget |
|
58 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
59 |
Q_OBJECT |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
60 |
public: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
61 |
BGWidget(QWidget * parent); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
62 |
~BGWidget(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
63 |
void startAnimation(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
64 |
void stopAnimation(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
65 |
void init(); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
66 |
bool enabled; |
6574 | 67 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
68 |
private: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
69 |
QImage sprite; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
70 |
QTimer * timerAnimation; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
71 |
SpritePosition * spritePositions[SPRITE_MAX]; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
72 |
QImage * rotatedSprites[360]; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
73 |
protected: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
74 |
void paintEvent(QPaintEvent * event); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
75 |
private slots: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6574
diff
changeset
|
76 |
void animate(); |
2012 | 77 |
}; |
78 |
||
79 |
#endif // BGWIDGET_H |