QTfrontend/ui/widget/bgwidget.h
author nemo
Sat, 01 Mar 2014 14:52:36 -0500
changeset 10171 00f41ff0bf2d
parent 10108 c68cf030eded
child 11046 47a8c19ecb60
permissions -rw-r--r--
Script might well override a static map, but can't risk it not doing it, and preview completely failing. Better to just not try it for static maps. Some script cfg might help. Could also avoid unnnecessary preview regenerations even if the script was doing nothing at all.
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>
9998
736015b847e3 update copyright to 2014
sheepluva
parents: 9080
diff changeset
     4
 * Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com>
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     5
 *
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License as published by
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     8
 * the Free Software Foundation; version 2 of the License
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
     9
 *
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    13
 * GNU General Public License for more details.
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    14
 *
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 9998
diff changeset
    17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    18
 */
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    19
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    20
#ifndef BGWIDGET_H
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    21
#define BGWIDGET_H
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    22
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    23
#include <QWidget>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    24
//#include <QGLWidget>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    25
#include <QPainter>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    26
#include <QTimer>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    27
#include <QPaintEvent>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    28
#include <QTime>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    29
#include <QPoint>
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    30
6241
e2c7771162ae frontend flakes:
sheepluva
parents: 6060
diff changeset
    31
#define SPRITE_MAX 10
2012
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    32
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    33
#define ANIMATION_INTERVAL 40
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    34
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    35
class SpritePosition
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    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
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    55
};
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    56
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    57
class BGWidget : public QWidget
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    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
ec059b55aa72 GCI task: stars
bovi
parents: 6242
diff changeset
    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
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    77
};
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    78
76fff564246b TheXception's patch:
unc0rr
parents:
diff changeset
    79
#endif // BGWIDGET_H