diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | c90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch) | |
tree | 6d8391395bce9eaea4ad78958617edb20c6a7573 /kblackbox/kbbgame.h | |
download | tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kblackbox/kbbgame.h')
-rw-r--r-- | kblackbox/kbbgame.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/kblackbox/kbbgame.h b/kblackbox/kbbgame.h new file mode 100644 index 00000000..70f6ad48 --- /dev/null +++ b/kblackbox/kbbgame.h @@ -0,0 +1,104 @@ +// +// +// KBlackBox +// +// A simple game inspired by an emacs module +// +// File: kbbgame.h +// +// The definition of the KBBGame widget +// + +#ifndef KBBGAME_H +#define KBBGAME_H + +#include "kbbgfx.h" +#include "util.h" + +#include <kmainwindow.h> +#include <krandomsequence.h> + +class KSelectAction; +class KToggleAction; + +/* + Types of the boxes (used f.e.g. in the traceRay() method) +*/ + +#define OUTERBBT 0 +#define INNERBBT 1 +#define LASERBBT 2 +#define BALLBBT 3 + +/* + Ray-tracing results. +*/ + +#define WRONGSTART -1 +#define DETOUR 0 +#define REFLECTION 1 +#define HIT 2 + +/* + * Statusbar IDs. + */ +#define SSCORE 0 +#define SBALLS 1 +#define SRUN 2 +#define SSIZE 3 + +class KBBGame : public KMainWindow +{ + Q_OBJECT +public: + KBBGame(); + ~KBBGame(); + +signals: + void gameRuns( bool ); + +private slots: + void slotSize(); + void slotBalls(); + + void tutorialSwitch(); + + void newGame(); + + bool setSize( int w, int h ); + bool setBalls( int n ); + void setMinSize(); + void randomBalls( int n ); + void slotResize(); + void gameResize(); + void setScore( int n ); + void updateStats(); + void gameFinished(); + void abortGame(); + void giveUp(); + void gotInputAt( int col, int row, int state ); + +private: + int traceRay( int startX, int startY, int *endX, int *endY ); + void remap( RectOnArray *gam, RectOnArray *gra ); + void getResults(); + void initKAction(); + + int balls; + int detourCounter; + int ballsPlaced; + bool running; + bool tutorial; + RectOnArray *gameBoard; + KBBGraphic *gr; + + int score; + /* QLabel *scoreText; + QLabel *statusText;*/ + KRandomSequence random; + + KSelectAction *ballsAction, *sizeAction; + KToggleAction *tutorialAction; +}; + +#endif // KBBGAME_H |