1 | /********************************************************************************** |
2 | This file is part of the game 'KTron' |
3 | |
4 | Copyright (C) 1998-2000 by Matthias Kiefer <matthias.kiefer@gmx.de> |
5 | Copyright (C) 2005 Benjamin C. Meyer <ben at meyerhome dot net> |
6 | Copyright (C) 2008-2009 Stas Verberkt <legolas at legolasweb dot nl> |
7 | |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
21 | |
22 | *******************************************************************************/ |
23 | |
24 | #ifndef KTRON_H |
25 | #define KTRON_H |
26 | |
27 | #include <KAction> |
28 | #include <KXmlGuiWindow> |
29 | #include <QKeyEvent> |
30 | |
31 | #include "tron.h" |
32 | |
33 | #define ID_STATUS_BASE 40 |
34 | #define MESSAGE_TIME 2000 |
35 | |
36 | class General; |
37 | |
38 | /** |
39 | * @short The main window of KTron |
40 | */ |
41 | class KTron : public KXmlGuiWindow { |
42 | |
43 | Q_OBJECT |
44 | |
45 | public: |
46 | KTron(QWidget *parent=0); |
47 | ~KTron(); |
48 | |
49 | private: |
50 | void updateStatusbar(); |
51 | |
52 | protected: |
53 | /** calls tron->updatePixmap to draw frame in the new colors */ |
54 | void paletteChange(const QPalette &oldPalette); |
55 | virtual void closeEvent(QCloseEvent *); |
56 | /** Key hits */ |
57 | void keyPressEvent(QKeyEvent *); |
58 | void keyReleaseEvent(QKeyEvent *); |
59 | |
60 | public slots: |
61 | void close(); |
62 | |
63 | private slots: |
64 | void loadSettings(); |
65 | /** updates players points in statusbar and checks if someone has won */ |
66 | void changeStatus(); |
67 | void updateScore(); |
68 | void showSettings(); |
69 | void showHighscores(); |
70 | void optionsConfigureKeys(); |
71 | void blockPause(bool block); |
72 | // Triggers keys |
73 | void triggerKey0Up(bool); |
74 | void triggerKey0Down(bool); |
75 | void triggerKey0Left(bool); |
76 | void triggerKey0Right(bool); |
77 | void triggerKey0Accelerate(bool); |
78 | void triggerKey1Up(bool); |
79 | void triggerKey1Down(bool); |
80 | void triggerKey1Left(bool); |
81 | void triggerKey1Right(bool); |
82 | void triggerKey1Accelerate(bool); |
83 | |
84 | private: |
85 | Tron *m_tron; |
86 | KAction *m_player0Up; |
87 | KAction *m_player0Down; |
88 | KAction *m_player0Left; |
89 | KAction *m_player0Right; |
90 | KAction *m_player0Accelerate; |
91 | KAction *m_player1Up; |
92 | KAction *m_player1Down; |
93 | KAction *m_player1Left; |
94 | KAction *m_player1Right; |
95 | KAction *m_player1Accelerate; |
96 | KAction *m_pauseButton; |
97 | General *m_generalConfigDialog; |
98 | }; |
99 | |
100 | #endif // KTRON_H |
101 | |
102 | |