author | leseb <leseb> | 2002-04-15 22:40:28 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-04-15 22:40:28 (UTC) |
commit | a91544d04ed391bbdc0c6f95ff8a80d35190788c (patch) (side-by-side diff) | |
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
Diffstat (limited to 'noncore/games/kpacman/score.h') (more/less context) (ignore whitespace changes)
-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 @@ +#ifndef SCORE_H +#define SCORE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "portable.h" + +#if defined( KDE2_PORT ) +#include <kapp.h> +#endif + +#include <qwidget.h> +#include <qstring.h> +#include <qpoint.h> +#include <qrect.h> +#include <qfile.h> + +#include <qfileinfo.h> +#include <qdatetime.h> + +#include "painter.h" +#include "bitfont.h" + +#define maxPlayer 1 +#define minPlayerNameLength 3 +#define highscoreName "highscore" + +class Score : public QWidget +{ + Q_OBJECT +public: + Score (QWidget *parent=0, const char *name=0, int scheme=-1, int mode=-1, Bitfont *font=0); + ~Score(); + +public slots: + void setScheme(int scheme, int mode, Bitfont *font=0); + + void set(int score); + void set(int score, int player); + void setScore(int level, int player); + void setPause(bool paused); + + void initKeys(); + +private slots: + void read(); + void write(); + void end(); + +signals: + void toggleNew(); + void forcedHallOfFame(bool); + +protected: + void timerEvent(QTimerEvent *); + void paintEvent(QPaintEvent *); + void keyPressEvent(QKeyEvent *); + + void focusInEvent(QFocusEvent *) { ; } + void focusOutEvent(QFocusEvent *) { ; } + + void confScheme(); + void confTiming(bool defGroup=TRUE); + +private: + Bitfont *bitfont; + + QRect rect(int col, float row, QString str, int align = AlignCenter); + int x(int col); + int y(float row); + + QString formatDate(QDate date); + + /** + * Ermittelt die zu benutzende "highscore"-Datei, in die auch geschrieben werden kann. + * Über den "highscoreFilePath"-KConfig-Eintrag, kann abweichend von der Standardlokation + * der Standort der "highscore"-Datei spezifiziert werden. + * Wenn die systemweite "globale" Datei nicht beschrieben werden kann, wird mit einer + * privaten Datei gearbeitet. + */ + QFileInfo locateHighscoreFilePath(); + + int cursorBlinkMS; + int hallOfFameMS; + int afterPauseMS; + + bool paused; + + uint UpKey; + uint DownKey; + uint RightKey; + uint LeftKey; + + int lastScore; + int lastPlayer; + int HighScore; + int playerScore[maxPlayer]; + QString playerName[maxPlayer]; + + struct { + int x; + int y; + QChar chr; + bool on; + } cursor; + + int cursorBlinkTimer; + bool scrollRepeat; + + struct { + int points; + int levels; + QTime duration; + QDateTime moment; + QString name; + } hallOfFame[10]; + + QFileInfo systemHighscoreFileInfo; + QFileInfo privateHighscoreFileInfo; + + QFile highscoreFile; + + int scheme; + int mode; +}; + +#endif // SCORE_H |