QTfrontend/bgwidget.h
changeset 2948 3f21a9dc93d0
parent 2377 f3fab2b09e0c
child 4976 088d40d8aba2
equal deleted inserted replaced
2947:803b277e4894 2948:3f21a9dc93d0
    32 #define ANIMATION_INTERVAL 40
    32 #define ANIMATION_INTERVAL 40
    33 
    33 
    34 class SpritePosition
    34 class SpritePosition
    35 {
    35 {
    36 public:
    36 public:
    37 	SpritePosition(QWidget * parent, int sh);
    37     SpritePosition(QWidget * parent, int sh);
    38 	~SpritePosition();
    38     ~SpritePosition();
    39 private:
    39 private:
    40 	float fX;
    40     float fX;
    41 	float fY;
    41     float fY;
    42 	float fXMov;
    42     float fXMov;
    43 	float fYMov;
    43     float fYMov;
    44 	int iAngle;
    44     int iAngle;
    45 	QWidget * wParent;
    45     QWidget * wParent;
    46 	int iSpriteHeight;
    46     int iSpriteHeight;
    47 public:
    47 public:
    48 	void move();
    48     void move();
    49 	void reset();
    49     void reset();
    50 	QPoint pos();
    50     QPoint pos();
    51 	int getAngle();
    51     int getAngle();
    52 	void init();
    52     void init();
    53 };
    53 };
    54 
    54 
    55 class BGWidget : public QWidget
    55 class BGWidget : public QWidget
    56 {
    56 {
    57 	Q_OBJECT
    57     Q_OBJECT
    58 public:
    58 public:
    59 	BGWidget(QWidget * parent);
    59     BGWidget(QWidget * parent);
    60 	~BGWidget();
    60     ~BGWidget();
    61 	void startAnimation();
    61     void startAnimation();
    62 	void stopAnimation();
    62     void stopAnimation();
    63 	void init();
    63     void init();
    64 private:
    64 private:
    65 	QImage sprite;
    65     QImage sprite;
    66 	QTimer * timerAnimation;
    66     QTimer * timerAnimation;
    67 	SpritePosition * spritePositions[SPRITE_MAX];
    67     SpritePosition * spritePositions[SPRITE_MAX];
    68 	QImage * rotatedSprites[360];
    68     QImage * rotatedSprites[360];
    69 protected:
    69 protected:
    70 	void paintEvent(QPaintEvent * event);
    70     void paintEvent(QPaintEvent * event);
    71 private slots:
    71 private slots:
    72 	void animate();
    72     void animate();
    73 };
    73 };
    74 
    74 
    75 #endif // BGWIDGET_H
    75 #endif // BGWIDGET_H