author | zecke <zecke> | 2004-02-06 12:14:56 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-06 12:14:56 (UTC) |
commit | 0c74629e8f5c12a9b5a282b817f884fa10dee491 (patch) (unidiff) | |
tree | 3294663b92023f8d24d68a01022e011a3c94002d | |
parent | 46ce5afcfbe7be19f4d5ac0fed6886a0759f1a25 (diff) | |
download | opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.zip opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.gz opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.bz2 |
Merge from the 1.0.x release
63 files changed, 489 insertions, 405 deletions
diff --git a/noncore/games/backgammon/backgammon.control b/noncore/games/backgammon/backgammon.control index 6468181..d78b547 100644 --- a/noncore/games/backgammon/backgammon.control +++ b/noncore/games/backgammon/backgammon.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: backgammon | 1 | Package: backgammon |
2 | Files: bin/backgammon apps/Games/backgammon.desktop pics/backgammon help/en/html/backgammon.html | 2 | Files: plugins/application/libbackgammon.so* bin/backgammon apps/Games/backgammon.desktop pics/backgammon help/en/html/backgammon.html |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Ralf Waspe <rwaspe@web.de> | 5 | Maintainer: Ralf Waspe <rwaspe@web.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Backgammon Game | 8 | Description: Backgammon Game |
diff --git a/noncore/games/backgammon/backgammon.h b/noncore/games/backgammon/backgammon.h index e3276f1..fb50500 100644 --- a/noncore/games/backgammon/backgammon.h +++ b/noncore/games/backgammon/backgammon.h | |||
@@ -82,12 +82,13 @@ private: | |||
82 | //display settings | 82 | //display settings |
83 | Display display; | 83 | Display display; |
84 | //is the game finished ? | 84 | //is the game finished ? |
85 | bool gameFinished; | 85 | bool gameFinished; |
86 | 86 | ||
87 | public: | 87 | public: |
88 | static QString appName() { return QString::fromLatin1("backgammon"); } | ||
88 | BackGammon( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 89 | BackGammon( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
89 | ~BackGammon(); | 90 | ~BackGammon(); |
90 | private slots: | 91 | private slots: |
91 | void newgame(); | 92 | void newgame(); |
92 | void playerselect(); | 93 | void playerselect(); |
93 | void loadgame(); | 94 | void loadgame(); |
diff --git a/noncore/games/backgammon/backgammon.pro b/noncore/games/backgammon/backgammon.pro index 4be9491..063d617 100644 --- a/noncore/games/backgammon/backgammon.pro +++ b/noncore/games/backgammon/backgammon.pro | |||
@@ -1,8 +1,7 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | 2 | ||
4 | HEADERS = backgammon.h \ | 3 | HEADERS = backgammon.h \ |
5 | backgammonview.h \ | 4 | backgammonview.h \ |
6 | canvasimageitem.h \ | 5 | canvasimageitem.h \ |
7 | themedialog.h \ | 6 | themedialog.h \ |
8 | moveengine.h \ | 7 | moveengine.h \ |
@@ -25,10 +24,9 @@ SOURCES = main.cpp \ | |||
25 | definition.cpp | 24 | definition.cpp |
26 | 25 | ||
27 | TARGET = backgammon | 26 | TARGET = backgammon |
28 | INCLUDEPATH+= $(OPIEDIR)/include | 27 | INCLUDEPATH+= $(OPIEDIR)/include |
29 | DEPENDPATH+= $(OPIEDIR)/include | 28 | DEPENDPATH+= $(OPIEDIR)/include |
30 | LIBS += -lqpe -lstdc++ | 29 | LIBS += -lqpe -lstdc++ |
31 | DESTDIR = $(OPIEDIR)/bin | ||
32 | 30 | ||
33 | 31 | ||
34 | include ( $(OPIEDIR)/include.pro ) | 32 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/backgammon/main.cpp b/noncore/games/backgammon/main.cpp index 86b452d..58ced10 100644 --- a/noncore/games/backgammon/main.cpp +++ b/noncore/games/backgammon/main.cpp | |||
@@ -1,14 +1,8 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include "backgammon.h" | 2 | #include "backgammon.h" |
3 | 3 | ||
4 | #include <opie/oapplicationfactory.h> | ||
4 | 5 | ||
5 | int main( int argc, char** argv ) | 6 | OPIE_EXPORT_APP( OApplicationFactory<BackGammon> ) |
6 | { | ||
7 | QPEApplication app( argc, argv ); | ||
8 | 7 | ||
9 | BackGammon* view= new BackGammon(); | ||
10 | app.showMainWidget(view); | ||
11 | |||
12 | return app.exec(); | ||
13 | } | ||
14 | 8 | ||
diff --git a/noncore/games/bounce/bounce.pro b/noncore/games/bounce/bounce.pro index 338daf6..75e4a6b 100644 --- a/noncore/games/bounce/bounce.pro +++ b/noncore/games/bounce/bounce.pro | |||
@@ -1,12 +1,10 @@ | |||
1 | TEMPLATE= app | ||
2 | #CONFIG = qt warn_on debug | 1 | #CONFIG = qt warn_on debug |
3 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release quick-app |
4 | HEADERS = game.h kbounce.h | 3 | HEADERS = game.h kbounce.h |
5 | SOURCES = game.cpp kbounce.cpp main.cpp | 4 | SOURCES = game.cpp kbounce.cpp main.cpp |
6 | INCLUDEPATH+= $(OPIEDIR)/include | 5 | INCLUDEPATH+= $(OPIEDIR)/include |
7 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
8 | LIBS += -lqpe | 7 | LIBS += -lqpe |
9 | DESTDIR = $(OPIEDIR)/bin | ||
10 | TARGET = bounce | 8 | TARGET = bounce |
11 | 9 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/bounce/kbounce.cpp b/noncore/games/bounce/kbounce.cpp index 50f4ef6..211f0ff 100644 --- a/noncore/games/bounce/kbounce.cpp +++ b/noncore/games/bounce/kbounce.cpp | |||
@@ -24,13 +24,14 @@ | |||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | #include "kbounce.h" | 26 | #include "kbounce.h" |
27 | #include "game.h" | 27 | #include "game.h" |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | 29 | ||
30 | KJezzball::KJezzball() : QMainWindow(0), m_gameWidget( 0 ) | 30 | KJezzball::KJezzball(QWidget *p, const char* n, WFlags f) |
31 | : QMainWindow(p,n,f), m_gameWidget( 0 ) | ||
31 | { | 32 | { |
32 | setCaption(tr("Bounce")); | 33 | setCaption(tr("Bounce")); |
33 | // setup variables | 34 | // setup variables |
34 | m_game.level = 1; | 35 | m_game.level = 1; |
35 | m_game.score = 0; | 36 | m_game.score = 0; |
36 | m_state = Idle; | 37 | m_state = Idle; |
diff --git a/noncore/games/bounce/kbounce.h b/noncore/games/bounce/kbounce.h index de41710..c59109f 100644 --- a/noncore/games/bounce/kbounce.h +++ b/noncore/games/bounce/kbounce.h | |||
@@ -29,13 +29,14 @@ class QGridLayout; | |||
29 | 29 | ||
30 | class KJezzball : public QMainWindow | 30 | class KJezzball : public QMainWindow |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | 33 | ||
34 | public: | 34 | public: |
35 | KJezzball(); | 35 | static QString appName() { return QString::fromLatin1("bounce"); } |
36 | KJezzball(QWidget *, const char*, WFlags ); | ||
36 | 37 | ||
37 | public slots: | 38 | public slots: |
38 | void newGame(); | 39 | void newGame(); |
39 | void pauseGame(); | 40 | void pauseGame(); |
40 | void closeGame(); | 41 | void closeGame(); |
41 | void about(); | 42 | void about(); |
diff --git a/noncore/games/bounce/main.cpp b/noncore/games/bounce/main.cpp index a6b7c1a..9ea86a6 100644 --- a/noncore/games/bounce/main.cpp +++ b/noncore/games/bounce/main.cpp | |||
@@ -15,15 +15,10 @@ | |||
15 | * License along with this program; if not, write to the Free | 15 | * License along with this program; if not, write to the Free |
16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include "kbounce.h" | 20 | #include "kbounce.h" |
21 | #include <opie/oapplicationfactory.h> | ||
21 | 22 | ||
22 | int main(int argc, char **argv) | 23 | OPIE_EXPORT_APP( OApplicationFactory<KJezzball> ) |
23 | { | ||
24 | QPEApplication a( argc, argv ); | ||
25 | KJezzball *top = new KJezzball; | ||
26 | a.showMainWidget(top); | ||
27 | 24 | ||
28 | return a.exec(); | ||
29 | } | ||
diff --git a/noncore/games/bounce/opie-bounce.control b/noncore/games/bounce/opie-bounce.control index 8b3fdb9..bfe85d3 100644 --- a/noncore/games/bounce/opie-bounce.control +++ b/noncore/games/bounce/opie-bounce.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-bounce | 1 | Package: opie-bounce |
2 | Files: bin/bounce apps/Games/bounce.desktop pics/bounce/*.png | 2 | Files: plugins/application/libbounce.so* bin/bounce apps/Games/bounce.desktop pics/bounce/*.png |
3 | Version: 0.6-$SUB_VERSION | 3 | Version: 0.6-$SUB_VERSION |
4 | Depends: task-opie-minimal | 4 | Depends: task-opie-minimal |
5 | Priority: optional | 5 | Priority: optional |
6 | Section: opie/games | 6 | Section: opie/games |
7 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 7 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
8 | Architecture: arm | 8 | Architecture: arm |
diff --git a/noncore/games/buzzword/buzzword.cpp b/noncore/games/buzzword/buzzword.cpp index 97a17a1..f746065 100644 --- a/noncore/games/buzzword/buzzword.cpp +++ b/noncore/games/buzzword/buzzword.cpp | |||
@@ -65,13 +65,13 @@ void BuzzItem::flip() | |||
65 | { | 65 | { |
66 | setLineWidth( 1 ); | 66 | setLineWidth( 1 ); |
67 | label->setBackgroundColor(label->colorGroup().highlight()); | 67 | label->setBackgroundColor(label->colorGroup().highlight()); |
68 | emit clicked(_row, _column); | 68 | emit clicked(_row, _column); |
69 | } | 69 | } |
70 | 70 | ||
71 | BuzzWord::BuzzWord() : QMainWindow(0) | 71 | BuzzWord::BuzzWord(QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) |
72 | { | 72 | { |
73 | setCaption(tr("buZzword")); | 73 | setCaption(tr("buZzword")); |
74 | 74 | ||
75 | menu = menuBar(); | 75 | menu = menuBar(); |
76 | game = new QPopupMenu; | 76 | game = new QPopupMenu; |
77 | game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N ); | 77 | game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N ); |
diff --git a/noncore/games/buzzword/buzzword.h b/noncore/games/buzzword/buzzword.h index 37dd5b4..c0e43d0 100644 --- a/noncore/games/buzzword/buzzword.h +++ b/noncore/games/buzzword/buzzword.h | |||
@@ -61,13 +61,14 @@ signals: | |||
61 | 61 | ||
62 | class BuzzWord : public QMainWindow | 62 | class BuzzWord : public QMainWindow |
63 | { | 63 | { |
64 | Q_OBJECT | 64 | Q_OBJECT |
65 | 65 | ||
66 | public: | 66 | public: |
67 | BuzzWord(); | 67 | BuzzWord( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
68 | static QString appName() { return QString::fromLatin1("buzzword"); } | ||
68 | 69 | ||
69 | private: | 70 | private: |
70 | void drawGrid(); | 71 | void drawGrid(); |
71 | void bingo(); | 72 | void bingo(); |
72 | QString getWord(); | 73 | QString getWord(); |
73 | 74 | ||
diff --git a/noncore/games/buzzword/buzzword.pro b/noncore/games/buzzword/buzzword.pro index 0faede8..247b593 100644 --- a/noncore/games/buzzword/buzzword.pro +++ b/noncore/games/buzzword/buzzword.pro | |||
@@ -1,11 +1,10 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = buzzword.h | 2 | HEADERS = buzzword.h |
4 | SOURCES = buzzword.cpp main.cpp | 3 | SOURCES = buzzword.cpp main.cpp |
5 | INCLUDEPATH+= $(OPIEDIR)/include | 4 | INCLUDEPATH+= $(OPIEDIR)/include |
6 | DEPENDPATH+= $(OPIEDIR)/include | 5 | DEPENDPATH+= $(OPIEDIR)/include |
7 | DESTDIR = $(OPIEDIR)/bin | ||
8 | LIBS += -lqpe | 6 | LIBS += -lqpe |
9 | TARGET = buzzword | 7 | |
8 | TARGET = buzzword | ||
10 | 9 | ||
11 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/buzzword/main.cpp b/noncore/games/buzzword/main.cpp index 2d9ff81..67f2c26 100644 --- a/noncore/games/buzzword/main.cpp +++ b/noncore/games/buzzword/main.cpp | |||
@@ -14,22 +14,11 @@ | |||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public |
15 | * License along with this program; if not, write to the Free | 15 | * License along with this program; if not, write to the Free |
16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | 20 | #include <opie/oapplicationfactory.h> | |
21 | #include <stdlib.h> | ||
22 | #include <time.h> | ||
23 | 21 | ||
24 | #include "buzzword.h" | 22 | #include "buzzword.h" |
25 | 23 | ||
26 | int main(int argc, char **argv) | 24 | OPIE_EXPORT_APP( OApplicationFactory<BuzzWord> ) |
27 | { | ||
28 | srand(time(0)); | ||
29 | |||
30 | QPEApplication a( argc, argv ); | ||
31 | BuzzWord *top = new BuzzWord; | ||
32 | a.showMainWidget(top); | ||
33 | |||
34 | return a.exec(); | ||
35 | } | ||
diff --git a/noncore/games/buzzword/opie-buzzword.control b/noncore/games/buzzword/opie-buzzword.control index 08b442b..b3e2496 100644 --- a/noncore/games/buzzword/opie-buzzword.control +++ b/noncore/games/buzzword/opie-buzzword.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-buzzword | 1 | Package: opie-buzzword |
2 | Files: bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords | 2 | Files: plugins/application/libbuzzword.so* bin/buzzword apps/Games/buzzword.desktop pics/buzzword/buzzword.png share/buzzword/buzzwords |
3 | Version: 1.1-$SUB_VERSION | 3 | Version: 1.1-$SUB_VERSION |
4 | Depends: task-opie-minimal | 4 | Depends: task-opie-minimal |
5 | Priority: optional | 5 | Priority: optional |
6 | Section: opie/games | 6 | Section: opie/games |
7 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 7 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
8 | Architecture: arm | 8 | Architecture: arm |
diff --git a/noncore/games/fifteen/opie-fifteen.control b/noncore/games/fifteen/opie-fifteen.control index 8fa355f..a6e8314 100644 --- a/noncore/games/fifteen/opie-fifteen.control +++ b/noncore/games/fifteen/opie-fifteen.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-fifteen | 1 | Package: opie-fifteen |
2 | Files: bin/fifteen apps/Games/fifteen.desktop pics/fifteen | 2 | Files: plugins/application/libfifteen.so* bin/fifteen apps/Games/fifteen.desktop pics/fifteen |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 5 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Arch: iPAQ | 7 | Arch: iPAQ |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
diff --git a/noncore/games/go/go.pro b/noncore/games/go/go.pro index 2bc0787..f6c6a54 100644 --- a/noncore/games/go/go.pro +++ b/noncore/games/go/go.pro | |||
@@ -1,9 +1,7 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | CONFIG = qt warn_on release quick-app |
2 | TEMPLATE= app | ||
3 | CONFIG = qt warn_on release | ||
4 | HEADERS = amigo.h \ | 2 | HEADERS = amigo.h \ |
5 | go.h \ | 3 | go.h \ |
6 | goplayutils.h \ | 4 | goplayutils.h \ |
7 | gowidget.h | 5 | gowidget.h |
8 | SOURCES = amigo.c \ | 6 | SOURCES = amigo.c \ |
9 | goplayer.c \ | 7 | goplayer.c \ |
@@ -13,7 +11,9 @@ SOURCES = amigo.c \ | |||
13 | main.cpp | 11 | main.cpp |
14 | INCLUDEPATH += $(OPIEDIR)/include | 12 | INCLUDEPATH += $(OPIEDIR)/include |
15 | DEPENDPATH+= $(OPIEDIR)/include | 13 | DEPENDPATH+= $(OPIEDIR)/include |
16 | LIBS += -lqpe | 14 | LIBS += -lqpe |
17 | TARGET = go | 15 | TARGET = go |
18 | 16 | ||
17 | |||
18 | |||
19 | include ( $(OPIEDIR)/include.pro ) | 19 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp index 6d06f3b..cf89267 100644 --- a/noncore/games/go/gowidget.cpp +++ b/noncore/games/go/gowidget.cpp | |||
@@ -48,14 +48,14 @@ static QBrush *goBrush; | |||
48 | static QPixmap *newBlackStone; | 48 | static QPixmap *newBlackStone; |
49 | static QPixmap *blackStone; | 49 | static QPixmap *blackStone; |
50 | static QPixmap *whiteStone; | 50 | static QPixmap *whiteStone; |
51 | 51 | ||
52 | static bool smallStones = FALSE; | 52 | static bool smallStones = FALSE; |
53 | 53 | ||
54 | GoMainWidget::GoMainWidget( QWidget *parent, const char* name) : | 54 | GoMainWidget::GoMainWidget( QWidget *parent, const char* name, WFlags fl) : |
55 | QMainWindow( parent, name ) | 55 | QMainWindow( parent, name, fl ) |
56 | { | 56 | { |
57 | setToolBarsMovable( FALSE ); | 57 | setToolBarsMovable( FALSE ); |
58 | GoWidget *go = new GoWidget(this); | 58 | GoWidget *go = new GoWidget(this); |
59 | 59 | ||
60 | setCentralWidget(go); | 60 | setCentralWidget(go); |
61 | toolbar = new QToolBar(this); | 61 | toolbar = new QToolBar(this); |
diff --git a/noncore/games/go/gowidget.h b/noncore/games/go/gowidget.h index 94de2cc..429dc33 100644 --- a/noncore/games/go/gowidget.h +++ b/noncore/games/go/gowidget.h | |||
@@ -28,13 +28,14 @@ | |||
28 | class QToolBar; | 28 | class QToolBar; |
29 | 29 | ||
30 | class GoMainWidget : public QMainWindow | 30 | class GoMainWidget : public QMainWindow |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | public: | 33 | public: |
34 | GoMainWidget( QWidget *parent=0, const char* name=0); | 34 | static QString appName() { return QString::fromLatin1("go"); } |
35 | GoMainWidget( QWidget *parent=0, const char* name=0, WFlags fl = 0); | ||
35 | protected: | 36 | protected: |
36 | void resizeEvent( QResizeEvent * ); | 37 | void resizeEvent( QResizeEvent * ); |
37 | private: | 38 | private: |
38 | QToolBar *toolbar; | 39 | QToolBar *toolbar; |
39 | 40 | ||
40 | }; | 41 | }; |
diff --git a/noncore/games/go/main.cpp b/noncore/games/go/main.cpp index c7e2669..f24e3c3 100644 --- a/noncore/games/go/main.cpp +++ b/noncore/games/go/main.cpp | |||
@@ -19,17 +19,10 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "gowidget.h" | 21 | #include "gowidget.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | 24 | ||
25 | #include <stdio.h> | 25 | #include <opie/oapplicationfactory.h> |
26 | |||
27 | OPIE_EXPORT_APP( OApplicationFactory<GoMainWidget> ) | ||
26 | 28 | ||
27 | int main( int argc, char ** argv) | ||
28 | { | ||
29 | QPEApplication app( argc, argv ); | ||
30 | |||
31 | GoMainWidget m; | ||
32 | m.setCaption( GoWidget::tr("Go") ); | ||
33 | app.showMainWidget( &m ); | ||
34 | return app.exec(); | ||
35 | } | ||
diff --git a/noncore/games/go/opie-go.control b/noncore/games/go/opie-go.control index b07e8be..95b319e 100644 --- a/noncore/games/go/opie-go.control +++ b/noncore/games/go/opie-go.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-go | 1 | Package: opie-go |
2 | Files: bin/go apps/Games/go.desktop pics/go | 2 | Files: plugins/application/libgo.so* bin/go apps/Games/go.desktop pics/go |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Opie Project <opie@handhelds.org> | 5 | Maintainer: Warwick Allison <warwick@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: The game of Go | 8 | Description: The game of Go |
9 | A game for the Opie environment. | 9 | A game for the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/noncore/games/kcheckers/kcheckers.cpp b/noncore/games/kcheckers/kcheckers.cpp index c2eba0d..2eb37e5 100644 --- a/noncore/games/kcheckers/kcheckers.cpp +++ b/noncore/games/kcheckers/kcheckers.cpp | |||
@@ -39,15 +39,16 @@ QString KCheckers::enNumeration="1 2 3 4 5 6 7 8 9 10111213141516171819202122232 | |||
39 | QString KCheckers::ruNumeration="B8D8F8H8A7C7E7G7B6D6F6H6A5C5E5G5B4D4F4H4A3C3E3G3B2D2F2H2A1C1E1G1"; | 39 | QString KCheckers::ruNumeration="B8D8F8H8A7C7E7G7B6D6F6H6A5C5E5G5B4D4F4H4A3C3E3G3B2D2F2H2A1C1E1G1"; |
40 | 40 | ||
41 | const int KCheckers::t[]={6,7,8,9,11,12,13,14,17,18,19,20,22,23, | 41 | const int KCheckers::t[]={6,7,8,9,11,12,13,14,17,18,19,20,22,23, |
42 | 24,25,28,29,30,31,33,34,35,36,39,40,41,42,44,45,46,47}; | 42 | 24,25,28,29,30,31,33,34,35,36,39,40,41,42,44,45,46,47}; |
43 | 43 | ||
44 | 44 | ||
45 | KCheckers::KCheckers():QMainWindow(0,0,WStyle_DialogBorder) | 45 | KCheckers::KCheckers(QWidget *p, const char* n, WFlags ) |
46 | :QMainWindow(p,n,WStyle_DialogBorder) | ||
46 | { | 47 | { |
47 | setCaption("KCheckers"); | 48 | setCaption(tr("KCheckers") ); |
48 | setIcon(QPixmap(biglogo_xpm)); | 49 | setIcon(QPixmap(biglogo_xpm)); |
49 | 50 | ||
50 | setToolBarsMovable(false); | 51 | setToolBarsMovable(false); |
51 | 52 | ||
52 | // Make a menubar | 53 | // Make a menubar |
53 | 54 | ||
diff --git a/noncore/games/kcheckers/kcheckers.h b/noncore/games/kcheckers/kcheckers.h index ccf5bae..bd4afc7 100644 --- a/noncore/games/kcheckers/kcheckers.h +++ b/noncore/games/kcheckers/kcheckers.h | |||
@@ -26,13 +26,14 @@ class QToolButton; | |||
26 | 26 | ||
27 | 27 | ||
28 | class KCheckers:public QMainWindow | 28 | class KCheckers:public QMainWindow |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | public: | 31 | public: |
32 | KCheckers(); | 32 | static QString appName() { return QString::fromLatin1("kcheckers"); } |
33 | KCheckers(QWidget *parent, const char* name, WFlags fl); | ||
33 | 34 | ||
34 | protected: | 35 | protected: |
35 | void closeEvent(QCloseEvent*); | 36 | void closeEvent(QCloseEvent*); |
36 | 37 | ||
37 | private slots: | 38 | private slots: |
38 | 39 | ||
diff --git a/noncore/games/kcheckers/kcheckers.pro b/noncore/games/kcheckers/kcheckers.pro index a23e83a..0d417bf 100644 --- a/noncore/games/kcheckers/kcheckers.pro +++ b/noncore/games/kcheckers/kcheckers.pro | |||
@@ -1,8 +1,7 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = checkers.h \ | 2 | HEADERS = checkers.h \ |
4 | echeckers.h \ | 3 | echeckers.h \ |
5 | field.h \ | 4 | field.h \ |
6 | kcheckers.h \ | 5 | kcheckers.h \ |
7 | rcheckers.h | 6 | rcheckers.h |
8 | SOURCES = checkers.cpp \ | 7 | SOURCES = checkers.cpp \ |
@@ -11,10 +10,10 @@ SOURCES = checkers.cpp \ | |||
11 | kcheckers.cpp \ | 10 | kcheckers.cpp \ |
12 | main.cpp \ | 11 | main.cpp \ |
13 | rcheckers.cpp | 12 | rcheckers.cpp |
14 | INTERFACES= | 13 | INTERFACES= |
15 | INCLUDEPATH+= $(OPIEDIR)/include | 14 | INCLUDEPATH+= $(OPIEDIR)/include |
16 | LIBS += -lqpe | 15 | LIBS += -lqpe |
17 | DESTDIR = $(OPIEDIR)/bin | ||
18 | TARGET = kcheckers | 16 | TARGET = kcheckers |
19 | 17 | ||
18 | |||
20 | include ( $(OPIEDIR)/include.pro ) | 19 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/kcheckers/main.cpp b/noncore/games/kcheckers/main.cpp index b8dd620..6ac570a 100644 --- a/noncore/games/kcheckers/main.cpp +++ b/noncore/games/kcheckers/main.cpp | |||
@@ -1,18 +1,10 @@ | |||
1 | 1 | ||
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qfont.h> | 3 | #include <qfont.h> |
4 | 4 | ||
5 | #include "kcheckers.h" | 5 | #include "kcheckers.h" |
6 | #include <opie/oapplicationfactory.h> | ||
6 | 7 | ||
8 | OPIE_EXPORT_APP( OApplicationFactory<KCheckers> ) | ||
7 | 9 | ||
8 | int main(int argc, char *argv[]) | ||
9 | { | ||
10 | QPEApplication app(argc,argv); | ||
11 | |||
12 | KCheckers kcheckers; | ||
13 | app.setMainWidget(&kcheckers); | ||
14 | kcheckers.showMaximized(); | ||
15 | |||
16 | return app.exec(); | ||
17 | } | ||
18 | 10 | ||
diff --git a/noncore/games/kcheckers/opie-kcheckers.control b/noncore/games/kcheckers/opie-kcheckers.control index e228209..71f83af 100644 --- a/noncore/games/kcheckers/opie-kcheckers.control +++ b/noncore/games/kcheckers/opie-kcheckers.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-kcheckers | 1 | Package: opie-kcheckers |
2 | Files: bin/kcheckers apps/Games/kcheckers.desktop pics/kcheckers | 2 | Files: plugins/application/libkcheckers.so* bin/kcheckers apps/Games/kcheckers.desktop pics/kcheckers |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: leseb <prudhomme@laposte.net> | 5 | Maintainer: leseb <prudhomme@laposte.net> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.3-$SUB_VERSION | 7 | Version: 0.3-$SUB_VERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
diff --git a/noncore/games/mindbreaker/main.cpp b/noncore/games/mindbreaker/main.cpp index 8ba0fde..2ca16e3 100644 --- a/noncore/games/mindbreaker/main.cpp +++ b/noncore/games/mindbreaker/main.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -17,19 +17,19 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "mindbreaker.h" | 21 | #include "mindbreaker.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qtopia/qpeapplication.h> |
24 | 24 | ||
25 | int main( int argc, char **argv ) | 25 | int main( int argc, char **argv ) |
26 | { | 26 | { |
27 | QPEApplication a( argc, argv ); | 27 | QPEApplication a( argc, argv ); |
28 | 28 | ||
29 | MindBreaker w(0, "new window"); | 29 | MindBreaker w; |
30 | w.setCaption("Mind Breaker"); | 30 | w.setCaption(MindBreaker::tr("Mind Breaker")); |
31 | QPEApplication::setInputMethodHint( &w, QPEApplication::AlwaysOff ); | 31 | QPEApplication::setInputMethodHint( &w, QPEApplication::AlwaysOff ); |
32 | a.showMainWidget(&w); | 32 | a.showMainWidget(&w); |
33 | 33 | ||
34 | return a.exec(); | 34 | return a.exec(); |
35 | } | 35 | } |
diff --git a/noncore/games/mindbreaker/mindbreaker.cpp b/noncore/games/mindbreaker/mindbreaker.cpp index 7802e38..e1f43d0 100644 --- a/noncore/games/mindbreaker/mindbreaker.cpp +++ b/noncore/games/mindbreaker/mindbreaker.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -17,41 +17,101 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "mindbreaker.h" | 21 | #include "mindbreaker.h" |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qtopia/resource.h> |
24 | #include <qpe/config.h> | 24 | #include <qtopia/config.h> |
25 | #include <qtopia/qpeapplication.h> | ||
26 | #include <qtoolbar.h> | ||
25 | 27 | ||
26 | #include <qpainter.h> | 28 | #include <qpainter.h> |
27 | #include <qpixmap.h> | 29 | #include <qpixmap.h> |
28 | #include <qpe/qpetoolbar.h> | ||
29 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
30 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
31 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
32 | #include <qlabel.h> | 33 | #include <qlabel.h> |
33 | #include <qstyle.h> | 34 | #include <qlayout.h> |
35 | #include <qtimer.h> | ||
34 | 36 | ||
35 | #include <stdlib.h> | 37 | #include <stdlib.h> |
36 | #include <sys/time.h> | 38 | #include <sys/time.h> |
37 | #include <unistd.h> | 39 | #include <unistd.h> |
38 | 40 | ||
39 | static int pegRTTI = 3393393; | 41 | static int pegRTTI = 3393393; |
40 | 42 | ||
43 | static int adjusted_panel_height; | ||
44 | static int adjusted_panel_width; | ||
45 | |||
46 | static int adjusted_bin_margin; | ||
47 | static int adjusted_peg_size; | ||
48 | static int adjusted_answerpeg_size; | ||
49 | |||
50 | static int adjusted_title_height; | ||
51 | static int adjusted_title_width; | ||
52 | |||
53 | static int adjusted_first_peg_x_diff; | ||
54 | static int adjusted_first_peg_y_diff; | ||
55 | static int adjusted_peg_spacing; | ||
56 | |||
57 | static int adjusted_answerpegx; | ||
58 | static int adjusted_answerpegy; | ||
59 | static int adjusted_answerpeg_xdiff; | ||
60 | static int adjusted_answerpeg_ydiff; | ||
61 | |||
62 | static int adjusted_board_height; | ||
63 | static int adjusted_board_width; | ||
64 | |||
65 | static void setupBoardSize(int w, int h) | ||
66 | { | ||
67 | adjusted_panel_width = w * 3/4; | ||
68 | adjusted_title_width = w * 3/4; | ||
69 | |||
70 | adjusted_title_height = h/10; | ||
71 | adjusted_panel_height = (h-adjusted_title_height)/9; | ||
72 | |||
73 | adjusted_bin_margin = w * 10/240; | ||
74 | adjusted_peg_size = adjusted_panel_height*3/4; | ||
75 | adjusted_answerpeg_size = QMIN(adjusted_panel_width*15/180,adjusted_panel_height*15/25); | ||
76 | |||
77 | // looks a bit dodgy on larger sizes | ||
78 | if ( adjusted_peg_size > 40 ) | ||
79 | adjusted_peg_size = 40; | ||
80 | |||
81 | adjusted_first_peg_x_diff = w * 31/240-adjusted_peg_size/2; | ||
82 | adjusted_first_peg_y_diff = (adjusted_panel_height - adjusted_peg_size)/2; | ||
83 | adjusted_peg_spacing = w * 30/240; | ||
84 | |||
85 | // looks a bit dodgy on larger sizes (still does though, but not as much...) | ||
86 | if ( adjusted_answerpeg_size > 22 ) | ||
87 | adjusted_answerpeg_size = 22; | ||
88 | |||
89 | adjusted_answerpegx = adjusted_panel_width * 159/180 - adjusted_answerpeg_size/2; | ||
90 | adjusted_answerpegy = adjusted_panel_height/3 - adjusted_answerpeg_size/2; | ||
91 | adjusted_answerpeg_xdiff = adjusted_panel_width * 10/180; | ||
92 | adjusted_answerpeg_ydiff = adjusted_panel_height * 9/25; | ||
93 | |||
94 | adjusted_board_height = adjusted_title_height + (adjusted_panel_height * 9); | ||
95 | adjusted_board_width = adjusted_panel_width + (adjusted_bin_margin * 2) + adjusted_peg_size; | ||
96 | |||
97 | // qDebug("Adjusted width %d height %d", adjusted_board_width, adjusted_board_height); | ||
98 | } | ||
99 | |||
100 | |||
41 | /* helper class, */ | 101 | /* helper class, */ |
42 | class Peg : public QCanvasRectangle | 102 | class Peg : public QCanvasRectangle |
43 | { | 103 | { |
44 | public: | 104 | public: |
45 | Peg(QCanvas *canvas, int type, int go = -1, int pos = -1); | 105 | Peg(QCanvas *canvas, int type, int go = -1, int pos = -1); |
46 | int rtti() const {return pegRTTI; } | 106 | int rtti() const {return pegRTTI; } |
47 | void advance(int phase); | 107 | void advance(int phase); |
48 | 108 | ||
49 | bool hit( const QPoint &) const; | 109 | bool hit( const QPoint &) const; |
50 | 110 | ||
51 | /* a placed peg is one that has been set down on the board correctly and | 111 | /* a placed peg is one that has been set down on the board correctly and |
52 | should not be moved, only copied */ | 112 | should not be moved, only copied */ |
53 | bool placed() const; | 113 | bool placed() const; |
54 | void setPlaced(bool); | 114 | void setPlaced(bool); |
55 | 115 | ||
56 | int pegGo() const; | 116 | int pegGo() const; |
57 | int pegPos() const; | 117 | int pegPos() const; |
@@ -74,69 +134,75 @@ private: | |||
74 | int pegtype; | 134 | int pegtype; |
75 | int peg_go; | 135 | int peg_go; |
76 | int peg_pos; | 136 | int peg_pos; |
77 | 137 | ||
78 | int aniStep; | 138 | int aniStep; |
79 | }; | 139 | }; |
80 | |||
81 | int Peg::eggLevel = 0; | 140 | int Peg::eggLevel = 0; |
82 | QVector<QImage> Peg::normalPegs; | 141 | QVector<QImage> Peg::normalPegs; |
83 | QVector<QImage> Peg::specialPegs; | 142 | QVector<QImage> Peg::specialPegs; |
84 | 143 | ||
85 | void Peg::buildImages() | 144 | void Peg::buildImages() |
86 | { | 145 | { |
87 | |||
88 | QImage pegs = Resource::loadImage("mindbreaker/pegs"); | 146 | QImage pegs = Resource::loadImage("mindbreaker/pegs"); |
89 | int x = 0; | 147 | int x = 0; |
90 | int y = 0; | 148 | int y = 0; |
91 | int i; | 149 | int i; |
92 | eggLevel = 0; | 150 | eggLevel = 0; |
93 | normalPegs.resize(10); | 151 | normalPegs.resize(10); |
94 | for (i = 0; i < 6; i++) { | 152 | for (i = 0; i < 6; i++) { |
95 | normalPegs.insert(i, new QImage(pegs.copy(x, y, peg_size, peg_size))); | 153 | normalPegs.insert(i, new QImage(pegs.copy(x, y, peg_size, peg_size). |
154 | smoothScale(adjusted_peg_size, adjusted_peg_size) )); | ||
96 | x += peg_size; | 155 | x += peg_size; |
97 | } | 156 | } |
98 | specialPegs.resize(5); | 157 | specialPegs.resize(5); |
99 | for (i = 0; i < 5; i++) { | 158 | for (i = 0; i < 5; i++) { |
100 | specialPegs.insert(i, new QImage(pegs.copy(x,y,peg_size, peg_size))); | 159 | specialPegs.insert(i, new QImage(pegs.copy(x,y,peg_size, peg_size). |
160 | smoothScale(adjusted_peg_size, adjusted_peg_size) )); | ||
101 | x += peg_size; | 161 | x += peg_size; |
102 | } | 162 | } |
103 | 163 | ||
104 | QImage image = Resource::loadImage("mindbreaker/mindbreaker"); | 164 | QImage image = Resource::loadImage("mindbreaker/mindbreaker"); |
105 | /* copy from master image to functional images */ | 165 | /* copy from master image to functional images */ |
106 | x = 0; | 166 | x = 0; |
107 | y = panel_height; | 167 | y = panel_height; |
108 | normalPegs.insert(8, | 168 | normalPegs.insert(8, |
109 | new QImage(image.copy(x, y, panel_width, panel_height))); | 169 | new QImage( image.copy(x, y, panel_width, panel_height). |
170 | smoothScale( adjusted_panel_width, adjusted_panel_height) | ||
171 | )); | ||
110 | y += panel_height; | 172 | y += panel_height; |
111 | y += title_height; | 173 | y += title_height; |
112 | normalPegs.insert(9, | 174 | normalPegs.insert(9, |
113 | new QImage(image.copy(x, y, title_width, title_height))); | 175 | new QImage(image.copy(x, y, title_width, title_height). |
176 | smoothScale( adjusted_title_width, adjusted_title_height) | ||
177 | )); | ||
114 | y += title_height; | 178 | y += title_height; |
115 | 179 | ||
116 | x = 6 * peg_size; | 180 | x = 6 * peg_size; |
117 | normalPegs.insert(6, | 181 | normalPegs.insert(6, |
118 | new QImage(image.copy(x, y, answerpeg_size, answerpeg_size))); | 182 | new QImage(image.copy(x, y, answerpeg_size, answerpeg_size). |
183 | smoothScale( adjusted_answerpeg_size, adjusted_answerpeg_size) )); | ||
119 | x += answerpeg_size; | 184 | x += answerpeg_size; |
120 | normalPegs.insert(7, | 185 | normalPegs.insert(7, |
121 | new QImage(image.copy(x, y, answerpeg_size, answerpeg_size))); | 186 | new QImage(image.copy(x, y, answerpeg_size, answerpeg_size). |
187 | smoothScale( adjusted_answerpeg_size, adjusted_answerpeg_size) )); | ||
122 | } | 188 | } |
123 | 189 | ||
124 | QImage Peg::imageForType(int t) | 190 | QImage Peg::imageForType(int t) |
125 | { | 191 | { |
126 | if (eggLevel > t ) { | 192 | if (eggLevel > t ) { |
127 | if( t < 5) { | 193 | if( t < 5) { |
128 | return *specialPegs[t]; | 194 | return *specialPegs[t]; |
129 | } else { | 195 | } else { |
130 | return *normalPegs[rand() % 6]; | 196 | return *normalPegs[rand() % 6]; |
131 | } | 197 | } |
132 | } | 198 | } |
133 | return *normalPegs[t]; | 199 | return *normalPegs[t]; |
134 | } | 200 | } |
135 | 201 | ||
136 | Peg::Peg(QCanvas *canvas , int t, int g, int p) | 202 | Peg::Peg(QCanvas *canvas , int t, int g, int p) |
137 | : QCanvasRectangle(canvas) | 203 | : QCanvasRectangle(canvas) |
138 | { | 204 | { |
139 | setSize(normalPegs[t]->width(), normalPegs[t]->height() ); | 205 | setSize(normalPegs[t]->width(), normalPegs[t]->height() ); |
140 | pegtype = t; | 206 | pegtype = t; |
141 | isplaced = FALSE; | 207 | isplaced = FALSE; |
142 | peg_pos = p; | 208 | peg_pos = p; |
@@ -154,15 +220,15 @@ void Peg::advance(int phase) { | |||
154 | } | 220 | } |
155 | } | 221 | } |
156 | 222 | ||
157 | void Peg::drawShape(QPainter &p ) | 223 | void Peg::drawShape(QPainter &p ) |
158 | { | 224 | { |
159 | if ((pegtype == 5) && eggLevel > 5) { | 225 | if ((pegtype == 5) && eggLevel > 5) { |
160 | p.drawImage(x(), y(), *normalPegs[aniStep]); | 226 | p.drawImage(int(x()), int(y()), *normalPegs[aniStep]); |
161 | } else | 227 | } else |
162 | p.drawImage(x(), y(), imageForType(pegtype)); | 228 | p.drawImage(int(x()), int(y()), imageForType(pegtype)); |
163 | } | 229 | } |
164 | 230 | ||
165 | bool Peg::hit( const QPoint &p ) const | 231 | bool Peg::hit( const QPoint &p ) const |
166 | { | 232 | { |
167 | int ix = p.x() - int(x()); | 233 | int ix = p.x() - int(x()); |
168 | int iy = p.y() - int(y()); | 234 | int iy = p.y() - int(y()); |
@@ -184,114 +250,127 @@ inline int Peg::pegGo() const | |||
184 | 250 | ||
185 | inline int Peg::pegPos() const | 251 | inline int Peg::pegPos() const |
186 | { | 252 | { |
187 | return peg_pos; | 253 | return peg_pos; |
188 | } | 254 | } |
189 | 255 | ||
190 | inline void Peg::setPegPos(int p) | 256 | inline void Peg::setPegPos(int p) |
191 | { | 257 | { |
192 | peg_pos = p; | 258 | peg_pos = p; |
193 | } | 259 | } |
194 | 260 | ||
195 | inline void Peg::setPlaced(bool p) | 261 | inline void Peg::setPlaced(bool p) |
196 | { | 262 | { |
197 | isplaced = p; | 263 | isplaced = p; |
198 | } | 264 | } |
199 | 265 | ||
200 | inline int Peg::type() const | 266 | inline int Peg::type() const |
201 | { | 267 | { |
202 | return pegtype; | 268 | return pegtype; |
203 | } | 269 | } |
204 | 270 | ||
205 | /* Load the main image, copy from it the pegs, the board, and the answer image | 271 | /* Load the main image, copy from it the pegs, the board, and the answer image |
206 | * and use these to create the tray, answer and board | 272 | * and use these to create the tray, answer and board |
207 | */ | 273 | */ |
208 | MindBreaker::MindBreaker( QWidget *parent, const char *name, int wFlags ) | 274 | MindBreaker::MindBreaker( QWidget *parent, const char *name, int wFlags ) |
209 | : QMainWindow(parent, name, wFlags), | 275 | : QMainWindow(parent, name, wFlags) |
210 | canvas(board_height, board_width) | ||
211 | { | 276 | { |
212 | MindBreakerBoard *m = new MindBreakerBoard(canvas, this); | 277 | setCaption( tr("Mind Breaker")); |
213 | setCentralWidget(m); | 278 | QPEApplication::setInputMethodHint( this, QPEApplication::AlwaysOff ); |
214 | 279 | setMinimumSize(160,210); | |
280 | |||
281 | QWidget *w = new QWidget( this ); | ||
282 | w->setBackgroundColor( black ); | ||
283 | QHBoxLayout *hb = new QHBoxLayout( w ); | ||
284 | hb->addStretch(); | ||
285 | board = new MindBreakerBoard(w); | ||
286 | hb->addWidget( board, 100 ); | ||
287 | hb->addStretch(); | ||
288 | |||
289 | setCentralWidget(w); | ||
290 | |||
215 | setToolBarsMovable( FALSE ); | 291 | setToolBarsMovable( FALSE ); |
216 | 292 | ||
217 | QToolBar *tb = new QToolBar(this); | 293 | QToolBar *tb = new QToolBar(this); |
218 | tb->setHorizontalStretchable( TRUE ); | 294 | tb->setHorizontalStretchable( TRUE ); |
219 | 295 | ||
220 | QPixmap newicon = Resource::loadPixmap("new"); | 296 | QIconSet newicon = Resource::loadIconSet("new"); |
221 | new QToolButton(newicon, tr("New Game"), 0, | 297 | new QToolButton(newicon, tr("New Game"), 0, |
222 | m, SLOT(clear()), tb, "NewGame"); | 298 | board, SLOT(clear()), tb, "NewGame"); |
223 | 299 | ||
224 | score = new QToolButton(tb); | 300 | score = new QToolButton(tb); |
225 | score->setText(""); | 301 | score->setText(""); |
226 | score->setMaximumHeight(20); | 302 | score->setMaximumHeight(20); |
227 | score->setUsesTextLabel(TRUE); | 303 | score->setUsesTextLabel(TRUE); |
228 | tb->setStretchableWidget(score); | 304 | tb->setStretchableWidget(score); |
229 | 305 | ||
230 | connect(m, SIGNAL(scoreChanged(int, int)), this, SLOT(setScore(int, int))); | 306 | connect(board, SIGNAL(scoreChanged(int,int)), this, SLOT(setScore(int,int))); |
231 | connect(score, SIGNAL(clicked()), m, SLOT(resetScore())); | 307 | connect(score, SIGNAL(clicked()), board, SLOT(resetScore())); |
232 | 308 | ||
233 | int a, b; | 309 | int a, b; |
234 | m->getScore(&a, &b); | 310 | board->getScore(&a, &b); |
235 | setScore(a,b); | 311 | setScore(a,b); |
312 | |||
313 | layout()->setResizeMode(QLayout::FreeResize); | ||
236 | } | 314 | } |
237 | 315 | ||
238 | void MindBreaker::setScore(int turns, int games) | 316 | void MindBreaker::setScore(int turns, int games) |
239 | { | 317 | { |
240 | double average; | 318 | double average; |
241 | double total_turns = turns; | 319 | double total_turns = turns; |
242 | double total_games = games; | 320 | double total_games = games; |
243 | 321 | ||
244 | if(total_games > 0) | 322 | if(total_games > 0) |
245 | average = total_turns / total_games; | 323 | average = total_turns / total_games; |
246 | else | 324 | else |
247 | average = 0.0; | 325 | average = 0.0; |
248 | 326 | ||
249 | score->setText(tr("win avg: %1 turns (%2 games)").arg(average).arg(games)); | 327 | score->setText(tr("win avg: %1 turns (%2 games)").arg(average).arg(games)); |
250 | } | 328 | } |
251 | 329 | ||
330 | void MindBreaker::resizeEvent( QResizeEvent *e ) | ||
331 | { | ||
332 | board->fixSize(); | ||
333 | QMainWindow::resizeEvent( e ); | ||
334 | } | ||
335 | |||
252 | 336 | ||
253 | MindBreakerBoard::MindBreakerBoard( QCanvas &canv, QWidget *parent, | 337 | MindBreakerBoard::MindBreakerBoard( QWidget *parent, |
254 | const char *name, int wFlags ) | 338 | const char *name, int wFlags ) |
255 | : QCanvasView(&canv, parent, name, wFlags) | 339 | : QCanvasView(0, parent, name, wFlags), |
340 | moving(0), game_over(FALSE), total_turns(0), total_games(0) | ||
256 | { | 341 | { |
257 | int i, x, y; | 342 | setFrameStyle( NoFrame ); |
343 | setupBoardSize(qApp->desktop()->width(),qApp->desktop()->height()); | ||
344 | cnv.resize(100,100); | ||
345 | setCanvas(&cnv); | ||
346 | setBackgroundColor( black ); | ||
347 | |||
258 | struct timeval tv; | 348 | struct timeval tv; |
259 | 349 | ||
260 | current_go = 0; | 350 | current_go = 0; |
261 | gettimeofday(&tv, 0); | 351 | gettimeofday(&tv, 0); |
262 | |||
263 | srand(tv.tv_usec); | 352 | srand(tv.tv_usec); |
264 | 353 | ||
265 | canvas()->setAdvancePeriod(500); | 354 | canvas()->setAdvancePeriod(500); |
355 | current_highlight = 0; | ||
266 | 356 | ||
267 | QImage image = Resource::loadImage("mindbreaker/mindbreaker"); | 357 | widthTimer = new QTimer( this ); |
268 | 358 | connect(widthTimer, SIGNAL(timeout()), this, SLOT(doFixSize()) ); | |
269 | /* copy from master image to functional images */ | ||
270 | x = 0; | ||
271 | y = 0; | ||
272 | panelImage = image.copy(x,y, panel_width, panel_height); | ||
273 | y += panel_height; | ||
274 | y += panel_height; | ||
275 | |||
276 | titleImage = image.copy(x, y, title_width, title_height); | ||
277 | |||
278 | Peg::buildImages(); // must be done BEFORE any pegs are made | ||
279 | |||
280 | current_highlight = new Peg(canvas(), 8); | ||
281 | current_highlight->setPlaced(TRUE); | ||
282 | current_highlight->setX(0); | ||
283 | current_highlight->setY(board_height - ((current_go + 1) * panel_height)); | ||
284 | current_highlight->setZ(0); | ||
285 | current_highlight->show(); | ||
286 | 359 | ||
360 | setMaximumWidth( QMIN(qApp->desktop()->height(),qApp->desktop()->width()) ); | ||
361 | //doFixSize(); // build images... needs to be done before reading config. | ||
362 | //readConfig(); // first read... to ensure initial labels and side look right. | ||
363 | } | ||
287 | 364 | ||
288 | /* set up the game */ | 365 | void MindBreakerBoard::readConfig() |
366 | { | ||
289 | Config c("MindBreaker", Config::User); | 367 | Config c("MindBreaker", Config::User); |
290 | c.setGroup("Board"); | 368 | c.setGroup("Board"); |
291 | game_over = FALSE; | 369 | game_over = FALSE; |
370 | int i; | ||
292 | if (c.readNumEntry("Answer0") < 0) { | 371 | if (c.readNumEntry("Answer0") < 0) { |
293 | for (i = 0; i < 4; i++) { | 372 | for (i = 0; i < 4; i++) { |
294 | answer[i] = rand() % 6; | 373 | answer[i] = rand() % 6; |
295 | current_guess[i] = 6; | 374 | current_guess[i] = 6; |
296 | } | 375 | } |
297 | total_turns = 0; | 376 | total_turns = 0; |
@@ -306,13 +385,13 @@ MindBreakerBoard::MindBreakerBoard( QCanvas &canv, QWidget *parent, | |||
306 | if(total_games < 0) | 385 | if(total_games < 0) |
307 | total_games = 0; | 386 | total_games = 0; |
308 | 387 | ||
309 | 388 | ||
310 | checkScores(); | 389 | checkScores(); |
311 | c.setGroup("Board"); | 390 | c.setGroup("Board"); |
312 | for(i = 0; i < 4; i++) | 391 | for(i = 0; i < 4; i++) |
313 | answer[i] = c.readNumEntry(QString("Answer%1").arg(i)); | 392 | answer[i] = c.readNumEntry(QString("Answer%1").arg(i)); |
314 | /* read, and parse past guesses */ | 393 | /* read, and parse past guesses */ |
315 | current_go = 0; | 394 | current_go = 0; |
316 | for(j=0; j < 9; j++) { | 395 | for(j=0; j < 9; j++) { |
317 | current_guess[0] = c.readNumEntry(QString("Go%1p0").arg(j)); | 396 | current_guess[0] = c.readNumEntry(QString("Go%1p0").arg(j)); |
318 | if (current_guess[0] < 0) | 397 | if (current_guess[0] < 0) |
@@ -325,46 +404,47 @@ MindBreakerBoard::MindBreakerBoard( QCanvas &canv, QWidget *parent, | |||
325 | current_guess[3] = c.readNumEntry(QString("Go%1p3").arg(j)); | 404 | current_guess[3] = c.readNumEntry(QString("Go%1p3").arg(j)); |
326 | placeGuessPeg(3, current_guess[3]); | 405 | placeGuessPeg(3, current_guess[3]); |
327 | checkGuess(); | 406 | checkGuess(); |
328 | } | 407 | } |
329 | for(i = 0; i < 4; i++) { | 408 | for(i = 0; i < 4; i++) { |
330 | current_guess[i] = c.readNumEntry(QString("CurrentGo%1").arg(i)); | 409 | current_guess[i] = c.readNumEntry(QString("CurrentGo%1").arg(i)); |
331 | if (current_guess[i] != 6) | 410 | if (current_guess[i] != 6) |
332 | placeGuessPeg(i, current_guess[i]); | 411 | placeGuessPeg(i, current_guess[i]); |
333 | } | 412 | } |
334 | } | 413 | } |
335 | |||
336 | /* draw initial screen */ | ||
337 | drawBackground(); | ||
338 | canvas()->update(); | ||
339 | } | 414 | } |
340 | 415 | ||
341 | MindBreakerBoard::~MindBreakerBoard() | 416 | MindBreakerBoard::~MindBreakerBoard() |
342 | { | 417 | { |
343 | int i, j; | 418 | int i; |
344 | if (game_over) { | 419 | if (game_over) { |
345 | current_go = 0; | 420 | current_go = 0; |
346 | /* clear the answer, clear the guess */ | 421 | /* clear the answer, clear the guess */ |
347 | for (i = 0; i < 4; i++) { | 422 | for (i = 0; i < 4; i++) { |
348 | answer[i] = rand() % 6; | 423 | answer[i] = rand() % 6; |
349 | current_guess[i] = 6; | 424 | current_guess[i] = 6; |
350 | } | 425 | } |
351 | } | 426 | } |
352 | 427 | writeConfig(); | |
428 | } | ||
429 | |||
430 | void MindBreakerBoard::writeConfig() | ||
431 | { | ||
353 | Config c("MindBreaker", Config::User); | 432 | Config c("MindBreaker", Config::User); |
354 | c.setGroup("Board"); | 433 | c.setGroup("Board"); |
355 | c.clearGroup(); | 434 | c.clearGroup(); |
356 | /* write the board */ | 435 | /* write the board */ |
436 | int i,j; | ||
357 | for (i = 0; i < current_go; i++) { | 437 | for (i = 0; i < current_go; i++) { |
358 | for(j = 0; j < 4; j++) | 438 | for(j = 0; j < 4; j++) |
359 | c.writeEntry(tr("Go%1p%2").arg(i).arg(j), past_guesses[4*i+j]); | 439 | c.writeEntry(QString("Go%1p%2").arg(i).arg(j), past_guesses[4*i+j]); |
360 | } | 440 | } |
361 | for(j = 0; j < 4; j++) | 441 | for(j = 0; j < 4; j++) |
362 | c.writeEntry(tr("CurrentGo%1").arg(j), current_guess[j]); | 442 | c.writeEntry(QString("CurrentGo%1").arg(j), current_guess[j]); |
363 | for(j = 0; j < 4; j++) | 443 | for(j = 0; j < 4; j++) |
364 | c.writeEntry(tr("Answer%1").arg(j), answer[j]); | 444 | c.writeEntry(QString("Answer%1").arg(j), answer[j]); |
365 | 445 | ||
366 | c.setGroup("Score"); | 446 | c.setGroup("Score"); |
367 | /* write the score */ | 447 | /* write the score */ |
368 | 448 | ||
369 | c.writeEntry("Turns", total_turns); | 449 | c.writeEntry("Turns", total_turns); |
370 | c.writeEntry("Games", total_games); | 450 | c.writeEntry("Games", total_games); |
@@ -374,17 +454,81 @@ void MindBreakerBoard::getScore(int *a, int *b) | |||
374 | { | 454 | { |
375 | *a = total_turns; | 455 | *a = total_turns; |
376 | *b = total_games; | 456 | *b = total_games; |
377 | return; | 457 | return; |
378 | } | 458 | } |
379 | 459 | ||
460 | void MindBreakerBoard::fixSize() | ||
461 | { | ||
462 | hide(); | ||
463 | setMaximumWidth( parentWidget()->height() ); | ||
464 | widthTimer->start( 20, TRUE ); | ||
465 | } | ||
466 | |||
467 | void MindBreakerBoard::doFixSize() | ||
468 | { | ||
469 | QSize s = size(); | ||
470 | int fw = frameWidth(); | ||
471 | s.setWidth(s.width() - fw); | ||
472 | s.setHeight(s.height() - fw); | ||
473 | |||
474 | /* min size is 200 x 260 */ | ||
475 | /* | ||
476 | if (s.width() < adjusted_board_width) | ||
477 | s.setWidth(adjusted_board_width); | ||
478 | |||
479 | if (s.height() < adjusted_board_height) | ||
480 | s.setHeight(adjusted_board_height); | ||
481 | */ | ||
482 | |||
483 | if ( current_highlight ) // non-first resize | ||
484 | writeConfig(); | ||
485 | |||
486 | setupBoardSize(s.width() - fw, s.height() - fw); | ||
487 | canvas()->resize(s.width() - fw, s.height() - fw); | ||
488 | Peg::buildImages(); // must be done BEFORE any pegs are made | ||
489 | |||
490 | QImage image = Resource::loadImage("mindbreaker/mindbreaker"); | ||
491 | |||
492 | /* copy from master image to functional images */ | ||
493 | int x = 0; | ||
494 | int y = 0; | ||
495 | panelImage = image.copy(x, y, panel_width, panel_height). | ||
496 | smoothScale( adjusted_panel_width, adjusted_panel_height); | ||
497 | |||
498 | y += panel_height; | ||
499 | y += panel_height; | ||
500 | |||
501 | titleImage = image.copy(x, y, title_width, title_height). | ||
502 | smoothScale( adjusted_title_width, adjusted_title_height); | ||
503 | show(); | ||
504 | |||
505 | delete current_highlight; | ||
506 | current_highlight = new Peg(canvas(), 8); | ||
507 | current_highlight->setPlaced(TRUE); | ||
508 | current_highlight->setX(0); | ||
509 | current_highlight->setY(adjusted_board_height - ((current_go + 1) * adjusted_panel_height)); | ||
510 | current_highlight->setZ(0); | ||
511 | current_highlight->show(); | ||
512 | |||
513 | /* set up the game */ | ||
514 | //readConfig(); | ||
515 | |||
516 | /* draw initial screen */ | ||
517 | //drawBackground(); | ||
518 | //canvas()->update(); | ||
519 | clear(); | ||
520 | |||
521 | readConfig(); | ||
522 | } | ||
523 | |||
380 | void MindBreakerBoard::placeGuessPeg(int pos, int pegId) | 524 | void MindBreakerBoard::placeGuessPeg(int pos, int pegId) |
381 | { | 525 | { |
382 | int x = first_peg_x_diff + (pos * peg_spacing); | 526 | int x = adjusted_first_peg_x_diff + (pos * adjusted_peg_spacing); |
383 | int y = board_height - ((current_go + 1) * panel_height) | 527 | int y = adjusted_board_height - ((current_go + 1) * adjusted_panel_height) |
384 | + first_peg_y_diff; | 528 | + adjusted_first_peg_y_diff; |
385 | 529 | ||
386 | Peg *peg = new Peg(canvas(), pegId, current_go, pos); | 530 | Peg *peg = new Peg(canvas(), pegId, current_go, pos); |
387 | peg->setPegPos(pos); | 531 | peg->setPegPos(pos); |
388 | peg->setPlaced(TRUE); | 532 | peg->setPlaced(TRUE); |
389 | peg->setX(x); | 533 | peg->setX(x); |
390 | peg->setY(y); | 534 | peg->setY(y); |
@@ -402,54 +546,54 @@ void MindBreakerBoard::drawBackground() | |||
402 | painter.fillRect(0, 0, canvas()->width(), canvas()->height(), QColor(0,0,0)); | 546 | painter.fillRect(0, 0, canvas()->width(), canvas()->height(), QColor(0,0,0)); |
403 | /* very first thing is to draw the bins, as everything else needs | 547 | /* very first thing is to draw the bins, as everything else needs |
404 | * to be drawn over them */ | 548 | * to be drawn over them */ |
405 | 549 | ||
406 | QPen pen(QColor(85, 45, 27), 4); | 550 | QPen pen(QColor(85, 45, 27), 4); |
407 | painter.setPen(pen); | 551 | painter.setPen(pen); |
408 | x_gap = canvas()->width() - (panel_width + (2 * bin_margin)); | 552 | x_gap = canvas()->width() - (adjusted_panel_width + (2 * adjusted_bin_margin)); |
409 | //x_gap += peg_size >> 1; | 553 | //x_gap += peg_size >> 1; |
410 | if (x_gap < 1) | 554 | if (x_gap < 1) |
411 | x_gap = 1; | 555 | x_gap = 1; |
412 | 556 | ||
413 | y_gap = board_height / 6; | 557 | y_gap = adjusted_board_height / 6; |
414 | y_gap -= (2 * bin_margin); | 558 | y_gap -= (2 * adjusted_bin_margin); |
415 | //y_gap += peg_size >> 1; | 559 | //y_gap += peg_size >> 1; |
416 | if (y_gap < 1) | 560 | if (y_gap < 1) |
417 | y_gap = 1; | 561 | y_gap = 1; |
418 | x = panel_width + bin_margin - (peg_size >> 1); | 562 | x = adjusted_panel_width + adjusted_bin_margin - (adjusted_peg_size >> 1); |
419 | y = bin_margin - (peg_size >> 1) + 2; | 563 | y = adjusted_bin_margin - (adjusted_peg_size >> 1) + 2; |
420 | 564 | ||
421 | for (i = 0; i < 6; i++) { | 565 | for (i = 0; i < 6; i++) { |
422 | for (j = 0; j < 10; j++) { | 566 | for (j = 0; j < 10; j++) { |
423 | int rx = x + (rand() % x_gap); | 567 | int rx = x + (rand() % x_gap); |
424 | int ry = y + (rand() % y_gap); | 568 | int ry = y + (rand() % y_gap); |
425 | painter.drawImage(rx,ry, Peg::imageForType(i)); | 569 | painter.drawImage(rx,ry, Peg::imageForType(i)); |
426 | } | 570 | } |
427 | y += board_height / 6; | 571 | y += adjusted_board_height / 6; |
428 | } | 572 | } |
429 | /* now draw the surrounding boxes */ | 573 | /* now draw the surrounding boxes */ |
430 | x_gap = canvas()->width() - panel_width; | 574 | x_gap = canvas()->width() - adjusted_panel_width; |
431 | if (x_gap < 1) x_gap = 1; | 575 | if (x_gap < 1) x_gap = 1; |
432 | y_gap = board_height / 6; | 576 | y_gap = adjusted_board_height / 6; |
433 | x = panel_width; | 577 | x = adjusted_panel_width; |
434 | y = 1; | 578 | y = 1; |
435 | 579 | ||
436 | for (i = 0; i < 6; i++) { | 580 | for (i = 0; i < 6; i++) { |
437 | painter.drawRect(x, y, x_gap, y_gap); | 581 | painter.drawRect(x, y, x_gap, y_gap); |
438 | y += y_gap; | 582 | y += y_gap; |
439 | } | 583 | } |
440 | 584 | ||
441 | x = 0; | 585 | x = 0; |
442 | y = 0; | 586 | y = 0; |
443 | 587 | ||
444 | painter.drawImage(x,y, titleImage); | 588 | painter.drawImage(x,y, titleImage); |
445 | y = title_height; | 589 | y = adjusted_title_height; |
446 | /* now nine gues panels */ | 590 | /* now nine gues panels */ |
447 | for (i = 0; i < 9; i ++) { | 591 | for (i = 0; i < 9; i ++) { |
448 | painter.drawImage(x, y, panelImage); | 592 | painter.drawImage(x, y, panelImage); |
449 | y += panel_height; | 593 | y += adjusted_panel_height; |
450 | } | 594 | } |
451 | 595 | ||
452 | painter.flush(); | 596 | painter.flush(); |
453 | canvas()->setBackgroundPixmap(background); | 597 | canvas()->setBackgroundPixmap(background); |
454 | } | 598 | } |
455 | 599 | ||
@@ -466,13 +610,13 @@ void MindBreakerBoard::checkGuess() | |||
466 | copy_guess[i] = current_guess[i]; | 610 | copy_guess[i] = current_guess[i]; |
467 | if (current_guess[i] == 6) | 611 | if (current_guess[i] == 6) |
468 | return; | 612 | return; |
469 | if (answer[i] == current_guess[i]) { | 613 | if (answer[i] == current_guess[i]) { |
470 | num_black++; | 614 | num_black++; |
471 | copy_answer[i] = 6; | 615 | copy_answer[i] = 6; |
472 | copy_guess[i] = 7; | 616 | copy_guess[i] = 7; |
473 | } | 617 | } |
474 | } | 618 | } |
475 | 619 | ||
476 | /* now sure that user has completed a 'guess' */ | 620 | /* now sure that user has completed a 'guess' */ |
477 | for (i = 0; i < 4; i++) { | 621 | for (i = 0; i < 4; i++) { |
478 | if (copy_guess[i] == 7) | 622 | if (copy_guess[i] == 7) |
@@ -483,48 +627,48 @@ void MindBreakerBoard::checkGuess() | |||
483 | num_white++; | 627 | num_white++; |
484 | break; | 628 | break; |
485 | } | 629 | } |
486 | } | 630 | } |
487 | } | 631 | } |
488 | 632 | ||
489 | int x = answerpegx; | 633 | int x = adjusted_answerpegx; |
490 | int y = (board_height - ((current_go + 1) * panel_height)) + answerpegy; | 634 | int y = (adjusted_board_height - ((current_go + 1) * adjusted_panel_height)) + adjusted_answerpegy; |
491 | 635 | ||
492 | if (num_black == 4) | 636 | if (num_black == 4) |
493 | game_over = TRUE; | 637 | game_over = TRUE; |
494 | 638 | ||
495 | while(num_black > 0) { | 639 | while(num_black > 0) { |
496 | Peg *p = new Peg(canvas(), 7); | 640 | Peg *p = new Peg(canvas(), 7); |
497 | p->setPlaced(TRUE); | 641 | p->setPlaced(TRUE); |
498 | p->setX(x); | 642 | p->setX(x); |
499 | p->setY(y); | 643 | p->setY(y); |
500 | p->setZ(1); | 644 | p->setZ(1); |
501 | p->show(); | 645 | p->show(); |
502 | num_black--; | 646 | num_black--; |
503 | 647 | ||
504 | if (x == answerpegx) | 648 | if (x == adjusted_answerpegx) |
505 | x = answerpegx + answerpeg_diff; | 649 | x = adjusted_answerpegx + adjusted_answerpeg_xdiff; |
506 | else { | 650 | else { |
507 | x = answerpegx; | 651 | x = adjusted_answerpegx; |
508 | y += answerpeg_diff; | 652 | y += adjusted_answerpeg_ydiff; |
509 | } | 653 | } |
510 | } | 654 | } |
511 | while(num_white > 0){ | 655 | while(num_white > 0){ |
512 | Peg *p = new Peg(canvas(), 6); | 656 | Peg *p = new Peg(canvas(), 6); |
513 | p->setPlaced(TRUE); | 657 | p->setPlaced(TRUE); |
514 | p->setX(x); | 658 | p->setX(x); |
515 | p->setY(y); | 659 | p->setY(y); |
516 | p->setZ(1); | 660 | p->setZ(1); |
517 | p->show(); | 661 | p->show(); |
518 | num_white--; | 662 | num_white--; |
519 | 663 | ||
520 | if (x == answerpegx) | 664 | if (x == adjusted_answerpegx) |
521 | x = answerpegx + answerpeg_diff; | 665 | x = adjusted_answerpegx + adjusted_answerpeg_xdiff; |
522 | else { | 666 | else { |
523 | x = answerpegx; | 667 | x = adjusted_answerpegx; |
524 | y += answerpeg_diff; | 668 | y += adjusted_answerpeg_ydiff; |
525 | } | 669 | } |
526 | } | 670 | } |
527 | /* move to next go */ | 671 | /* move to next go */ |
528 | for(i = 0; i < 4; i++) { | 672 | for(i = 0; i < 4; i++) { |
529 | past_guesses[4*current_go+i] = current_guess[i]; | 673 | past_guesses[4*current_go+i] = current_guess[i]; |
530 | current_guess[i] = 6; | 674 | current_guess[i] = 6; |
@@ -532,33 +676,33 @@ void MindBreakerBoard::checkGuess() | |||
532 | 676 | ||
533 | current_go++; | 677 | current_go++; |
534 | if((current_go > 8) || game_over) { | 678 | if((current_go > 8) || game_over) { |
535 | total_games++; | 679 | total_games++; |
536 | if(!game_over) | 680 | if(!game_over) |
537 | total_turns += 10; | 681 | total_turns += 10; |
538 | else | 682 | else |
539 | total_turns += current_go; | 683 | total_turns += current_go; |
540 | 684 | ||
541 | emit scoreChanged(total_turns, total_games); | 685 | emit scoreChanged(total_turns, total_games); |
542 | Peg *p = new Peg(canvas(), 9); | 686 | Peg *p = new Peg(canvas(), 9); |
543 | game_over = TRUE; | 687 | game_over = TRUE; |
544 | p->setPlaced(TRUE); | 688 | p->setPlaced(TRUE); |
545 | p->setX(0); | 689 | p->setX(0); |
546 | p->setY(0); | 690 | p->setY(0); |
547 | p->setZ(0); | 691 | p->setZ(0); |
548 | p->show(); | 692 | p->show(); |
549 | 693 | ||
550 | for (i = 0; i < 4; i++) { | 694 | for (i = 0; i < 4; i++) { |
551 | p = new Peg(canvas(), answer[i], -1); | 695 | p = new Peg(canvas(), answer[i], -1); |
552 | p->setX(first_peg_x_diff + (i * peg_spacing)); | 696 | p->setX(adjusted_first_peg_x_diff + (i * adjusted_peg_spacing)); |
553 | p->setY(5); | 697 | p->setY(adjusted_first_peg_y_diff); |
554 | p->setZ(3); | 698 | p->setZ(3); |
555 | p->show(); | 699 | p->show(); |
556 | } | 700 | } |
557 | } else { | 701 | } else { |
558 | current_highlight->setY(board_height - ((current_go + 1) * panel_height)); | 702 | current_highlight->setY(adjusted_board_height - ((current_go + 1) * adjusted_panel_height)); |
559 | } | 703 | } |
560 | canvas()->update(); | 704 | canvas()->update(); |
561 | } | 705 | } |
562 | 706 | ||
563 | void MindBreakerBoard::clear() | 707 | void MindBreakerBoard::clear() |
564 | { | 708 | { |
@@ -583,23 +727,23 @@ void MindBreakerBoard::clear() | |||
583 | if (*it == current_highlight) | 727 | if (*it == current_highlight) |
584 | continue; | 728 | continue; |
585 | if (*it) | 729 | if (*it) |
586 | delete *it; | 730 | delete *it; |
587 | } | 731 | } |
588 | 732 | ||
589 | current_highlight->setY(board_height - ((current_go + 1) * panel_height)); | 733 | current_highlight->setY(adjusted_board_height - ((current_go + 1) * adjusted_panel_height)); |
590 | checkScores(); | 734 | checkScores(); |
591 | drawBackground(); | 735 | drawBackground(); |
592 | canvas()->update(); | 736 | canvas()->update(); |
593 | } | 737 | } |
594 | 738 | ||
595 | void MindBreakerBoard::resetScore() | 739 | void MindBreakerBoard::resetScore() |
596 | { | 740 | { |
597 | /* are u sure */ | 741 | /* are u sure */ |
598 | 742 | ||
599 | if (QMessageBox::information(this, tr( "Reset Statistics" ), | 743 | if (QMessageBox::information(this, tr( "Reset Statistics" ), |
600 | tr( "Reset the win ratio?" ), | 744 | tr( "Reset the win ratio?" ), |
601 | tr( "OK" ), tr( "Cancel" ) ) == 0) { | 745 | tr( "OK" ), tr( "Cancel" ) ) == 0) { |
602 | total_turns = 0; | 746 | total_turns = 0; |
603 | total_games = 0; | 747 | total_games = 0; |
604 | Peg::eggLevel = 0; | 748 | Peg::eggLevel = 0; |
605 | drawBackground(); | 749 | drawBackground(); |
@@ -609,27 +753,34 @@ void MindBreakerBoard::resetScore() | |||
609 | } | 753 | } |
610 | 754 | ||
611 | /* EVENTS */ | 755 | /* EVENTS */ |
612 | 756 | ||
613 | void MindBreakerBoard::contentsMousePressEvent(QMouseEvent *e) | 757 | void MindBreakerBoard::contentsMousePressEvent(QMouseEvent *e) |
614 | { | 758 | { |
759 | if (game_over) { | ||
760 | null_press = TRUE; | ||
761 | null_point = e->pos(); | ||
762 | moving = 0; | ||
763 | return; | ||
764 | } | ||
765 | |||
615 | copy_press = FALSE; | 766 | copy_press = FALSE; |
616 | null_press = FALSE; | 767 | null_press = FALSE; |
617 | /* ok, first work out if it is one of the bins that | 768 | /* ok, first work out if it is one of the bins that |
618 | got clicked */ | 769 | got clicked */ |
619 | if (e->x() > panel_width) { | 770 | if (e->x() > adjusted_panel_width) { |
620 | /* its a bin, but which bin */ | 771 | /* its a bin, but which bin */ |
621 | if(e->y() > board_height) | 772 | int bin = (e->y() + 2) / (adjusted_board_height / 6); |
773 | if (bin > 5) | ||
622 | return; // missed everything | 774 | return; // missed everything |
623 | int bin = (e->y() + 2) / (board_height / 6); | ||
624 | 775 | ||
625 | /* make new peg... set it moving */ | 776 | /* make new peg... set it moving */ |
626 | moving_pos = e->pos(); | 777 | moving_pos = e->pos(); |
627 | moving = new Peg(canvas(), bin, current_go); | 778 | moving = new Peg(canvas(), bin, current_go); |
628 | moving->setX(e->x() - (peg_size >> 1)); | 779 | moving->setX(e->x() - (adjusted_peg_size >> 1)); |
629 | moving->setY(e->y() - (peg_size >> 1)); | 780 | moving->setY(e->y() - (adjusted_peg_size >> 1)); |
630 | moving->setZ(5); | 781 | moving->setZ(5); |
631 | moving->show(); | 782 | moving->show(); |
632 | canvas()->update(); | 783 | canvas()->update(); |
633 | return; | 784 | return; |
634 | } | 785 | } |
635 | 786 | ||
@@ -649,16 +800,16 @@ void MindBreakerBoard::contentsMousePressEvent(QMouseEvent *e) | |||
649 | if(item->pegGo() == -1) | 800 | if(item->pegGo() == -1) |
650 | return; | 801 | return; |
651 | if(item->pegGo() == current_go) { | 802 | if(item->pegGo() == current_go) { |
652 | copy_press = TRUE; | 803 | copy_press = TRUE; |
653 | copy_peg = item; | 804 | copy_peg = item; |
654 | } | 805 | } |
655 | moving = new Peg(canvas(), | 806 | moving = new Peg(canvas(), |
656 | item->type(), current_go); | 807 | item->type(), current_go); |
657 | moving->setX(e->x() - (peg_size >> 1)); | 808 | moving->setX(e->x() - (adjusted_peg_size >> 1)); |
658 | moving->setY(e->y() - (peg_size >> 1)); | 809 | moving->setY(e->y() - (adjusted_peg_size >> 1)); |
659 | moving->setZ(5); | 810 | moving->setZ(5); |
660 | moving->show(); | 811 | moving->show(); |
661 | moving_pos = QPoint(e->x(), e->y()); | 812 | moving_pos = QPoint(e->x(), e->y()); |
662 | canvas()->update(); | 813 | canvas()->update(); |
663 | return; | 814 | return; |
664 | } | 815 | } |
@@ -678,25 +829,25 @@ void MindBreakerBoard::contentsMouseMoveEvent(QMouseEvent* e) | |||
678 | if (moving ) { | 829 | if (moving ) { |
679 | moving->moveBy(e->pos().x() - moving_pos.x(), | 830 | moving->moveBy(e->pos().x() - moving_pos.x(), |
680 | e->pos().y() - moving_pos.y()); | 831 | e->pos().y() - moving_pos.y()); |
681 | moving_pos = e->pos(); | 832 | moving_pos = e->pos(); |
682 | canvas()->update(); | 833 | canvas()->update(); |
683 | return; | 834 | return; |
684 | } | 835 | } |
685 | } | 836 | } |
686 | 837 | ||
687 | void MindBreakerBoard::contentsMouseReleaseEvent(QMouseEvent* e) | 838 | void MindBreakerBoard::contentsMouseReleaseEvent(QMouseEvent* e) |
688 | { | 839 | { |
689 | /* time to put down the peg */ | 840 | /* time to put down the peg */ |
690 | if(moving) { | 841 | if(moving) { |
691 | if(copy_press) { | 842 | if(copy_press) { |
692 | /* check if collided with original. if so, delete both */ | 843 | /* check if collided with original. if so, delete both */ |
693 | copy_press = FALSE; | 844 | copy_press = FALSE; |
694 | QCanvasItemList l = canvas()->collisions(e->pos()); | 845 | QCanvasItemList l = canvas()->collisions(e->pos()); |
695 | for (QCanvasItemList::Iterator it=l.begin(); it !=l.end(); ++it) { | 846 | for (QCanvasItemList::Iterator it=l.begin(); it !=l.end(); ++it) { |
696 | if (*it == copy_peg) | 847 | if (*it == copy_peg) |
697 | copy_press = TRUE; | 848 | copy_press = TRUE; |
698 | } | 849 | } |
699 | if (copy_press) { | 850 | if (copy_press) { |
700 | current_guess[copy_peg->pegPos()] = 6; | 851 | current_guess[copy_peg->pegPos()] = 6; |
701 | delete copy_peg; | 852 | delete copy_peg; |
702 | delete moving; | 853 | delete moving; |
@@ -704,51 +855,51 @@ void MindBreakerBoard::contentsMouseReleaseEvent(QMouseEvent* e) | |||
704 | moving = 0; | 855 | moving = 0; |
705 | copy_peg = 0; | 856 | copy_peg = 0; |
706 | canvas()->update(); | 857 | canvas()->update(); |
707 | return; | 858 | return; |
708 | } | 859 | } |
709 | } | 860 | } |
710 | 861 | ||
711 | /* first work out if in y */ | 862 | /* first work out if in y */ |
712 | if (e->y() > (board_height - (current_go * panel_height))) { | 863 | if (e->y() > (adjusted_board_height - (current_go * adjusted_panel_height))) { |
713 | delete moving; | 864 | delete moving; |
714 | moving = 0; | 865 | moving = 0; |
715 | canvas()->update(); | 866 | canvas()->update(); |
716 | return; | 867 | return; |
717 | } | 868 | } |
718 | if (e->y() < (board_height - ((current_go + 1) * panel_height))) { | 869 | if (e->y() < (adjusted_board_height - ((current_go + 1) * adjusted_panel_height))) { |
719 | delete moving; | 870 | delete moving; |
720 | moving = 0; | 871 | moving = 0; |
721 | canvas()->update(); | 872 | canvas()->update(); |
722 | return; | 873 | return; |
723 | } | 874 | } |
724 | /* ok, a valid go, but which peg */ | 875 | /* ok, a valid go, but which peg */ |
725 | int x_bar = first_peg_x_diff - (peg_size >> 1); | 876 | int x_bar = adjusted_first_peg_x_diff - (adjusted_peg_size >> 1); |
726 | x_bar += peg_spacing; | 877 | x_bar += adjusted_peg_spacing; |
727 | int pos = 0; | 878 | int pos = 0; |
728 | if (e->x() > x_bar) | 879 | if (e->x() > x_bar) |
729 | pos = 1; | 880 | pos = 1; |
730 | x_bar += peg_spacing; | 881 | x_bar += adjusted_peg_spacing; |
731 | if (e->x() > x_bar) | 882 | if (e->x() > x_bar) |
732 | pos = 2; | 883 | pos = 2; |
733 | x_bar += peg_spacing; | 884 | x_bar += adjusted_peg_spacing; |
734 | if (e->x() > x_bar) | 885 | if (e->x() > x_bar) |
735 | pos = 3; | 886 | pos = 3; |
736 | x_bar += peg_spacing; | 887 | x_bar += adjusted_peg_spacing; |
737 | 888 | ||
738 | if (e->x() > x_bar) { | 889 | if (e->x() > x_bar) { |
739 | /* invalid x */ | 890 | /* invalid x */ |
740 | delete moving; | 891 | delete moving; |
741 | moving = 0; | 892 | moving = 0; |
742 | canvas()->update(); | 893 | canvas()->update(); |
743 | return; | 894 | return; |
744 | } | 895 | } |
745 | 896 | ||
746 | int x = first_peg_x_diff + (pos * peg_spacing); | 897 | int x = adjusted_first_peg_x_diff + (pos * adjusted_peg_spacing); |
747 | int y = board_height - ((current_go + 1) * panel_height) | 898 | int y = adjusted_board_height - ((current_go + 1) * adjusted_panel_height) |
748 | + first_peg_y_diff; | 899 | + adjusted_first_peg_y_diff; |
749 | moving->setPegPos(pos); | 900 | moving->setPegPos(pos); |
750 | moving->setX(x); | 901 | moving->setX(x); |
751 | moving->setY(y); | 902 | moving->setY(y); |
752 | moving->setZ(2); | 903 | moving->setZ(2); |
753 | 904 | ||
754 | /* remove all other pegs from this position */ | 905 | /* remove all other pegs from this position */ |
@@ -766,53 +917,41 @@ void MindBreakerBoard::contentsMouseReleaseEvent(QMouseEvent* e) | |||
766 | canvas()->update(); | 917 | canvas()->update(); |
767 | return; | 918 | return; |
768 | } | 919 | } |
769 | moving = 0; | 920 | moving = 0; |
770 | null_point -= e->pos(); | 921 | null_point -= e->pos(); |
771 | if(null_point.manhattanLength() < 6) { | 922 | if(null_point.manhattanLength() < 6) { |
772 | if (game_over) | 923 | if (game_over) |
773 | clear(); | 924 | clear(); |
774 | else | 925 | else |
775 | checkGuess(); | 926 | checkGuess(); |
776 | } | 927 | } |
777 | } | 928 | } |
778 | 929 | ||
779 | void MindBreakerBoard::resizeEvent(QResizeEvent *e) | 930 | void MindBreakerBoard::resizeEvent(QResizeEvent *e) |
780 | { | 931 | { |
781 | QSize s = e->size(); | 932 | QCanvasView::resizeEvent(e); |
782 | int fw = style().defaultFrameWidth(); | 933 | fixSize(); |
783 | s.setWidth(s.width() - fw); | ||
784 | s.setHeight(s.height() - fw); | ||
785 | |||
786 | /* min size is 200 x 260 */ | ||
787 | if (s.width() < board_width) | ||
788 | s.setWidth(board_width); | ||
789 | |||
790 | if (s.height() < board_height) | ||
791 | s.setHeight(board_height); | ||
792 | |||
793 | canvas()->resize(s.width() - fw, s.height() - fw); | ||
794 | drawBackground(); | ||
795 | } | 934 | } |
796 | 935 | ||
797 | 936 | ||
798 | /* Easter egg function... beat the clock */ | 937 | /* Easter egg function... beat the clock */ |
799 | void MindBreakerBoard::checkScores() | 938 | void MindBreakerBoard::checkScores() |
800 | { | 939 | { |
801 | double games = total_games; | 940 | double games = total_games; |
802 | double turns = total_turns; | 941 | double turns = total_turns; |
803 | double g = games / 10.0; | 942 | double g = games / 10.0; |
804 | Peg::eggLevel = 0; | 943 | Peg::eggLevel = 0; |
805 | 944 | ||
806 | double break_even = 5.0; | 945 | double break_even = 5.0; |
807 | if (g < 1.0) | 946 | if (g < 1.0) |
808 | return; | 947 | return; |
809 | double avg = turns / games; | 948 | double avg = turns / games; |
810 | g--; | 949 | g--; |
811 | while (break_even >= 0.0) { | 950 | while (break_even >= 0.0) { |
812 | if (avg >= (break_even + g)) | 951 | if (avg >= (break_even + g)) |
813 | return; | 952 | return; |
814 | // score a peg. | 953 | // score a peg. |
815 | break_even -= 1.0; | 954 | break_even -= 1.0; |
816 | Peg::eggLevel = int(5.0 - break_even); | 955 | Peg::eggLevel = int(5.0 - break_even); |
817 | } | 956 | } |
818 | } | 957 | } |
diff --git a/noncore/games/mindbreaker/mindbreaker.h b/noncore/games/mindbreaker/mindbreaker.h index fca649a..3132e80 100644 --- a/noncore/games/mindbreaker/mindbreaker.h +++ b/noncore/games/mindbreaker/mindbreaker.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -48,35 +48,47 @@ static const int answerpeg_diff = 9; | |||
48 | 48 | ||
49 | static const int board_height = (title_height + (panel_height * 9)); | 49 | static const int board_height = (title_height + (panel_height * 9)); |
50 | static const int board_width = (panel_width + (bin_margin * 2) + peg_size); | 50 | static const int board_width = (panel_width + (bin_margin * 2) + peg_size); |
51 | 51 | ||
52 | class Peg; | 52 | class Peg; |
53 | class QToolButton; | 53 | class QToolButton; |
54 | class QTimer; | ||
54 | 55 | ||
55 | class MindBreakerBoard : public QCanvasView // QWidget | 56 | class MindBreakerBoard : public QCanvasView // QWidget |
56 | { | 57 | { |
57 | Q_OBJECT | 58 | Q_OBJECT |
58 | public: | 59 | public: |
59 | MindBreakerBoard(QCanvas &c, QWidget *parent=0, const char *name=0, int wFlags=0 ); | 60 | MindBreakerBoard(QWidget *parent=0, const char *name=0, int wFlags=0 ); |
60 | ~MindBreakerBoard(); | 61 | ~MindBreakerBoard(); |
61 | 62 | ||
62 | void getScore(int *, int *); | 63 | void getScore(int *, int *); |
64 | |||
65 | void resizeEvent(QResizeEvent*); | ||
66 | void fixSize(); | ||
67 | |||
63 | signals: | 68 | signals: |
64 | void scoreChanged(int, int); | 69 | void scoreChanged(int, int); |
65 | 70 | ||
66 | public slots: | 71 | public slots: |
67 | void clear(); | 72 | void clear(); |
68 | void resetScore(); | 73 | void resetScore(); |
69 | 74 | ||
75 | private slots: | ||
76 | void doFixSize(); | ||
77 | |||
70 | protected: | 78 | protected: |
71 | void contentsMousePressEvent(QMouseEvent *); | 79 | void contentsMousePressEvent(QMouseEvent *); |
72 | void contentsMouseMoveEvent(QMouseEvent *); | 80 | void contentsMouseMoveEvent(QMouseEvent *); |
73 | void contentsMouseReleaseEvent(QMouseEvent *); | 81 | void contentsMouseReleaseEvent(QMouseEvent *); |
74 | void resizeEvent(QResizeEvent *); | ||
75 | 82 | ||
76 | private: | 83 | private: |
84 | QCanvas cnv; | ||
85 | |||
86 | void readConfig(); | ||
87 | void writeConfig(); | ||
88 | |||
77 | void drawBackground(); | 89 | void drawBackground(); |
78 | void checkGuess(); | 90 | void checkGuess(); |
79 | void checkScores(); | 91 | void checkScores(); |
80 | void placeGuessPeg(int pos, int pegId); | 92 | void placeGuessPeg(int pos, int pegId); |
81 | 93 | ||
82 | QImage panelImage; | 94 | QImage panelImage; |
@@ -97,23 +109,28 @@ private: | |||
97 | bool copy_press; | 109 | bool copy_press; |
98 | Peg *copy_peg; | 110 | Peg *copy_peg; |
99 | bool game_over; | 111 | bool game_over; |
100 | 112 | ||
101 | int total_turns; | 113 | int total_turns; |
102 | int total_games; | 114 | int total_games; |
115 | |||
116 | QTimer *widthTimer; | ||
103 | }; | 117 | }; |
104 | 118 | ||
105 | class MindBreaker : public QMainWindow // QWidget | 119 | class MindBreaker : public QMainWindow // QWidget |
106 | { | 120 | { |
107 | Q_OBJECT | 121 | Q_OBJECT |
108 | public: | 122 | public: |
109 | MindBreaker(QWidget *parent=0, const char *name=0, int wFlags=0 ); | 123 | MindBreaker(QWidget *parent=0, const char *name=0, int wFlags=0 ); |
110 | 124 | static QString appName() { return QString::fromLatin1("mindbreaker"); } | |
111 | public slots: | 125 | public slots: |
112 | void setScore(int, int); | 126 | void setScore(int, int); |
113 | 127 | ||
128 | protected: | ||
129 | void resizeEvent( QResizeEvent * ); | ||
130 | |||
114 | private: | 131 | private: |
115 | QCanvas canvas; | 132 | QCanvas canvas; |
116 | MindBreakerBoard *board; | 133 | MindBreakerBoard *board; |
117 | QToolButton *score; | 134 | QToolButton *score; |
118 | 135 | ||
119 | }; | 136 | }; |
diff --git a/noncore/games/mindbreaker/mindbreaker.pro b/noncore/games/mindbreaker/mindbreaker.pro index 4ca3b84..0a37fa7 100644 --- a/noncore/games/mindbreaker/mindbreaker.pro +++ b/noncore/games/mindbreaker/mindbreaker.pro | |||
@@ -1,12 +1,11 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG += qt warn_on release quick-app |
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = mindbreaker.h | 2 | HEADERS = mindbreaker.h |
5 | SOURCES = main.cpp \ | 3 | SOURCES = main.cpp \ |
6 | mindbreaker.cpp | 4 | mindbreaker.cpp |
7 | TARGET = mindbreaker | 5 | TARGET = mindbreaker |
8 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
9 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
10 | LIBS += -lqpe | 8 | LIBS += -lqpe |
11 | 9 | ||
10 | |||
12 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/mindbreaker/opie-mindbreaker.control b/noncore/games/mindbreaker/opie-mindbreaker.control index 7b5ead6..5b342da 100644 --- a/noncore/games/mindbreaker/opie-mindbreaker.control +++ b/noncore/games/mindbreaker/opie-mindbreaker.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-mindbreaker | 1 | Package: opie-mindbreaker |
2 | Files: bin/mindbreaker apps/Games/mindbreaker.desktop pics/mindbreaker | 2 | Files: plugins/application/libmindbreaker.so* bin/mindbreaker apps/Games/mindbreaker.desktop pics/mindbreaker |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 5 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Game: crack the coloured code | 8 | Description: Game: crack the coloured code |
diff --git a/noncore/games/minesweep/main.cpp b/noncore/games/minesweep/main.cpp index 83de9a3..bd70f7c 100644 --- a/noncore/games/minesweep/main.cpp +++ b/noncore/games/minesweep/main.cpp | |||
@@ -18,17 +18,10 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "minesweep.h" | 21 | #include "minesweep.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main( int argc, char** argv ) | 26 | OPIE_EXPORT_APP( OApplicationFactory<MineSweep> ) |
26 | { | ||
27 | QPEApplication a( argc, argv ); | ||
28 | 27 | ||
29 | MineSweep ms; | ||
30 | QPEApplication::setInputMethodHint( &ms, QPEApplication::AlwaysOff ); | ||
31 | a.showMainWidget( &ms ); | ||
32 | |||
33 | return a.exec(); | ||
34 | } | ||
diff --git a/noncore/games/minesweep/minefield.cpp b/noncore/games/minesweep/minefield.cpp index eca1a36..04cfb97 100644 --- a/noncore/games/minesweep/minefield.cpp +++ b/noncore/games/minesweep/minefield.cpp | |||
@@ -350,13 +350,13 @@ void MineField::setup( int level ) | |||
350 | case 3: | 350 | case 3: |
351 | numCols = 18; | 351 | numCols = 18; |
352 | numRows = 18; | 352 | numRows = 18; |
353 | minecount = 66 ; | 353 | minecount = 66 ; |
354 | break; | 354 | break; |
355 | } | 355 | } |
356 | mines = new (Mine*)[numRows*numCols]; | 356 | mines = new Mine*[numRows*numCols]; |
357 | for ( i = 0; i < numCols*numRows; i++ ) | 357 | for ( i = 0; i < numCols*numRows; i++ ) |
358 | mines[i] = new Mine( this ); | 358 | mines[i] = new Mine( this ); |
359 | 359 | ||
360 | 360 | ||
361 | nonminecount = numRows*numCols - minecount; | 361 | nonminecount = numRows*numCols - minecount; |
362 | mineguess = minecount; | 362 | mineguess = minecount; |
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp index 48644b3..7214a73 100644 --- a/noncore/games/minesweep/minesweep.cpp +++ b/noncore/games/minesweep/minesweep.cpp | |||
@@ -18,12 +18,13 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "minesweep.h" | 21 | #include "minesweep.h" |
22 | #include "minefield.h" | 22 | #include "minefield.h" |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | ||
24 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
25 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
26 | 27 | ||
27 | #include <qpe/qpetoolbar.h> | 28 | #include <qpe/qpetoolbar.h> |
28 | #include <qmenubar.h> | 29 | #include <qmenubar.h> |
29 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
@@ -152,28 +153,28 @@ static const char * dead_xpm[] = { | |||
152 | " ###### ", | 153 | " ###### ", |
153 | " "}; | 154 | " "}; |
154 | 155 | ||
155 | 156 | ||
156 | class ResultIndicator : private QLabel | 157 | class ResultIndicator : private QLabel |
157 | { | 158 | { |
158 | public: | 159 | public: |
159 | static void showResult( QWidget *ref, bool won ); | 160 | static void showResult( QWidget *ref, bool won ); |
160 | private: | 161 | private: |
161 | ResultIndicator( QWidget *parent, const char *name, WFlags f) | 162 | ResultIndicator( QWidget *parent, const char *name, WFlags f) |
162 | :QLabel( parent, name, f ) {} | 163 | :QLabel( parent, name, f ) {} |
163 | 164 | ||
164 | void timerEvent( QTimerEvent *); | 165 | void timerEvent( QTimerEvent *); |
165 | void center(); | 166 | void center(); |
166 | bool twoStage; | 167 | bool twoStage; |
167 | int timerId; | 168 | int timerId; |
168 | }; | 169 | }; |
169 | 170 | ||
170 | void ResultIndicator::showResult( QWidget *ref, bool won ) | 171 | void ResultIndicator::showResult( QWidget *ref, bool won ) |
171 | { | 172 | { |
172 | ResultIndicator *r = new ResultIndicator( ref, 0, WStyle_Customize | WStyle_Tool | WType_TopLevel ); | 173 | ResultIndicator *r = new ResultIndicator( ref, 0, WStyle_Customize | WStyle_Tool | WType_TopLevel ); |
173 | 174 | ||
174 | r->setAlignment( AlignCenter ); | 175 | r->setAlignment( AlignCenter ); |
175 | r->setFrameStyle( Sunken|StyledPanel ); | 176 | r->setFrameStyle( Sunken|StyledPanel ); |
176 | if ( won ) { | 177 | if ( won ) { |
177 | r->setText( MineSweep::tr("You won!") ); | 178 | r->setText( MineSweep::tr("You won!") ); |
178 | r->center(); | 179 | r->center(); |
179 | r->show(); | 180 | r->show(); |
@@ -192,19 +193,19 @@ void ResultIndicator::showResult( QWidget *ref, bool won ) | |||
192 | } | 193 | } |
193 | 194 | ||
194 | void ResultIndicator::center() | 195 | void ResultIndicator::center() |
195 | { | 196 | { |
196 | QWidget *w = parentWidget(); | 197 | QWidget *w = parentWidget(); |
197 | 198 | ||
198 | QPoint pp = w->mapToGlobal( QPoint(0,0) ); | 199 | QPoint pp = w->mapToGlobal( QPoint(0,0) ); |
199 | QSize s = sizeHint()*3; | 200 | QSize s = sizeHint()*3; |
200 | pp = QPoint( pp.x() + w->width()/2 - s.width()/2, | 201 | pp = QPoint( pp.x() + w->width()/2 - s.width()/2, |
201 | pp.y() + w->height()/ 2 - s.height()/2 ); | 202 | pp.y() + w->height()/ 2 - s.height()/2 ); |
202 | 203 | ||
203 | setGeometry( QRect(pp, s) ); | 204 | setGeometry( QRect(pp, s) ); |
204 | 205 | ||
205 | } | 206 | } |
206 | 207 | ||
207 | void ResultIndicator::timerEvent( QTimerEvent *te ) | 208 | void ResultIndicator::timerEvent( QTimerEvent *te ) |
208 | { | 209 | { |
209 | if ( te->timerId() != timerId ) | 210 | if ( te->timerId() != timerId ) |
210 | return; | 211 | return; |
@@ -225,23 +226,24 @@ public: | |||
225 | MineFrame( QWidget *parent, const char *name = 0 ) | 226 | MineFrame( QWidget *parent, const char *name = 0 ) |
226 | :QFrame( parent, name ) {} | 227 | :QFrame( parent, name ) {} |
227 | void setField( MineField *f ) { field = f; } | 228 | void setField( MineField *f ) { field = f; } |
228 | protected: | 229 | protected: |
229 | void resizeEvent( QResizeEvent *e ) { | 230 | void resizeEvent( QResizeEvent *e ) { |
230 | field->setAvailableRect( contentsRect()); | 231 | field->setAvailableRect( contentsRect()); |
231 | QFrame::resizeEvent(e); | 232 | QFrame::resizeEvent(e); |
232 | } | 233 | } |
233 | private: | 234 | private: |
234 | MineField *field; | 235 | MineField *field; |
235 | }; | 236 | }; |
236 | 237 | ||
237 | 238 | ||
238 | 239 | ||
239 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | 240 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) |
240 | : QMainWindow( parent, name, f ) | 241 | : QMainWindow( parent, name, f ) |
241 | { | 242 | { |
243 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | ||
242 | srand(::time(0)); | 244 | srand(::time(0)); |
243 | setCaption( tr("Mine Hunt") ); | 245 | setCaption( tr("Mine Hunt") ); |
244 | setIcon( Resource::loadPixmap( "minesweep_icon" ) ); | 246 | setIcon( Resource::loadPixmap( "minesweep_icon" ) ); |
245 | 247 | ||
246 | QToolBar *toolBar = new QToolBar( this ); | 248 | QToolBar *toolBar = new QToolBar( this ); |
247 | toolBar->setHorizontalStretchable( TRUE ); | 249 | toolBar->setHorizontalStretchable( TRUE ); |
@@ -251,37 +253,37 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | |||
251 | QPopupMenu *gameMenu = new QPopupMenu( this ); | 253 | QPopupMenu *gameMenu = new QPopupMenu( this ); |
252 | gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) ); | 254 | gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) ); |
253 | gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); | 255 | gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); |
254 | gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); | 256 | gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); |
255 | 257 | ||
256 | menuBar->insertItem( tr("Game"), gameMenu ); | 258 | menuBar->insertItem( tr("Game"), gameMenu ); |
257 | 259 | ||
258 | guessLCD = new QLCDNumber( toolBar ); | 260 | guessLCD = new QLCDNumber( toolBar ); |
259 | toolBar->setStretchableWidget( guessLCD ); | 261 | toolBar->setStretchableWidget( guessLCD ); |
260 | 262 | ||
261 | QPalette lcdPal( red ); | 263 | QPalette lcdPal( red ); |
262 | lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); | 264 | lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); |
263 | lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); | 265 | lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); |
264 | 266 | ||
265 | // guessLCD->setPalette( lcdPal ); | 267 | // guessLCD->setPalette( lcdPal ); |
266 | guessLCD->setSegmentStyle( QLCDNumber::Flat ); | 268 | guessLCD->setSegmentStyle( QLCDNumber::Flat ); |
267 | guessLCD->setFrameStyle( QFrame::NoFrame ); | 269 | guessLCD->setFrameStyle( QFrame::NoFrame ); |
268 | guessLCD->setNumDigits( 2 ); | 270 | guessLCD->setNumDigits( 2 ); |
269 | guessLCD->setBackgroundMode( PaletteButton ); | 271 | guessLCD->setBackgroundMode( PaletteButton ); |
270 | newGameButton = new QPushButton( toolBar ); | 272 | newGameButton = new QPushButton( toolBar ); |
271 | newGameButton->setPixmap( QPixmap( pix_new ) ); | 273 | newGameButton->setPixmap( QPixmap( pix_new ) ); |
272 | newGameButton->setFocusPolicy(QWidget::NoFocus); | 274 | newGameButton->setFocusPolicy(QWidget::NoFocus); |
273 | connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); | 275 | connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); |
274 | 276 | ||
275 | timeLCD = new QLCDNumber( toolBar ); | 277 | timeLCD = new QLCDNumber( toolBar ); |
276 | // timeLCD->setPalette( lcdPal ); | 278 | // timeLCD->setPalette( lcdPal ); |
277 | timeLCD->setSegmentStyle( QLCDNumber::Flat ); | 279 | timeLCD->setSegmentStyle( QLCDNumber::Flat ); |
278 | timeLCD->setFrameStyle( QFrame::NoFrame ); | 280 | timeLCD->setFrameStyle( QFrame::NoFrame ); |
279 | timeLCD->setNumDigits( 5 ); // "mm:ss" | 281 | timeLCD->setNumDigits( 5 ); // "mm:ss" |
280 | timeLCD->setBackgroundMode( PaletteButton ); | 282 | timeLCD->setBackgroundMode( PaletteButton ); |
281 | 283 | ||
282 | setToolBarsMovable ( FALSE ); | 284 | setToolBarsMovable ( FALSE ); |
283 | 285 | ||
284 | addToolBar( toolBar ); | 286 | addToolBar( toolBar ); |
285 | 287 | ||
286 | MineFrame *mainframe = new MineFrame( this ); | 288 | MineFrame *mainframe = new MineFrame( this ); |
287 | mainframe->setFrameShape( QFrame::Box ); | 289 | mainframe->setFrameShape( QFrame::Box ); |
@@ -293,13 +295,13 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | |||
293 | mainframe->setField( field ); | 295 | mainframe->setField( field ); |
294 | QFont fnt = field->font(); | 296 | QFont fnt = field->font(); |
295 | fnt.setBold( TRUE ); | 297 | fnt.setBold( TRUE ); |
296 | field->setFont( QFont( fnt ) ); | 298 | field->setFont( QFont( fnt ) ); |
297 | field->setFocus(); | 299 | field->setFocus(); |
298 | setCentralWidget( mainframe ); | 300 | setCentralWidget( mainframe ); |
299 | 301 | ||
300 | connect( field, SIGNAL( gameOver( bool ) ), this, SLOT( gameOver( bool ) ) ); | 302 | connect( field, SIGNAL( gameOver( bool ) ), this, SLOT( gameOver( bool ) ) ); |
301 | connect( field, SIGNAL( mineCount( int ) ), this, SLOT( setCounter( int ) ) ); | 303 | connect( field, SIGNAL( mineCount( int ) ), this, SLOT( setCounter( int ) ) ); |
302 | connect( field, SIGNAL( gameStarted()), this, SLOT( startPlaying() ) ); | 304 | connect( field, SIGNAL( gameStarted()), this, SLOT( startPlaying() ) ); |
303 | 305 | ||
304 | timer = new QTimer( this ); | 306 | timer = new QTimer( this ); |
305 | 307 | ||
diff --git a/noncore/games/minesweep/minesweep.h b/noncore/games/minesweep/minesweep.h index e860573..527dc9e 100644 --- a/noncore/games/minesweep/minesweep.h +++ b/noncore/games/minesweep/minesweep.h | |||
@@ -28,12 +28,13 @@ class QLCDNumber; | |||
28 | class QPushButton; | 28 | class QPushButton; |
29 | 29 | ||
30 | class MineSweep : public QMainWindow | 30 | class MineSweep : public QMainWindow |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | public: | 33 | public: |
34 | static QString appName() { return QString::fromLatin1("minesweep"); } | ||
34 | MineSweep( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); | 35 | MineSweep( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); |
35 | ~MineSweep(); | 36 | ~MineSweep(); |
36 | 37 | ||
37 | public slots: | 38 | public slots: |
38 | void gameOver( bool won ); | 39 | void gameOver( bool won ); |
39 | void newGame(); | 40 | void newGame(); |
diff --git a/noncore/games/minesweep/minesweep.pro b/noncore/games/minesweep/minesweep.pro index 8e4001e..9746651 100644 --- a/noncore/games/minesweep/minesweep.pro +++ b/noncore/games/minesweep/minesweep.pro | |||
@@ -1,15 +1,13 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | 2 | HEADERS = minefield.h \ |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | minesweep.h |
4 | HEADERS = minefield.h \ | 4 | SOURCES = main.cpp \ |
5 | minesweep.h | 5 | minefield.cpp \ |
6 | SOURCES = main.cpp \ | 6 | minesweep.cpp |
7 | minefield.cpp \ | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | minesweep.cpp | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | INCLUDEPATH += $(OPIEDIR)/include | 9 | LIBS += -lqpe |
10 | DEPENDPATH+= $(OPIEDIR)/include | 10 | INTERFACES= |
11 | LIBS += -lqpe | 11 | TARGET = minesweep |
12 | INTERFACES= | 12 | |
13 | TARGET = minesweep | 13 | include ( $(OPIEDIR)/include.pro ) |
14 | |||
15 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/games/minesweep/opie-minesweep.control b/noncore/games/minesweep/opie-minesweep.control index 32f0352..91343ea 100644 --- a/noncore/games/minesweep/opie-minesweep.control +++ b/noncore/games/minesweep/opie-minesweep.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-minesweep | 1 | Package: opie-minesweep |
2 | Files: bin/minesweep apps/Games/minesweep.desktop pics/minesweep | 2 | Files: plugins/application/libminesweep.so* bin/minesweep apps/Games/minesweep.desktop pics/minesweep |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 5 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Game: find the mines | 8 | Description: Game: find the mines |
diff --git a/noncore/games/parashoot/interface.cpp b/noncore/games/parashoot/interface.cpp index db98720..a40426d 100644 --- a/noncore/games/parashoot/interface.cpp +++ b/noncore/games/parashoot/interface.cpp | |||
@@ -19,26 +19,29 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "interface.h" | 21 | #include "interface.h" |
22 | #include "man.h" | 22 | #include "man.h" |
23 | 23 | ||
24 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
25 | #include <qpe/qpeapplication.h> | ||
25 | 26 | ||
26 | #include <qlabel.h> | 27 | #include <qlabel.h> |
27 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | #include <qstyle.h> | 30 | #include <qstyle.h> |
30 | #include <qpe/qpetoolbar.h> | 31 | #include <qpe/qpetoolbar.h> |
31 | #include <qtoolbutton.h> | 32 | #include <qtoolbutton.h> |
32 | 33 | ||
33 | ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : | 34 | ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : |
34 | QMainWindow(parent,name,f), | 35 | QMainWindow(parent,name,f), |
35 | canvas(232, 258), | 36 | canvas(232, 258), |
36 | fanfare("level_up"), | 37 | fanfare("level_up"), |
37 | score(0) | 38 | score(0) |
38 | { | 39 | { |
40 | QPEApplication::grabKeyboard(); | ||
41 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | ||
39 | canvas.setAdvancePeriod(80); | 42 | canvas.setAdvancePeriod(80); |
40 | QPixmap bg = Resource::loadPixmap("parashoot/sky"); | 43 | QPixmap bg = Resource::loadPixmap("parashoot/sky"); |
41 | canvas.setBackgroundPixmap(bg); | 44 | canvas.setBackgroundPixmap(bg); |
42 | 45 | ||
43 | pb = new QCanvasView(&canvas, this); | 46 | pb = new QCanvasView(&canvas, this); |
44 | pb->setFocus(); | 47 | pb->setFocus(); |
@@ -56,20 +59,20 @@ ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : | |||
56 | 59 | ||
57 | levelscore = new QLabel(toolbar); | 60 | levelscore = new QLabel(toolbar); |
58 | levelscore->setBackgroundMode( PaletteButton ); | 61 | levelscore->setBackgroundMode( PaletteButton ); |
59 | levelscore->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); | 62 | levelscore->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); |
60 | toolbar->setStretchableWidget( levelscore ); | 63 | toolbar->setStretchableWidget( levelscore ); |
61 | showScore(0,0); | 64 | showScore(0,0); |
62 | 65 | ||
63 | setCentralWidget(pb); | 66 | setCentralWidget(pb); |
64 | 67 | ||
65 | autoDropTimer = new QTimer(this); | 68 | autoDropTimer = new QTimer(this); |
66 | connect (autoDropTimer, SIGNAL(timeout()), this, SLOT(play()) ); | 69 | connect (autoDropTimer, SIGNAL(timeout()), this, SLOT(play()) ); |
67 | 70 | ||
68 | pauseTimer = new QTimer(this); | 71 | pauseTimer = new QTimer(this); |
69 | connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); | 72 | connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); |
70 | 73 | ||
71 | setFocusPolicy(StrongFocus); | 74 | setFocusPolicy(StrongFocus); |
72 | 75 | ||
73 | newGame(); | 76 | newGame(); |
74 | } | 77 | } |
75 | 78 | ||
@@ -88,13 +91,13 @@ void ParaShoot::showScore( int score, int level ) | |||
88 | } | 91 | } |
89 | 92 | ||
90 | 93 | ||
91 | void ParaShoot::newGame() | 94 | void ParaShoot::newGame() |
92 | { | 95 | { |
93 | clear(); | 96 | clear(); |
94 | if (pauseTimer->isActive()) | 97 | if (pauseTimer->isActive()) |
95 | pauseTimer->stop(); | 98 | pauseTimer->stop(); |
96 | clear(); | 99 | clear(); |
97 | Man::setManCount(0); | 100 | Man::setManCount(0); |
98 | score = 0; | 101 | score = 0; |
99 | Bullet::setShotCount(0); | 102 | Bullet::setShotCount(0); |
100 | Bullet::setNobullets(0); | 103 | Bullet::setNobullets(0); |
@@ -116,38 +119,38 @@ void ParaShoot::newGame() | |||
116 | void ParaShoot::clear() | 119 | void ParaShoot::clear() |
117 | { | 120 | { |
118 | autoDropTimer->stop(); | 121 | autoDropTimer->stop(); |
119 | // QCanvasItem* item; | 122 | // QCanvasItem* item; |
120 | QCanvasItemList l = canvas.allItems(); | 123 | QCanvasItemList l = canvas.allItems(); |
121 | for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { | 124 | for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { |
122 | delete *it; | 125 | delete *it; |
123 | } | 126 | } |
124 | } | 127 | } |
125 | 128 | ||
126 | void ParaShoot::gameOver() | 129 | void ParaShoot::gameOver() |
127 | { | 130 | { |
128 | QCanvasItem* item; | 131 | QCanvasItem* item; |
129 | QCanvasItemList l = canvas.allItems(); | 132 | QCanvasItemList l = canvas.allItems(); |
130 | for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { | 133 | for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { |
131 | item = *it; | 134 | item = *it; |
132 | if ((item->rtti()==1500) || (item->rtti()==1600) || item->rtti()==1900) | 135 | if ((item->rtti()==1500) || (item->rtti()==1600) || item->rtti()==1900) |
133 | item->setAnimated(false); | 136 | item->setAnimated(false); |
134 | } | 137 | } |
135 | autoDropTimer->stop(); | 138 | autoDropTimer->stop(); |
136 | Helicopter::silenceAll(); | 139 | Helicopter::silenceAll(); |
137 | 140 | ||
138 | int shots = Bullet::getShotCount(); | 141 | int shots = Bullet::getShotCount(); |
139 | 142 | ||
140 | int shotsFired = cannon->shotsFired(); | 143 | int shotsFired = cannon->shotsFired(); |
141 | if ( shotsFired == 0 ) | 144 | if ( shotsFired == 0 ) |
142 | shotsFired = 1; | 145 | shotsFired = 1; |
143 | QCanvasText* gameover = new QCanvasText( | 146 | QCanvasText* gameover = new QCanvasText( |
144 | tr( " GAME OVER!\n" | 147 | tr( " GAME OVER!\n" |
145 | " Your Score: %1\n" | 148 | " Your Score: %1\n" |
146 | " Parachuters Killed: %2\n" | 149 | " Parachuters Killed: %2\n" |
147 | " Accuracy: %3% " ).arg(score).arg(shots).arg(shots * 100 / shotsFired ), | 150 | " Accuracy: %3% " ).arg(score).arg(shots).arg(shots * 100 / shotsFired ), |
148 | &canvas); | 151 | &canvas); |
149 | gameover->setColor(red); | 152 | gameover->setColor(red); |
150 | gameover->setFont( QFont("times", 18, QFont::Bold) ); | 153 | gameover->setFont( QFont("times", 18, QFont::Bold) ); |
151 | gameover->move(canvas.width()/2 -110, canvas.height()/2 -50); | 154 | gameover->move(canvas.width()/2 -110, canvas.height()/2 -50); |
152 | gameover->setZ(500); | 155 | gameover->setZ(500); |
153 | gameover->show(); | 156 | gameover->show(); |
@@ -160,13 +163,13 @@ void ParaShoot::wait() | |||
160 | { | 163 | { |
161 | waitover = true; | 164 | waitover = true; |
162 | pauseTimer->stop(); | 165 | pauseTimer->stop(); |
163 | } | 166 | } |
164 | 167 | ||
165 | void ParaShoot::play() | 168 | void ParaShoot::play() |
166 | { | 169 | { |
167 | if (Man::getManCount() < nomen ) { | 170 | if (Man::getManCount() < nomen ) { |
168 | new Man(&canvas); | 171 | new Man(&canvas); |
169 | } | 172 | } |
170 | if (Base::baseDestroyed()) { | 173 | if (Base::baseDestroyed()) { |
171 | gameOver(); | 174 | gameOver(); |
172 | return; | 175 | return; |
@@ -174,33 +177,33 @@ void ParaShoot::play() | |||
174 | } | 177 | } |
175 | 178 | ||
176 | void ParaShoot::increaseScore(int x) | 179 | void ParaShoot::increaseScore(int x) |
177 | { | 180 | { |
178 | score += x; | 181 | score += x; |
179 | if ( score / 150 != (score-x) / 150 ) | 182 | if ( score / 150 != (score-x) / 150 ) |
180 | levelUp(); | 183 | levelUp(); |
181 | showScore(level,score); | 184 | showScore(level,score); |
182 | } | 185 | } |
183 | 186 | ||
184 | void ParaShoot::levelUp() | 187 | void ParaShoot::levelUp() |
185 | { | 188 | { |
186 | level++; | 189 | level++; |
187 | int stage = level % 3; | 190 | int stage = level % 3; |
188 | switch(stage) { | 191 | switch(stage) { |
189 | case 0: | 192 | case 0: |
190 | nomen++; | 193 | nomen++; |
191 | Bullet::setLimit(nomen); | 194 | Bullet::setLimit(nomen); |
192 | fanfare.play(); | 195 | fanfare.play(); |
193 | break; | 196 | break; |
194 | case 1: | 197 | case 1: |
195 | new Helicopter(&canvas); | 198 | new Helicopter(&canvas); |
196 | break; | 199 | break; |
197 | case 2: | 200 | case 2: |
198 | moveFaster(); | 201 | moveFaster(); |
199 | fanfare.play(); | 202 | fanfare.play(); |
200 | break; | 203 | break; |
201 | default: return; | 204 | default: return; |
202 | } | 205 | } |
203 | } | 206 | } |
204 | 207 | ||
205 | void ParaShoot::moveFaster() | 208 | void ParaShoot::moveFaster() |
206 | { | 209 | { |
@@ -213,13 +216,13 @@ void ParaShoot::moveFaster() | |||
213 | 216 | ||
214 | void ParaShoot::keyPressEvent(QKeyEvent* event) | 217 | void ParaShoot::keyPressEvent(QKeyEvent* event) |
215 | { | 218 | { |
216 | if (gamestopped) { | 219 | if (gamestopped) { |
217 | if (waitover) | 220 | if (waitover) |
218 | newGame(); | 221 | newGame(); |
219 | else | 222 | else |
220 | return; | 223 | return; |
221 | } else { | 224 | } else { |
222 | switch(event->key()) { | 225 | switch(event->key()) { |
223 | case Key_Up: | 226 | case Key_Up: |
224 | case Key_F1: | 227 | case Key_F1: |
225 | case Key_F9: | 228 | case Key_F9: |
diff --git a/noncore/games/parashoot/interface.h b/noncore/games/parashoot/interface.h index 3f36d0b..5abbe0b 100644 --- a/noncore/games/parashoot/interface.h +++ b/noncore/games/parashoot/interface.h | |||
@@ -35,12 +35,13 @@ class Helicopter; | |||
35 | // left, right, up, down }; | 35 | // left, right, up, down }; |
36 | 36 | ||
37 | class ParaShoot : public QMainWindow { | 37 | class ParaShoot : public QMainWindow { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | 39 | ||
40 | public: | 40 | public: |
41 | static QString appName() { return QString::fromLatin1("parashoot"); } | ||
41 | ParaShoot(QWidget* parent=0, const char* name=0, WFlags f=0); | 42 | ParaShoot(QWidget* parent=0, const char* name=0, WFlags f=0); |
42 | 43 | ||
43 | void clear(); | 44 | void clear(); |
44 | void gameOver(); | 45 | void gameOver(); |
45 | int mancount; | 46 | int mancount; |
46 | void levelUp(); | 47 | void levelUp(); |
diff --git a/noncore/games/parashoot/main.cpp b/noncore/games/parashoot/main.cpp index 60eea18..ee36d26 100644 --- a/noncore/games/parashoot/main.cpp +++ b/noncore/games/parashoot/main.cpp | |||
@@ -18,19 +18,10 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "interface.h" | 21 | #include "interface.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main(int argc, char **argv) | 26 | OPIE_EXPORT_APP( OApplicationFactory<ParaShoot> ) |
26 | { | ||
27 | QPEApplication app(argc,argv); | ||
28 | 27 | ||
29 | QPEApplication::grabKeyboard(); | ||
30 | |||
31 | ParaShoot m; | ||
32 | QPEApplication::setInputMethodHint( &m, QPEApplication::AlwaysOff ); | ||
33 | app.showMainWidget(&m); | ||
34 | |||
35 | return app.exec(); | ||
36 | } | ||
diff --git a/noncore/games/parashoot/opie-parashoot.control b/noncore/games/parashoot/opie-parashoot.control index 758d24d..139dd3c 100644 --- a/noncore/games/parashoot/opie-parashoot.control +++ b/noncore/games/parashoot/opie-parashoot.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-parashoot | 1 | Package: opie-parashoot |
2 | Files: bin/parashoot apps/Games/parashoot.desktop pics/parashoot | 2 | Files: plugins/application/libparashoot.so* bin/parashoot apps/Games/parashoot.desktop pics/parashoot |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 5 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Game: shoot the parachutists | 8 | Description: Game: shoot the parachutists |
diff --git a/noncore/games/parashoot/parashoot.pro b/noncore/games/parashoot/parashoot.pro index c2746f9..f5d103a 100644 --- a/noncore/games/parashoot/parashoot.pro +++ b/noncore/games/parashoot/parashoot.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG += qt warn_on release quick-app |
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = interface.h man.h cannon.h base.h bullet.h helicopter.h | 2 | HEADERS = interface.h man.h cannon.h base.h bullet.h helicopter.h |
5 | SOURCES = main.cpp interface.cpp man.cpp cannon.cpp base.cpp bullet.cpp helicopter.cpp | 3 | SOURCES = main.cpp interface.cpp man.cpp cannon.cpp base.cpp bullet.cpp helicopter.cpp |
6 | TARGET = parashoot | 4 | TARGET = parashoot |
7 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 7 | LIBS += -lqpe |
10 | 8 | ||
9 | |||
10 | |||
11 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/qasteroids/main.cpp b/noncore/games/qasteroids/main.cpp index 7d1682c..c762990 100644 --- a/noncore/games/qasteroids/main.cpp +++ b/noncore/games/qasteroids/main.cpp | |||
@@ -18,19 +18,10 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "toplevel.h" | 21 | #include "toplevel.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main( int argc, char *argv[] ) | ||
26 | { | ||
27 | QPEApplication app( argc, argv ); | ||
28 | |||
29 | QPEApplication::grabKeyboard(); | ||
30 | |||
31 | KAstTopLevel *mainWidget = new KAstTopLevel(); | ||
32 | app.showMainWidget( mainWidget ); | ||
33 | |||
34 | app.exec(); | ||
35 | } | ||
36 | 26 | ||
27 | OPIE_EXPORT_APP( OApplicationFactory<KAstTopLevel> ) | ||
diff --git a/noncore/games/qasteroids/opie-qasteroids.control b/noncore/games/qasteroids/opie-qasteroids.control index 25a49b4..8764578 100644 --- a/noncore/games/qasteroids/opie-qasteroids.control +++ b/noncore/games/qasteroids/opie-qasteroids.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-qasteroids | 1 | Package: opie-qasteroids |
2 | Files: bin/qasteroids apps/Games/qasteroids.desktop pics/qasteroids/* | 2 | Files: plugins/application/libqasteroids.so* bin/qasteroids apps/Games/qasteroids.desktop pics/qasteroids/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Jones <mjones@trolltech.com> | 5 | Maintainer: Martin Jones <mjones@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Game: shoot the asteroids | 8 | Description: Game: shoot the asteroids |
diff --git a/noncore/games/qasteroids/qasteroids.pro b/noncore/games/qasteroids/qasteroids.pro index 1a3a8d5..aafc701 100644 --- a/noncore/games/qasteroids/qasteroids.pro +++ b/noncore/games/qasteroids/qasteroids.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG += qt warn_on release quick-app |
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = ledmeter.h sprites.h toplevel.h view.h | 2 | HEADERS = ledmeter.h sprites.h toplevel.h view.h |
5 | SOURCES = ledmeter.cpp toplevel.cpp view.cpp main.cpp | 3 | SOURCES = ledmeter.cpp toplevel.cpp view.cpp main.cpp |
6 | TARGET = qasteroids | 4 | TARGET = qasteroids |
7 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 7 | LIBS += -lqpe |
10 | 8 | ||
9 | |||
10 | |||
11 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/qasteroids/toplevel.cpp b/noncore/games/qasteroids/toplevel.cpp index 71daf60..c4fea89 100644 --- a/noncore/games/qasteroids/toplevel.cpp +++ b/noncore/games/qasteroids/toplevel.cpp | |||
@@ -66,37 +66,40 @@ SLevel levels[MAX_LEVELS] = | |||
66 | { 5, 0.7 }, | 66 | { 5, 0.7 }, |
67 | { 5, 0.8 }, | 67 | { 5, 0.8 }, |
68 | { 5, 0.9 }, | 68 | { 5, 0.9 }, |
69 | { 5, 1.0 } | 69 | { 5, 1.0 } |
70 | }; | 70 | }; |
71 | 71 | ||
72 | const char *soundEvents[] = | 72 | const char *soundEvents[] = |
73 | { | 73 | { |
74 | "ShipDestroyed", | 74 | "ShipDestroyed", |
75 | "RockDestroyed", | 75 | "RockDestroyed", |
76 | 0 | 76 | 0 |
77 | }; | 77 | }; |
78 | 78 | ||
79 | const char *soundDefaults[] = | 79 | const char *soundDefaults[] = |
80 | { | 80 | { |
81 | "Explosion.wav", | 81 | "Explosion.wav", |
82 | "ploop.wav", | 82 | "ploop.wav", |
83 | 0 | 83 | 0 |
84 | }; | 84 | }; |
85 | 85 | ||
86 | 86 | ||
87 | KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name ) | 87 | KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name, WFlags fl ) |
88 | : QMainWindow( parent, _name ) | 88 | : QMainWindow( parent, _name, fl ) |
89 | { | 89 | { |
90 | setCaption( tr("Asteroids") ); | 90 | setCaption( tr("Asteroids") ); |
91 | |||
92 | QPEApplication::grabKeyboard(); | ||
93 | |||
91 | QWidget *border = new QWidget( this ); | 94 | QWidget *border = new QWidget( this ); |
92 | border->setBackgroundColor( black ); | 95 | border->setBackgroundColor( black ); |
93 | setCentralWidget( border ); | 96 | setCentralWidget( border ); |
94 | 97 | ||
95 | QVBoxLayout *borderLayout = new QVBoxLayout( border ); | 98 | QVBoxLayout *borderLayout = new QVBoxLayout( border ); |
96 | 99 | ||
97 | QWidget *mainWin = new QWidget( border ); | 100 | QWidget *mainWin = new QWidget( border ); |
98 | borderLayout->addWidget( mainWin, 2, AlignHCenter ); | 101 | borderLayout->addWidget( mainWin, 2, AlignHCenter ); |
99 | 102 | ||
100 | view = new KAsteroidsView( mainWin ); | 103 | view = new KAsteroidsView( mainWin ); |
101 | connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) ); | 104 | connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) ); |
102 | connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) ); | 105 | connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) ); |
@@ -254,13 +257,13 @@ KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name ) | |||
254 | actions.insert( Qt::Key_Enter, Shoot ); | 257 | actions.insert( Qt::Key_Enter, Shoot ); |
255 | actions.insert( Qt::Key_Z, Teleport ); | 258 | actions.insert( Qt::Key_Z, Teleport ); |
256 | actions.insert( Qt::Key_Down, Brake ); | 259 | actions.insert( Qt::Key_Down, Brake ); |
257 | actions.insert( Qt::Key_P, Pause ); | 260 | actions.insert( Qt::Key_P, Pause ); |
258 | 261 | ||
259 | 262 | ||
260 | struct utsname name; /* check for embedix kernel running on the zaurus, if | 263 | struct utsname name; /* check for embedix kernel running on the zaurus, if |
261 | lineo change string, this break | 264 | lineo change string, this break |
262 | */ | 265 | */ |
263 | if (uname(&name) != -1) { | 266 | if (uname(&name) != -1) { |
264 | QString release=name.release; | 267 | QString release=name.release; |
265 | if(release.find("embedix",0,TRUE) !=-1) { | 268 | if(release.find("embedix",0,TRUE) !=-1) { |
266 | actions.insert( Key_F12, Launch ); | 269 | actions.insert( Key_F12, Launch ); |
@@ -392,13 +395,13 @@ void KAstTopLevel::keyReleaseEvent( QKeyEvent *event ) | |||
392 | else | 395 | else |
393 | { | 396 | { |
394 | event->ignore(); | 397 | event->ignore(); |
395 | return; | 398 | return; |
396 | } | 399 | } |
397 | break; | 400 | break; |
398 | 401 | ||
399 | case NewGame: | 402 | case NewGame: |
400 | slotNewGame(); | 403 | slotNewGame(); |
401 | break; | 404 | break; |
402 | /* | 405 | /* |
403 | case Pause: | 406 | case Pause: |
404 | { | 407 | { |
diff --git a/noncore/games/qasteroids/toplevel.h b/noncore/games/qasteroids/toplevel.h index 4e1ac9c..0270763 100644 --- a/noncore/games/qasteroids/toplevel.h +++ b/noncore/games/qasteroids/toplevel.h | |||
@@ -36,14 +36,16 @@ class KALedMeter; | |||
36 | class QLCDNumber; | 36 | class QLCDNumber; |
37 | 37 | ||
38 | class KAstTopLevel : public QMainWindow | 38 | class KAstTopLevel : public QMainWindow |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | KAstTopLevel( QWidget *parent=0, const char *name=0 ); | 42 | KAstTopLevel( QWidget *parent=0, const char *name=0, WFlags fl = 0 ); |
43 | virtual ~KAstTopLevel(); | 43 | virtual ~KAstTopLevel(); |
44 | static QString appName() { return QString::fromLatin1("qasteroids"); } | ||
45 | |||
44 | 46 | ||
45 | private: | 47 | private: |
46 | void playSound( const char *snd ); | 48 | void playSound( const char *snd ); |
47 | void readSoundMapping(); | 49 | void readSoundMapping(); |
48 | void doStats(); | 50 | void doStats(); |
49 | 51 | ||
diff --git a/noncore/games/snake/interface.cpp b/noncore/games/snake/interface.cpp index f1227cb..2c60693 100644 --- a/noncore/games/snake/interface.cpp +++ b/noncore/games/snake/interface.cpp | |||
@@ -18,24 +18,26 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "interface.h" | 21 | #include "interface.h" |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/qpeapplication.h> | ||
24 | 25 | ||
25 | #include <qpe/qpetoolbar.h> | 26 | #include <qpe/qpetoolbar.h> |
26 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
27 | #include <qstyle.h> | 28 | #include <qstyle.h> |
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | #include <qmessagebox.h> | 30 | #include <qmessagebox.h> |
30 | 31 | ||
31 | SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : | 32 | SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : |
32 | QMainWindow(parent,name,f), | 33 | QMainWindow(parent,name,f), |
33 | canvas(232, 258) | 34 | canvas(232, 258) |
34 | { | 35 | { |
35 | setCaption( tr("Snake") ); | 36 | setCaption( tr("Snake") ); |
37 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | ||
36 | QPixmap bg = Resource::loadPixmap("snake/grass"); | 38 | QPixmap bg = Resource::loadPixmap("snake/grass"); |
37 | canvas.setBackgroundPixmap(bg); | 39 | canvas.setBackgroundPixmap(bg); |
38 | canvas.setUpdatePeriod(100); | 40 | canvas.setUpdatePeriod(100); |
39 | snake = 0; | 41 | snake = 0; |
40 | 42 | ||
41 | cv = new QCanvasView(&canvas, this); | 43 | cv = new QCanvasView(&canvas, this); |
diff --git a/noncore/games/snake/interface.h b/noncore/games/snake/interface.h index 454d4ee..fa1dee4 100644 --- a/noncore/games/snake/interface.h +++ b/noncore/games/snake/interface.h | |||
@@ -15,12 +15,13 @@ | |||
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qmainwindow.h> | 20 | #include <qmainwindow.h> |
21 | #include <qpe/qpeapplication.h> | ||
21 | #include <qcanvas.h> | 22 | #include <qcanvas.h> |
22 | #include <qlabel.h> | 23 | #include <qlabel.h> |
23 | 24 | ||
24 | #include "snake.h" | 25 | #include "snake.h" |
25 | #include "target.h" | 26 | #include "target.h" |
26 | #include "obstacle.h" | 27 | #include "obstacle.h" |
@@ -30,16 +31,18 @@ | |||
30 | class SnakeGame : public QMainWindow { | 31 | class SnakeGame : public QMainWindow { |
31 | Q_OBJECT | 32 | Q_OBJECT |
32 | 33 | ||
33 | public: | 34 | public: |
34 | SnakeGame(QWidget* parent=0, const char* name=0, WFlags f=0); | 35 | SnakeGame(QWidget* parent=0, const char* name=0, WFlags f=0); |
35 | ~SnakeGame(); | 36 | ~SnakeGame(); |
36 | 37 | ||
37 | void clear(); | 38 | void clear(); |
38 | void createTargets(); | 39 | void createTargets(); |
39 | 40 | ||
41 | static QString appName() { return QString::fromLatin1("snake"); } | ||
42 | |||
40 | protected: | 43 | protected: |
41 | virtual void keyPressEvent(QKeyEvent*); | 44 | virtual void keyPressEvent(QKeyEvent*); |
42 | virtual void resizeEvent(QResizeEvent *e); | 45 | virtual void resizeEvent(QResizeEvent *e); |
43 | 46 | ||
44 | signals: | 47 | signals: |
45 | void moveFaster(); | 48 | void moveFaster(); |
diff --git a/noncore/games/snake/main.cpp b/noncore/games/snake/main.cpp index 90a93b7..77a2769 100644 --- a/noncore/games/snake/main.cpp +++ b/noncore/games/snake/main.cpp | |||
@@ -14,22 +14,16 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "interface.h" | 21 | #include "interface.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
25 | |||
24 | 26 | ||
27 | OPIE_EXPORT_APP( OApplicationFactory<SnakeGame> ) | ||
25 | 28 | ||
26 | int main(int argc, char **argv) | ||
27 | { | ||
28 | QPEApplication app(argc,argv); | ||
29 | 29 | ||
30 | SnakeGame* m = new SnakeGame; | ||
31 | QPEApplication::setInputMethodHint( m, QPEApplication::AlwaysOff ); | ||
32 | app.showMainWidget(m); | ||
33 | |||
34 | return app.exec(); | ||
35 | } | ||
diff --git a/noncore/games/snake/opie-snake.control b/noncore/games/snake/opie-snake.control index ef4fc61..f110acd 100644 --- a/noncore/games/snake/opie-snake.control +++ b/noncore/games/snake/opie-snake.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-snake | 1 | Package: opie-snake |
2 | Files: bin/snake apps/Games/snake.desktop pics/snake | 2 | Files: plugins/application/libsnake.so* bin/snake apps/Games/snake.desktop pics/snake |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 5 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Game: control the snake | 8 | Description: Game: control the snake |
diff --git a/noncore/games/snake/snake.pro b/noncore/games/snake/snake.pro index 3da8631..2b7444c 100644 --- a/noncore/games/snake/snake.pro +++ b/noncore/games/snake/snake.pro | |||
@@ -1,11 +1,10 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG += qt warn_on release quick-app |
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = snake.h target.h obstacle.h interface.h codes.h | 2 | HEADERS = snake.h target.h obstacle.h interface.h codes.h |
5 | SOURCES = snake.cpp target.cpp obstacle.cpp interface.cpp main.cpp | 3 | SOURCES = snake.cpp target.cpp obstacle.cpp interface.cpp main.cpp |
6 | TARGET = snake | 4 | TARGET = snake |
7 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 7 | LIBS += -lqpe |
10 | 8 | ||
9 | |||
11 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp index dec5591..c12344a 100644 --- a/noncore/games/solitaire/canvascardwindow.cpp +++ b/noncore/games/solitaire/canvascardwindow.cpp | |||
@@ -34,21 +34,22 @@ | |||
34 | 34 | ||
35 | CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : | 35 | CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : |
36 | QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0), | 36 | QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0), |
37 | cardGame(NULL) | 37 | cardGame(NULL) |
38 | { | 38 | { |
39 | setIcon( Resource::loadPixmap( "cards" ) ); | 39 | setIcon( Resource::loadPixmap( "cards" ) ); |
40 | setCaption(tr("Patience")); | ||
40 | 41 | ||
41 | // Create Playing Area for Games | 42 | // Create Playing Area for Games |
42 | if ( QPixmap::defaultDepth() < 12 ) { | 43 | if ( QPixmap::defaultDepth() < 12 ) { |
43 | // canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); | 44 | // canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); |
44 | // canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); | 45 | // canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); |
45 | canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); | 46 | canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); |
46 | } else { | 47 | } else { |
47 | QPixmap bg; | 48 | QPixmap bg; |
48 | bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither ); | 49 | bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither ); |
49 | canvas.setBackgroundPixmap(bg); | 50 | canvas.setBackgroundPixmap(bg); |
50 | } | 51 | } |
51 | 52 | ||
52 | #if defined( QT_QWS_CASSIOPEIA ) | 53 | #if defined( QT_QWS_CASSIOPEIA ) |
53 | canvas.setAdvancePeriod(70); | 54 | canvas.setAdvancePeriod(70); |
54 | #else | 55 | #else |
@@ -63,13 +64,13 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
63 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); | 64 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); |
64 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); | 65 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); |
65 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); | 66 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); |
66 | file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); | 67 | file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); |
67 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); | 68 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); |
68 | menu->insertItem(tr("&Game"), file); | 69 | menu->insertItem(tr("&Game"), file); |
69 | 70 | ||
70 | menu->insertSeparator(); | 71 | menu->insertSeparator(); |
71 | 72 | ||
72 | settings = new QPopupMenu; | 73 | settings = new QPopupMenu; |
73 | settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2); | 74 | settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2); |
74 | snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3); | 75 | snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3); |
75 | settings->setCheckable(TRUE); | 76 | settings->setCheckable(TRUE); |
@@ -88,13 +89,13 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
88 | file->insertItem(tr("Patience"), this, SLOT(initPatience())); | 89 | file->insertItem(tr("Patience"), this, SLOT(initPatience())); |
89 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell())); | 90 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell())); |
90 | file->insertItem(tr("Chicane"), this, SLOT(initChicane())); | 91 | file->insertItem(tr("Chicane"), this, SLOT(initChicane())); |
91 | file->insertItem(tr("Harp"), this, SLOT(initHarp())); | 92 | file->insertItem(tr("Harp"), this, SLOT(initHarp())); |
92 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub())); | 93 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub())); |
93 | menu->insertItem(tr("Play"), file); | 94 | menu->insertItem(tr("Play"), file); |
94 | 95 | ||
95 | menu->insertSeparator(); | 96 | menu->insertSeparator(); |
96 | 97 | ||
97 | settings = new QPopupMenu; | 98 | settings = new QPopupMenu; |
98 | settings->setCheckable(TRUE); | 99 | settings->setCheckable(TRUE); |
99 | settings->insertItem(tr("Change card backs"), this, SLOT(changeCardBacks())); | 100 | settings->insertItem(tr("Change card backs"), this, SLOT(changeCardBacks())); |
100 | snap_id = settings->insertItem(tr("Snap to position"), this, SLOT(snapToggle())); | 101 | snap_id = settings->insertItem(tr("Snap to position"), this, SLOT(snapToggle())); |
@@ -115,13 +116,13 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
115 | 116 | ||
116 | gameType = cfg.readNumEntry( "GameType", -1 ); | 117 | gameType = cfg.readNumEntry( "GameType", -1 ); |
117 | drawThree = cfg.readBoolEntry( "DrawThree", FALSE); | 118 | drawThree = cfg.readBoolEntry( "DrawThree", FALSE); |
118 | if ( gameType == 0 ) { | 119 | if ( gameType == 0 ) { |
119 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); | 120 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); |
120 | cardGame->setNumberToDraw(drawThree ? 3 : 1); | 121 | cardGame->setNumberToDraw(drawThree ? 3 : 1); |
121 | 122 | ||
122 | setCaption(tr("Patience")); | 123 | setCaption(tr("Patience")); |
123 | setCentralWidget(cardGame); | 124 | setCentralWidget(cardGame); |
124 | cardGame->readConfig( cfg ); | 125 | cardGame->readConfig( cfg ); |
125 | setCardBacks(); | 126 | setCardBacks(); |
126 | } else if ( gameType == 1 ) { | 127 | } else if ( gameType == 1 ) { |
127 | cardGame = new FreecellCardGame( &canvas, snapOn, this ); | 128 | cardGame = new FreecellCardGame( &canvas, snapOn, this ); |
@@ -183,13 +184,13 @@ void CanvasCardWindow::resizeEvent(QResizeEvent *) | |||
183 | canvas.resize( s.width() - fw - 2, s.height() - fw - 2); | 184 | canvas.resize( s.width() - fw - 2, s.height() - fw - 2); |
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
187 | void CanvasCardWindow::initPatience() | 188 | void CanvasCardWindow::initPatience() |
188 | { | 189 | { |
189 | // Create New Game | 190 | // Create New Game |
190 | if ( cardGame ) | 191 | if ( cardGame ) |
191 | delete cardGame; | 192 | delete cardGame; |
192 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); | 193 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); |
193 | cardGame->setNumberToDraw(drawThree ? 3 : 1); | 194 | cardGame->setNumberToDraw(drawThree ? 3 : 1); |
194 | gameType = 0; | 195 | gameType = 0; |
195 | setCaption(tr("Patience")); | 196 | setCaption(tr("Patience")); |
@@ -250,19 +251,19 @@ void CanvasCardWindow::initTeeclub() | |||
250 | { | 251 | { |
251 | // Create New Game | 252 | // Create New Game |
252 | if ( cardGame ) { | 253 | if ( cardGame ) { |
253 | delete cardGame; | 254 | delete cardGame; |
254 | } | 255 | } |
255 | cardGame = new TeeclubCardGame( &canvas, snapOn, this ); | 256 | cardGame = new TeeclubCardGame( &canvas, snapOn, this ); |
256 | cardGame->setNumberToDraw(1); | 257 | cardGame->setNumberToDraw(1); |
257 | gameType = 4; | 258 | gameType = 4; |
258 | setCaption(tr("Teeclub")); | 259 | setCaption(tr("Teeclub")); |
259 | setCentralWidget(cardGame); | 260 | setCentralWidget(cardGame); |
260 | cardGame->newGame(); | 261 | cardGame->newGame(); |
261 | setCardBacks(); | 262 | setCardBacks(); |
262 | } | 263 | } |
263 | 264 | ||
264 | 265 | ||
265 | void CanvasCardWindow::snapToggle() | 266 | void CanvasCardWindow::snapToggle() |
266 | { | 267 | { |
267 | snapOn = !snapOn; | 268 | snapOn = !snapOn; |
268 | settings->setItemChecked(snap_id, snapOn); | 269 | settings->setItemChecked(snap_id, snapOn); |
diff --git a/noncore/games/solitaire/canvascardwindow.h b/noncore/games/solitaire/canvascardwindow.h index eddb184..abd6af6 100644 --- a/noncore/games/solitaire/canvascardwindow.h +++ b/noncore/games/solitaire/canvascardwindow.h | |||
@@ -30,12 +30,13 @@ class QPopupMenu; | |||
30 | 30 | ||
31 | 31 | ||
32 | class CanvasCardWindow : public QMainWindow { | 32 | class CanvasCardWindow : public QMainWindow { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | 34 | ||
35 | public: | 35 | public: |
36 | static QString appName() { return QString::fromLatin1("patience"); } | ||
36 | CanvasCardWindow(QWidget* parent=0, const char* name=0, WFlags f=0); | 37 | CanvasCardWindow(QWidget* parent=0, const char* name=0, WFlags f=0); |
37 | virtual ~CanvasCardWindow(); | 38 | virtual ~CanvasCardWindow(); |
38 | 39 | ||
39 | public slots: | 40 | public slots: |
40 | void setCardBacks(); | 41 | void setCardBacks(); |
41 | void changeCardBacks(); | 42 | void changeCardBacks(); |
diff --git a/noncore/games/solitaire/carddeck.cpp b/noncore/games/solitaire/carddeck.cpp index a2d0076..b130131 100644 --- a/noncore/games/solitaire/carddeck.cpp +++ b/noncore/games/solitaire/carddeck.cpp | |||
@@ -22,13 +22,13 @@ | |||
22 | #include "card.h" | 22 | #include "card.h" |
23 | #include "carddeck.h" | 23 | #include "carddeck.h" |
24 | 24 | ||
25 | 25 | ||
26 | CardDeck::CardDeck(int jokers, int numOfDecks) : numberOfJokers(jokers), numberOfDecks(numOfDecks), deckCreated(FALSE) | 26 | CardDeck::CardDeck(int jokers, int numOfDecks) : numberOfJokers(jokers), numberOfDecks(numOfDecks), deckCreated(FALSE) |
27 | { | 27 | { |
28 | cards = new (Card *)[getNumberOfCards()]; | 28 | cards = new Card *[getNumberOfCards()]; |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | CardDeck::~CardDeck() | 32 | CardDeck::~CardDeck() |
33 | { | 33 | { |
34 | for (int i = 0; i < getNumberOfCards(); i++) | 34 | for (int i = 0; i < getNumberOfCards(); i++) |
diff --git a/noncore/games/solitaire/main.cpp b/noncore/games/solitaire/main.cpp index f81aa3c..bd3cf8b 100644 --- a/noncore/games/solitaire/main.cpp +++ b/noncore/games/solitaire/main.cpp | |||
@@ -18,19 +18,9 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "canvascardwindow.h" | 21 | #include "canvascardwindow.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | 26 | OPIE_EXPORT_APP( OApplicationFactory<CanvasCardWindow> ) \ No newline at end of file | |
26 | int main( int argc, char ** argv ) | ||
27 | { | ||
28 | QPEApplication a( argc, argv ); | ||
29 | |||
30 | CanvasCardWindow m; | ||
31 | m.setCaption( CanvasCardWindow::tr("Patience") ); | ||
32 | a.showMainWidget( &m ); | ||
33 | |||
34 | return a.exec(); | ||
35 | } | ||
36 | |||
diff --git a/noncore/games/solitaire/solitaire.pro b/noncore/games/solitaire/solitaire.pro index 1ac62c3..b1b8bda 100755 --- a/noncore/games/solitaire/solitaire.pro +++ b/noncore/games/solitaire/solitaire.pro | |||
@@ -1,10 +1,8 @@ | |||
1 | TEMPLATE = app | ||
2 | 1 | ||
3 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release quick-app |
4 | DESTDIR = $(OPIEDIR)/bin | ||
5 | 3 | ||
6 | HEADERS = canvascard.h canvasshapes.h cardgame.h cardgamelayout.h cardpile.h card.h carddeck.h \ | 4 | HEADERS = canvascard.h canvasshapes.h cardgame.h cardgamelayout.h cardpile.h card.h carddeck.h \ |
7 | canvascardgame.h freecellcardgame.h chicanecardgame.h harpcardgame.h teeclubcardgame.h \ | 5 | canvascardgame.h freecellcardgame.h chicanecardgame.h harpcardgame.h teeclubcardgame.h \ |
8 | patiencecardgame.h canvascardwindow.h | 6 | patiencecardgame.h canvascardwindow.h |
9 | 7 | ||
10 | SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp \ | 8 | SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp \ |
@@ -15,7 +13,8 @@ SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp \ | |||
15 | TARGET = patience | 13 | TARGET = patience |
16 | 14 | ||
17 | INCLUDEPATH += $(OPIEDIR)/include | 15 | INCLUDEPATH += $(OPIEDIR)/include |
18 | DEPENDPATH += $(OPIEDIR)/include | 16 | DEPENDPATH += $(OPIEDIR)/include |
19 | LIBS += -lqpe | 17 | LIBS += -lqpe |
20 | 18 | ||
19 | |||
21 | include ( $(OPIEDIR)/include.pro ) | 20 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/tetrix/main.cpp b/noncore/games/tetrix/main.cpp index e36d52d..fcf4b33 100644 --- a/noncore/games/tetrix/main.cpp +++ b/noncore/games/tetrix/main.cpp | |||
@@ -19,15 +19,10 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "qtetrix.h" | 21 | #include "qtetrix.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | 24 | ||
25 | int main( int argc, char **argv ) | 25 | #include <opie/oapplicationfactory.h> |
26 | { | ||
27 | QPEApplication a(argc,argv); | ||
28 | 26 | ||
29 | QTetrix *tetrix = new QTetrix; | 27 | OPIE_EXPORT_APP( OApplicationFactory<QTetrix> ) |
30 | a.showMainWidget(tetrix); | ||
31 | 28 | ||
32 | return a.exec(); | ||
33 | } | ||
diff --git a/noncore/games/tetrix/opie-tetrix.control b/noncore/games/tetrix/opie-tetrix.control index e901dbf..b1e0bcf 100644 --- a/noncore/games/tetrix/opie-tetrix.control +++ b/noncore/games/tetrix/opie-tetrix.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-tetrix | 1 | Package: opie-tetrix |
2 | Files: bin/tetrix apps/Games/tetrix.desktop pics/tetrix/* | 2 | Files: plugins/application/libtetrix.so* bin/tetrix apps/Games/tetrix.desktop pics/tetrix/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 5 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Arch: iPAQ | 7 | Arch: iPAQ |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
diff --git a/noncore/games/tetrix/qtetrix.h b/noncore/games/tetrix/qtetrix.h index cb33941..c8959c5 100644 --- a/noncore/games/tetrix/qtetrix.h +++ b/noncore/games/tetrix/qtetrix.h | |||
@@ -49,12 +49,13 @@ private: | |||
49 | 49 | ||
50 | 50 | ||
51 | class QTetrix : public QMainWindow | 51 | class QTetrix : public QMainWindow |
52 | { | 52 | { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
55 | static QString appName() { return QString::fromLatin1("tetrix"); } | ||
55 | QTetrix( QWidget *parent=0, const char *name=0, WFlags f=0 ); | 56 | QTetrix( QWidget *parent=0, const char *name=0, WFlags f=0 ); |
56 | void startGame() { board->startGame(); } | 57 | void startGame() { board->startGame(); } |
57 | 58 | ||
58 | public slots: | 59 | public slots: |
59 | void gameOver(); | 60 | void gameOver(); |
60 | void quit(); | 61 | void quit(); |
diff --git a/noncore/games/tetrix/tetrix.pro b/noncore/games/tetrix/tetrix.pro index 35fe82b..3b95c84 100644 --- a/noncore/games/tetrix/tetrix.pro +++ b/noncore/games/tetrix/tetrix.pro | |||
@@ -1,9 +1,7 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = gtetrix.h \ | 2 | HEADERS = gtetrix.h \ |
5 | qtetrix.h \ | 3 | qtetrix.h \ |
6 | qtetrixb.h \ | 4 | qtetrixb.h \ |
7 | tpiece.h \ | 5 | tpiece.h \ |
8 | ohighscoredlg.h | 6 | ohighscoredlg.h |
9 | SOURCES = main.cpp \ | 7 | SOURCES = main.cpp \ |
@@ -15,7 +13,10 @@ SOURCES = main.cpp \ | |||
15 | INCLUDEPATH += $(OPIEDIR)/include | 13 | INCLUDEPATH += $(OPIEDIR)/include |
16 | DEPENDPATH+= $(OPIEDIR)/include | 14 | DEPENDPATH+= $(OPIEDIR)/include |
17 | LIBS += -lqpe -lstdc++ | 15 | LIBS += -lqpe -lstdc++ |
18 | INTERFACES= | 16 | INTERFACES= |
19 | TARGET = tetrix | 17 | TARGET = tetrix |
20 | 18 | ||
19 | |||
20 | |||
21 | |||
21 | include ( $(OPIEDIR)/include.pro ) | 22 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/wordgame/main.cpp b/noncore/games/wordgame/main.cpp index cd4600e..f32acff 100644 --- a/noncore/games/wordgame/main.cpp +++ b/noncore/games/wordgame/main.cpp | |||
@@ -18,17 +18,11 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "wordgame.h" | 21 | #include "wordgame.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main( int argc, char ** argv ) | ||
26 | { | ||
27 | QPEApplication a( argc, argv ); | ||
28 | 26 | ||
29 | WordGame mw; | 27 | OPIE_EXPORT_APP( OApplicationFactory<WordGame> ) |
30 | //QPEApplication::setInputMethodHint( &mw, QPEApplication::AlwaysOff ); | ||
31 | a.showMainWidget(&mw); | ||
32 | 28 | ||
33 | return a.exec(); | ||
34 | } | ||
diff --git a/noncore/games/wordgame/wordgame.h b/noncore/games/wordgame/wordgame.h index f73c85a..020a4b5 100644 --- a/noncore/games/wordgame/wordgame.h +++ b/noncore/games/wordgame/wordgame.h | |||
@@ -306,12 +306,13 @@ class NewGame; | |||
306 | 306 | ||
307 | class WordGame : public QMainWindow { | 307 | class WordGame : public QMainWindow { |
308 | Q_OBJECT | 308 | Q_OBJECT |
309 | public: | 309 | public: |
310 | WordGame( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 310 | WordGame( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
311 | ~WordGame(); | 311 | ~WordGame(); |
312 | static QString appName() { return QString::fromLatin1("wordgame"); } | ||
312 | 313 | ||
313 | private slots: | 314 | private slots: |
314 | void endTurn(); | 315 | void endTurn(); |
315 | void resetTurn(); | 316 | void resetTurn(); |
316 | void passTurn(); | 317 | void passTurn(); |
317 | void think(); | 318 | void think(); |
diff --git a/noncore/games/wordgame/wordgame.pro b/noncore/games/wordgame/wordgame.pro index e997adc..7ef2bfd 100644 --- a/noncore/games/wordgame/wordgame.pro +++ b/noncore/games/wordgame/wordgame.pro | |||
@@ -1,13 +1,12 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = wordgame.h | 2 | HEADERS = wordgame.h |
5 | SOURCES = main.cpp \ | 3 | SOURCES = main.cpp \ |
6 | wordgame.cpp | 4 | wordgame.cpp |
7 | INTERFACES= newgamebase.ui rulesbase.ui | 5 | INTERFACES= newgamebase.ui rulesbase.ui |
8 | TARGET = wordgame | 6 | TARGET = wordgame |
9 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
10 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
11 | LIBS += -lqpe | 9 | LIBS += -lqpe |
12 | 10 | ||
11 | |||
13 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |