summaryrefslogtreecommitdiffstats
path: root/kbattleship/kbattleship/kgridwidget.h
blob: 1026695b4665610598a3704d80ff2ceda22ab128 (plain)
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 <tqpixmap.h>

class KGridWidget
{
public:
	KGridWidget(TQWidget *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 TQPixmap &icon, bool hitBlend = false, bool waterBlend = false, bool rotate = false);
	TQString findIcon(const TQString &name) const;

	bool m_drawGrid;
	int m_x, m_y, m_size;
	TQPixmap *m_doubleBuffer;
	TQPixmap seaPng, waterPng, hitPng, borderPng,deathPng;
	TQPixmap ship1p1Png, ship1p1rPng;
	TQPixmap ship2p1Png, ship2p1rPng;
	TQPixmap ship2p2Png, ship2p2rPng;
	TQPixmap ship3p1Png, ship3p1rPng;
	TQPixmap ship3p2Png, ship3p2rPng;
	TQPixmap ship3p3Png, ship3p3rPng;
	TQPixmap ship4p1Png, ship4p1rPng;
	TQPixmap ship4p2Png, ship4p2rPng;
	TQPixmap ship4p3Png, ship4p3rPng;
	TQPixmap ship4p4Png, ship4p4rPng;
	TQWidget *m_parent;
};

#endif