author | leseb <leseb> | 2002-04-15 22:40:28 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-04-15 22:40:28 (UTC) |
commit | a91544d04ed391bbdc0c6f95ff8a80d35190788c (patch) (unidiff) | |
tree | 85dea85fd8a1cdb6d2d18fef57753d0b5e4bd143 /noncore/games/kpacman/score.h | |
parent | 6396d8b9fca7f3f50010a13a26e4ee9569abefb3 (diff) | |
download | opie-a91544d04ed391bbdc0c6f95ff8a80d35190788c.zip opie-a91544d04ed391bbdc0c6f95ff8a80d35190788c.tar.gz opie-a91544d04ed391bbdc0c6f95ff8a80d35190788c.tar.bz2 |
New directory structure
-rw-r--r-- | noncore/games/kpacman/score.h | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/noncore/games/kpacman/score.h b/noncore/games/kpacman/score.h new file mode 100644 index 0000000..87f24b9 --- a/dev/null +++ b/noncore/games/kpacman/score.h | |||
@@ -0,0 +1,129 @@ | |||
1 | #ifndef SCORE_H | ||
2 | #define SCORE_H | ||
3 | |||
4 | #ifdef HAVE_CONFIG_H | ||
5 | #include <config.h> | ||
6 | #endif | ||
7 | |||
8 | #include "portable.h" | ||
9 | |||
10 | #if defined( KDE2_PORT ) | ||
11 | #include <kapp.h> | ||
12 | #endif | ||
13 | |||
14 | #include <qwidget.h> | ||
15 | #include <qstring.h> | ||
16 | #include <qpoint.h> | ||
17 | #include <qrect.h> | ||
18 | #include <qfile.h> | ||
19 | |||
20 | #include <qfileinfo.h> | ||
21 | #include <qdatetime.h> | ||
22 | |||
23 | #include "painter.h" | ||
24 | #include "bitfont.h" | ||
25 | |||
26 | #define maxPlayer 1 | ||
27 | #define minPlayerNameLength 3 | ||
28 | #define highscoreName "highscore" | ||
29 | |||
30 | class Score : public QWidget | ||
31 | { | ||
32 | Q_OBJECT | ||
33 | public: | ||
34 | Score (QWidget *parent=0, const char *name=0, int scheme=-1, int mode=-1, Bitfont *font=0); | ||
35 | ~Score(); | ||
36 | |||
37 | public slots: | ||
38 | void setScheme(int scheme, int mode, Bitfont *font=0); | ||
39 | |||
40 | void set(int score); | ||
41 | void set(int score, int player); | ||
42 | void setScore(int level, int player); | ||
43 | void setPause(bool paused); | ||
44 | |||
45 | void initKeys(); | ||
46 | |||
47 | private slots: | ||
48 | void read(); | ||
49 | void write(); | ||
50 | void end(); | ||
51 | |||
52 | signals: | ||
53 | void toggleNew(); | ||
54 | void forcedHallOfFame(bool); | ||
55 | |||
56 | protected: | ||
57 | void timerEvent(QTimerEvent *); | ||
58 | void paintEvent(QPaintEvent *); | ||
59 | void keyPressEvent(QKeyEvent *); | ||
60 | |||
61 | void focusInEvent(QFocusEvent *) { ; } | ||
62 | void focusOutEvent(QFocusEvent *) { ; } | ||
63 | |||
64 | void confScheme(); | ||
65 | void confTiming(bool defGroup=TRUE); | ||
66 | |||
67 | private: | ||
68 | Bitfont *bitfont; | ||
69 | |||
70 | QRect rect(int col, float row, QString str, int align = AlignCenter); | ||
71 | int x(int col); | ||
72 | int y(float row); | ||
73 | |||
74 | QString formatDate(QDate date); | ||
75 | |||
76 | /** | ||
77 | * Ermittelt die zu benutzende "highscore"-Datei, in die auch geschrieben werden kann. | ||
78 | * Über den "highscoreFilePath"-KConfig-Eintrag, kann abweichend von der Standardlokation | ||
79 | * der Standort der "highscore"-Datei spezifiziert werden. | ||
80 | * Wenn die systemweite "globale" Datei nicht beschrieben werden kann, wird mit einer | ||
81 | * privaten Datei gearbeitet. | ||
82 | */ | ||
83 | QFileInfo locateHighscoreFilePath(); | ||
84 | |||
85 | int cursorBlinkMS; | ||
86 | int hallOfFameMS; | ||
87 | int afterPauseMS; | ||
88 | |||
89 | bool paused; | ||
90 | |||
91 | uint UpKey; | ||
92 | uint DownKey; | ||
93 | uint RightKey; | ||
94 | uint LeftKey; | ||
95 | |||
96 | int lastScore; | ||
97 | int lastPlayer; | ||
98 | int HighScore; | ||
99 | int playerScore[maxPlayer]; | ||
100 | QString playerName[maxPlayer]; | ||
101 | |||
102 | struct { | ||
103 | int x; | ||
104 | int y; | ||
105 | QChar chr; | ||
106 | bool on; | ||
107 | } cursor; | ||
108 | |||
109 | int cursorBlinkTimer; | ||
110 | bool scrollRepeat; | ||
111 | |||
112 | struct { | ||
113 | int points; | ||
114 | int levels; | ||
115 | QTime duration; | ||
116 | QDateTime moment; | ||
117 | QString name; | ||
118 | } hallOfFame[10]; | ||
119 | |||
120 | QFileInfo systemHighscoreFileInfo; | ||
121 | QFileInfo privateHighscoreFileInfo; | ||
122 | |||
123 | QFile highscoreFile; | ||
124 | |||
125 | int scheme; | ||
126 | int mode; | ||
127 | }; | ||
128 | |||
129 | #endif // SCORE_H | ||