1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/***************************************************************************
kgridwidget.h
-------------------
Developers: (c) 2000-2001 Nikolas Zimmermann <wildfox@kde.org>
(c) 2000-2001 Daniel Molkentin <molkentin@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KGRIDWIDGET_H
#define KGRIDWIDGET_H
#include <qpixmap.h>
class KGridWidget
{
public:
KGridWidget(QWidget *parent, bool draw);
~KGridWidget();
void enableGrid() { m_drawGrid = true; }
void disableGrid() { m_drawGrid = false; }
protected:
void cleanBuffer();
void finished();
void setValues(int x, int y, int size);
void drawSquare();
void drawWaterIcon();
void drawDeathBorder();
void drawDeathIcon();
void drawHitIcon();
void drawShipIcon(int type, bool rotate = false, bool hit = false, bool water = false);
void drawShipIcon(int ship, int part, bool rotate = false, bool hit = false);
private:
void cacheImages();
void drawIcon(const QPixmap &icon, bool hitBlend = false, bool waterBlend = false, bool rotate = false);
QString findIcon(const QString &name) const;
bool m_drawGrid;
int m_x, m_y, m_size;
QPixmap *m_doubleBuffer;
QPixmap seaPng, waterPng, hitPng, borderPng,deathPng;
QPixmap ship1p1Png, ship1p1rPng;
QPixmap ship2p1Png, ship2p1rPng;
QPixmap ship2p2Png, ship2p2rPng;
QPixmap ship3p1Png, ship3p1rPng;
QPixmap ship3p2Png, ship3p2rPng;
QPixmap ship3p3Png, ship3p3rPng;
QPixmap ship4p1Png, ship4p1rPng;
QPixmap ship4p2Png, ship4p2rPng;
QPixmap ship4p3Png, ship4p3rPng;
QPixmap ship4p4Png, ship4p4rPng;
QWidget *m_parent;
};
#endif
|