• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kblackbox

Public Slots | Signals | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
KBBGameDoc Class Reference

#include <kbbgamedoc.h>

Inheritance diagram for KBBGameDoc:
Inheritance graph
[legend]

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 &regExp) 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.

void KBBGameDoc::isRunning ( bool  )
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
ballsNumber of balls to place on the board
columnsNumber of columns
rowsNumber 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
borderPositionIncoming 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.

void KBBGameDoc::timeChanged ( )
slot

Definition at line 164 of file kbbgamedoc.cpp.

void KBBGameDoc::updateStats ( )
signal

Member Data Documentation

const int KBBGameDoc::HIT_POSITION = -1
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.

const int KBBGameDoc::SCORE_LOST = 999
static

Definition at line 67 of file kbbgamedoc.h.

const int KBBGameDoc::SCORE_ONE = 3
static

Definition at line 68 of file kbbgamedoc.h.

const int KBBGameDoc::SCORE_TWO = 9
static

Definition at line 69 of file kbbgamedoc.h.


The documentation for this class was generated from the following files:
  • kbbgamedoc.h
  • kbbgamedoc.cpp
This file is part of the KDE documentation.
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.

kblackbox

Skip menu "kblackbox"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal