QTfrontend/bgwidget.h
author nemo
Sun, 10 Oct 2010 20:16:17 -0400
changeset 3951 c9a63db3e603
parent 2948 3f21a9dc93d0
child 4976 088d40d8aba2
permissions -rw-r--r--
Correct another bug in slot switching, adjust width of theme list, really truly fix reset of weps (I hope) should also fix infinite teleport bug in place hogs mode. Slow update of health to 5s for inf attack mode.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     1
/*
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2009 Kristian Lehmann <email@thexception.net>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     4
 *
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     8
 *
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    13
 *
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    17
 */
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    18
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    19
#ifndef BGWIDGET_H
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    20
#define BGWIDGET_H
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    21
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    22
#include <QWidget>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    23
//#include <QGLWidget>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    24
#include <QPainter>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    25
#include <QTimer>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    26
#include <QPaintEvent>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    27
#include <QTime>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    28
#include <QPoint>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    29
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    30
#define SPRITE_MAX 12
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    31
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    32
#define ANIMATION_INTERVAL 40
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    33
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    34
class SpritePosition
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    35
{
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    36
public:
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    37
    SpritePosition(QWidget * parent, int sh);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    38
    ~SpritePosition();
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    39
private:
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    40
    float fX;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    41
    float fY;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    42
    float fXMov;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    43
    float fYMov;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    44
    int iAngle;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    45
    QWidget * wParent;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    46
    int iSpriteHeight;
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    47
public:
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    48
    void move();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    49
    void reset();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    50
    QPoint pos();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    51
    int getAngle();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    52
    void init();
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    53
};
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    54
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    55
class BGWidget : public QWidget
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    56
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    57
    Q_OBJECT
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    58
public:
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    59
    BGWidget(QWidget * parent);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    60
    ~BGWidget();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    61
    void startAnimation();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    62
    void stopAnimation();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    63
    void init();
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    64
private:
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    65
    QImage sprite;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    66
    QTimer * timerAnimation;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    67
    SpritePosition * spritePositions[SPRITE_MAX];
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    68
    QImage * rotatedSprites[360];
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    69
protected:
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    70
    void paintEvent(QPaintEvent * event);
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    71
private slots:
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2377
diff changeset
    72
    void animate();
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    73
};
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    74
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    75
#endif // BGWIDGET_H