kblackbox
#include <kbbgamedoc.h>
Public Slots | |
void | timeChanged () |
Signals | |
void | isRunning (bool) |
void | updateStats () |
Public Member Functions | |
KBBGameDoc (KBBMainWindow *parent, KBBTutorial *tutorial) | |
int | columns () const |
void | gameOver () |
bool | gameReallyStarted () |
bool | mayShootRay (const int incomingPosition) const |
void | newGame (int balls, int columns, int rows) |
int | numberOfBallsPlaced () |
int | numberOfBallsToPlace () |
int | rows () const |
int | score () |
int | shootRay (int borderPosition) |
void | startTutorial () |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Public Attributes | |
KBBBallsOnBoard * | m_balls |
KBBBallsOnBoard * | m_ballsPlaced |
Static Public Attributes | |
static const int | HIT_POSITION = -1 |
static const int | SCORE_LOST = 999 |
static const int | SCORE_ONE = 3 |
static const int | SCORE_TWO = 9 |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Detailed Description
Game document (Logical board)
The game document (=logical board) manages a game, that is:
- the score
- the balls the user placed on the board
- the real (hidden) balls of the black box
Definition at line 56 of file kbbgamedoc.h.
Constructor & Destructor Documentation
KBBGameDoc::KBBGameDoc | ( | KBBMainWindow * | parent, |
KBBTutorial * | tutorial | ||
) |
Constructor.
Definition at line 45 of file kbbgamedoc.cpp.
Member Function Documentation
int KBBGameDoc::columns | ( | ) | const |
Get the number of columns.
Definition at line 65 of file kbbgamedoc.cpp.
void KBBGameDoc::gameOver | ( | ) |
Stop the game, show solution and compute final score.
Definition at line 71 of file kbbgamedoc.cpp.
bool KBBGameDoc::gameReallyStarted | ( | ) |
Check if the player started to play.
Check if the game is running and if the player shot at least one laser ray. Before that, the player doesn't need to confirm the end of the game, if he tries to start a new game.
Definition at line 82 of file kbbgamedoc.cpp.
|
signal |
bool KBBGameDoc::mayShootRay | ( | const int | incomingPosition | ) | const |
Definition at line 88 of file kbbgamedoc.cpp.
void KBBGameDoc::newGame | ( | int | balls, |
int | columns, | ||
int | rows | ||
) |
Create new board game and initialize game.
- Parameters
-
balls Number of balls to place on the board columns Number of columns rows Number of rows
Definition at line 97 of file kbbgamedoc.cpp.
int KBBGameDoc::numberOfBallsPlaced | ( | ) |
Number of balls the user placed on the board.
Definition at line 112 of file kbbgamedoc.cpp.
int KBBGameDoc::numberOfBallsToPlace | ( | ) |
Number of balls the user has to place on the board.
Definition at line 118 of file kbbgamedoc.cpp.
int KBBGameDoc::rows | ( | ) | const |
Get the number of rows.
Definition at line 124 of file kbbgamedoc.cpp.
int KBBGameDoc::score | ( | ) |
Get current score.
Definition at line 130 of file kbbgamedoc.cpp.
int KBBGameDoc::shootRay | ( | int | borderPosition | ) |
Shoot a ray.
This is the main player action. A laser ray is shot from a border position, interacts with the balls in the black box and get out (or hit a ball). This costs 1 or 2 score points, depending where the laser ray exits.
- Parameters
-
borderPosition Incoming border position, where the laser ray starts
- Returns
- Outgoing border position, where the laser leaves the black box. If the laser hits a ball, the result is HIT_POSITION (that is not a valid border position).
Definition at line 136 of file kbbgamedoc.cpp.
void KBBGameDoc::startTutorial | ( | ) |
Initialize the tutorial.
Definition at line 153 of file kbbgamedoc.cpp.
|
slot |
Definition at line 164 of file kbbgamedoc.cpp.
|
signal |
Member Data Documentation
|
static |
When a laser ray enter the black box, it exits on a defined border position, except if the laser ray hits a ball.
In this case, it doesn't exit the black box. In this case, we defined the exit position as the HIT_POSITION. This position is "virtual" and must be different to all other possible "real" border positions. (That's why we defined it as a negative (<0) position).
Definition at line 65 of file kbbgamedoc.h.
KBBBallsOnBoard* KBBGameDoc::m_balls |
Definition at line 144 of file kbbgamedoc.h.
KBBBallsOnBoard* KBBGameDoc::m_ballsPlaced |
Definition at line 145 of file kbbgamedoc.h.
|
static |
Definition at line 67 of file kbbgamedoc.h.
|
static |
Definition at line 68 of file kbbgamedoc.h.
|
static |
Definition at line 69 of file kbbgamedoc.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.