summaryrefslogtreecommitdiff
path: root/noncore/games/zsame/StoneWidget.h
Unidiff
Diffstat (limited to 'noncore/games/zsame/StoneWidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/zsame/StoneWidget.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/noncore/games/zsame/StoneWidget.h b/noncore/games/zsame/StoneWidget.h
new file mode 100644
index 0000000..9cd7e10
--- a/dev/null
+++ b/noncore/games/zsame/StoneWidget.h
@@ -0,0 +1,115 @@
1/* Yo Emacs, this is -*- C++ -*- */
2/*
3 * ksame 0.4 - simple Game
4 * Copyright (C) 1997,1998 Marcus Kreutzberger
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 */
21
22#ifndef _STONEWIDGET
23#define _STONEWIDGET
24
25#include <qpixmap.h>
26#include <qwidget.h>
27
28#include <qpe/config.h>
29
30#include "StoneField.h"
31
32struct StoneSlice;
33
34class StoneWidget : public QWidget {
35 Q_OBJECT
36
37 int modified;
38 // int marked; // # of marked stones
39
40 int stones_x, stones_y;
41 int sizex, sizey;
42 int field_width, field_height;
43
44 QList<QPoint> history;
45 StoneField stonefield;
46
47 // picture number of stonemovie
48 int slice;
49
50 StoneSlice **map;
51
52public:
53 StoneWidget( QWidget *parent=0, int x=10,int y=10);
54 ~StoneWidget();
55
56 unsigned int board();
57 int score();
58 int marked();
59 QSize size();
60 int colors();
61 virtual QSize sizeHint() const;
62
63 bool undoPossible() const;
64
65 void newGame(unsigned int board, int colors);
66 void reset();
67 void unmark();
68 int undo(int count=1);
69
70 // test for game end
71 bool isGameover();
72 // if isGameover(): finished with bonus?
73 bool hasBonus();
74 // test for unchanged start position
75 bool isOriginalBoard();
76
77 virtual void readProperties(Config *conf);
78 virtual void saveProperties(Config *conf);
79
80protected:
81
82 void timerEvent( QTimerEvent *e );
83 void paintEvent( QPaintEvent *e );
84 void mousePressEvent ( QMouseEvent *e);
85 void myMoveEvent ( QMouseEvent *e);
86
87 // properties of the stone picture
88 int stone_width,stone_height; // size of one stone
89 int maxcolors; // number of different stones (Y direction)
90 int maxslices; // number of pictures per movie (X direction)
91
92signals:
93 // A new game begins
94 void s_newgame();
95
96 void s_colors(int colors);
97 void s_board(int board);
98 void s_score(int score);
99 void s_marked(int m);
100
101 void s_gameover();
102
103 // The stone (x,y) was clicked(removed),
104 // all neighbor stones disappear without further signals
105 void s_remove(int x,int y);
106
107 void s_sizechanged();
108};
109
110#endif
111
112
113
114
115