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

kapman

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

#include <game.h>

Inheritance diagram for Game:
Inheritance graph
[legend]

Public Slots

void keyPressEvent (QKeyEvent *p_event)
 
void resumeAfterKapmanDeath ()
 

Signals

void bonusOff ()
 
void bonusOn ()
 
void elementEaten (const qreal p_x, const qreal p_y)
 
void gameOver (const bool p_unused)
 
void gameStarted ()
 
void levelChanged (unsigned int p_level)
 
void levelStarted (const bool p_newLevel)
 
void livesChanged (unsigned int p_lives)
 
void pauseChanged (const bool p_pause, const bool p_fromUser)
 
void pointsToDisplay (long p_wonPoints, qreal p_xPos, qreal p_yPos)
 
void scoreChanged (unsigned int p_score)
 

Public Member Functions

 Game ()
 
 ~Game ()
 
void createBonus (QPointF p_position)
 
void createGhost (QPointF p_position, const QString &p_imageId)
 
void createKapman (QPointF p_position)
 
Bonus * getBonus () const
 
QList< Ghost * > getGhosts () const
 
Kapman * getKapman () const
 
int getLevel () const
 
int getLives () const
 
Maze * getMaze () const
 
int getScore () const
 
QTimer * getTimer () const
 
void initGhost ()
 
void initKapman ()
 
void initMaze (const int p_nbRows, const int p_nbColumns)
 
bool isCheater () const
 
bool isPaused () const
 
void pause (bool p_locked=false)
 
void setLevel (int p_level)
 
void setSoundsEnabled (bool p_enabled)
 
void start ()
 
void switchPause (bool p_locked=false)
 
- 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
 

Static Public Attributes

static int s_bonusDuration
 
static qreal s_durationRatio
 
static int s_preyStateDuration
 

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

This class manages the game main loop : it regularly checks the key press events, computes the character moves and updates their coordinates.

Definition at line 35 of file game.h.

Constructor & Destructor Documentation

Game::Game ( )

Creates a new Game instance.

Definition at line 32 of file game.cpp.

Game::~Game ( )

Deletes the Game instance.

Definition at line 124 of file game.cpp.

Member Function Documentation

void Game::bonusOff ( )
signal

Emitted when the Bonus has to disappear.

void Game::bonusOn ( )
signal

Emitted when the Bonus has to be displayed.

void Game::createBonus ( QPointF  p_position)

Create the new Bonus.

Parameters
p_positionthe Bonus position

Definition at line 232 of file game.cpp.

void Game::createGhost ( QPointF  p_position,
const QString &  p_imageId 
)

Create the new Ghost.

Parameters
p_positionthe Ghost position
p_imageIdthe image of the Ghost

Definition at line 240 of file game.cpp.

void Game::createKapman ( QPointF  p_position)

Create the new Kapman.

Parameters
p_positionthe Kapman position

Definition at line 236 of file game.cpp.

void Game::elementEaten ( const qreal  p_x,
const qreal  p_y 
)
signal

Emitted when an Element has been eaten.

Parameters
p_xthe Element x-coordinate
p_ythe Element y-coordinate
void Game::gameOver ( const bool  p_unused)
signal

Emitted when the Game is over.

Parameters
p_unusedthis parameter must always be true !
void Game::gameStarted ( )
signal

Emitted when the Game is started.

Bonus * Game::getBonus ( ) const
Returns
the Bonus instance

Definition at line 228 of file game.cpp.

QList< Ghost * > Game::getGhosts ( ) const
Returns
the Ghost models

Definition at line 172 of file game.cpp.

Kapman * Game::getKapman ( ) const
Returns
the Kapman model

Definition at line 168 of file game.cpp.

int Game::getLevel ( ) const
Returns
the current level

Definition at line 199 of file game.cpp.

int Game::getLives ( ) const
Returns
the number of remaining lives

Definition at line 195 of file game.cpp.

Maze * Game::getMaze ( ) const
Returns
the Maze instance

Definition at line 180 of file game.cpp.

int Game::getScore ( ) const
Returns
the score

Definition at line 192 of file game.cpp.

QTimer * Game::getTimer ( ) const
Returns
the main timer

Definition at line 176 of file game.cpp.

void Game::initGhost ( )

Initializes a Ghost.

void Game::initKapman ( )

Initializes a Kapman.

void Game::initMaze ( const int  p_nbRows,
const int  p_nbColumns 
)

Initializes a Maze.

Parameters
p_nbRowsthe number of rows
p_nbColumnsthe number of columns

Definition at line 244 of file game.cpp.

bool Game::isCheater ( ) const
Returns
true if the player has cheated during the game, false otherwise

Definition at line 188 of file game.cpp.

bool Game::isPaused ( ) const
Returns
true if the Game is paused, false otherwise

Definition at line 184 of file game.cpp.

void Game::keyPressEvent ( QKeyEvent *  p_event)
slot

Manages the key press events.

Parameters
p_eventthe key press event

Definition at line 293 of file game.cpp.

void Game::levelChanged ( unsigned int  p_level)
signal

Emitted when the level have changed.

Parameters
p_levelthe new level data
void Game::levelStarted ( const bool  p_newLevel)
signal

Emitted when a level begins, if level up or if a life has been lost.

Parameters
p_newLeveltrue if a new level is beginning, false otherwise
void Game::livesChanged ( unsigned int  p_lives)
signal

Emitted when the lives have changed.

Parameters
p_livesthe new lives data
void Game::pause ( bool  p_locked = false)

Pauses the Game.

Parameters
p_lockedif true the player will be unable to unset the pause.

Definition at line 142 of file game.cpp.

void Game::pauseChanged ( const bool  p_pause,
const bool  p_fromUser 
)
signal

Emitted when the pause state has changed.

Parameters
p_pausetrue if the Game is paused, false otherwise
p_fromUsertrue if the Game has been paused due to an action the player has done, false otherwise
void Game::pointsToDisplay ( long  p_wonPoints,
qreal  p_xPos,
qreal  p_yPos 
)
signal

Emitted when a ghost or a bonus is eaten.

It tells to the scene to display the number of won points

Parameters
p_wonPointsthe value to display
p_xPosthe x position of the label
p_yPosthe y position of the label
void Game::resumeAfterKapmanDeath ( )
slot

Resumes the Game after the Kapman death.

Definition at line 383 of file game.cpp.

void Game::scoreChanged ( unsigned int  p_score)
signal

Emitted when the score have changed.

Parameters
p_scorethe new score data
void Game::setLevel ( int  p_level)

Sets the level to the given number.

Parameters
p_levelthe new level

Definition at line 203 of file game.cpp.

void Game::setSoundsEnabled ( bool  p_enabled)

Enables / disables the sounds.

Parameters
p_enabledif true the sounds will be enabled, otherwise they will be disabled

Definition at line 248 of file game.cpp.

void Game::start ( )

Starts the Game.

Definition at line 135 of file game.cpp.

void Game::switchPause ( bool  p_locked = false)

Pauses / unpauses the game.

Parameters
p_lockedif true the player will be unable to unset the pause.

Definition at line 153 of file game.cpp.

Member Data Documentation

int Game::s_bonusDuration
static

Timer duration for bonus apparition in medium difficulty.

Definition at line 47 of file game.h.

qreal Game::s_durationRatio
static

Ratio which modify the timers function of the difficulty.

Definition at line 41 of file game.h.

int Game::s_preyStateDuration
static

Timer duration for prey state in medium difficulty.

Definition at line 44 of file game.h.


The documentation for this class was generated from the following files:
  • game.h
  • game.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapman

Skip menu "kapman"
  • 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