• 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 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
 

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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:09 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