Diffstat (limited to 'noncore/games/kbill/kbill.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/kbill/kbill.cpp | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/noncore/games/kbill/kbill.cpp b/noncore/games/kbill/kbill.cpp new file mode 100644 index 0000000..568df95 --- a/dev/null +++ b/noncore/games/kbill/kbill.cpp | |||
@@ -0,0 +1,118 @@ | |||
1 | /*************************************************************************** | ||
2 | kbill.cpp - description | ||
3 | ------------------- | ||
4 | begin : Thu Dec 30 16:55:55 CET 1999 | ||
5 | copyright : (C) 1999 by Jurrien Loonstra | ||
6 | email : j.h.loonstra@st.hanze.nl | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | |||
18 | #include <qmessagebox.h> | ||
19 | #include <qmenubar.h> | ||
20 | #include "kbill.h" | ||
21 | #include "inputbox.h" | ||
22 | |||
23 | #include "objects.h" | ||
24 | #include "Strings.h" | ||
25 | |||
26 | KBill::KBill() : QMainWindow() { | ||
27 | setCaption("kBill"); | ||
28 | file = new QPopupMenu(); | ||
29 | file->insertItem(("New game"), this, SLOT(NewGame())); | ||
30 | pauseid = file->insertItem(("Pause game"), this, SLOT(Pause())); | ||
31 | //these are dissabled until I fix them | ||
32 | //file->insertItem(("Warp to level..."), this, SLOT(WarpTo())); | ||
33 | //file->insertItem(("View high scores"), this, SLOT(ViewHighScores())); | ||
34 | file->insertItem(("Quit game"), this, SLOT(Quit())); | ||
35 | |||
36 | help = new QPopupMenu(); | ||
37 | help->insertItem(("Story of kBill"), this, SLOT(Story())); | ||
38 | help->insertItem(("Rules"), this, SLOT(Rules())); | ||
39 | |||
40 | |||
41 | menu = new QMenuBar(this); | ||
42 | menu->insertItem(("&File"), file); | ||
43 | menu->insertSeparator(); | ||
44 | menu->insertItem(("&Help"), help); | ||
45 | |||
46 | field = new Field(this); | ||
47 | //setView(field); | ||
48 | //setMainWidget(field); | ||
49 | //setMenu(menu); | ||
50 | } | ||
51 | |||
52 | KBill::~KBill() { | ||
53 | } | ||
54 | |||
55 | Field* KBill::getField() { | ||
56 | return field; | ||
57 | } | ||
58 | |||
59 | // ----------------------------------------------------------------------- | ||
60 | |||
61 | void KBill::Quit() { | ||
62 | field->stopTimer(); | ||
63 | qApp->quit(); | ||
64 | |||
65 | } | ||
66 | |||
67 | void KBill::About(){ | ||
68 | // field->stopTimer(); | ||
69 | // AboutBox about(this); | ||
70 | // about.exec(); | ||
71 | // field->startTimer(); | ||
72 | } | ||
73 | |||
74 | void KBill::NewGame() { | ||
75 | field->stopTimer(); | ||
76 | // if (KMsgBox::yesNo(this, i18n("New Game"), i18n(newgamestr), KMsgBox::QUESTION) == 1) | ||
77 | game.start(1); | ||
78 | // else | ||
79 | field->startTimer(); | ||
80 | } | ||
81 | |||
82 | void KBill::Pause() { | ||
83 | field->stopTimer(); | ||
84 | QMessageBox::message(("Pause Game"), (pausestr), 0); | ||
85 | field->startTimer(); | ||
86 | } | ||
87 | |||
88 | void KBill::WarpTo() { | ||
89 | /* field->stopTimer(); | ||
90 | InputBox b(this, 0, "Warp To Level", warpstr); | ||
91 | bool status = b.exec() == 1; | ||
92 | field->startTimer(); | ||
93 | if (status) { | ||
94 | bool ok; | ||
95 | int level = b.getText().toUInt(&ok); | ||
96 | if (ok) { | ||
97 | field->startTimer(); | ||
98 | game.warp_to_level(level); | ||
99 | return; | ||
100 | } | ||
101 | }*/ | ||
102 | } | ||
103 | |||
104 | void KBill::ViewHighScores() { | ||
105 | //ui.popup_dialog(Game::HIGHSCORE); | ||
106 | } | ||
107 | |||
108 | void KBill::Story() { | ||
109 | field->stopTimer(); | ||
110 | QMessageBox::message( ("Story"), (storystr), 0); | ||
111 | field->startTimer(); | ||
112 | } | ||
113 | |||
114 | void KBill::Rules() { | ||
115 | field->stopTimer(); | ||
116 | QMessageBox::message(("Rules"), (rulesstr), 0); | ||
117 | field->startTimer(); | ||
118 | } | ||