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

granatier

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

#include <game.h>

Inheritance diagram for Game:
Inheritance graph
[legend]

Public Slots

void createBomb (Player *player, qreal x, qreal y, bool newBomb, int throwDistance)
 
void keyPressEvent (QKeyEvent *p_event)
 
void keyReleaseEvent (QKeyEvent *p_event)
 
void setRoundFinished ()
 

Signals

void bombCreated (Bomb *bomb)
 
void bombRemoved (Bomb *bomb)
 
void gameOver ()
 
void gameStarted ()
 
void infoChanged (const Granatier::Info::Type p_info)
 
void pauseChanged (const bool p_pause, const bool p_fromUser)
 

Public Member Functions

 Game (PlayerSettings *playerSettings)
 
 ~Game ()
 
void blockDestroyed (const int row, const int col, Block *block)
 
void createBonus ()
 
Arena * getArena () const
 
QList< Bonus * > getBonus () const
 
bool getGameOver () const
 
QList< Player * > getPlayers () const
 
int getRemainingTime () const
 
QTimer * getTimer () const
 
QString getWinner () const
 
int getWinPoints () const
 
bool isPaused () const
 
void pause (bool p_locked=false)
 
void removeBomb (Bomb *bomb)
 
void removeBonus (Bonus *bonus)
 
void setGameScene (GameScene *p_gameScene)
 
void setSoundsEnabled (bool p_enabled)
 
void start ()
 
void switchPause ()
 
- 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
 

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 43 of file game.h.

Constructor & Destructor Documentation

Game::Game ( PlayerSettings *  playerSettings)

Creates a new Game instance.

Parameters
playerSettingsthe player settings

Definition at line 41 of file game.cpp.

Game::~Game ( )

Deletes the Game instance.

Definition at line 208 of file game.cpp.

Member Function Documentation

void Game::blockDestroyed ( const int  row,
const int  col,
Block *  block 
)

remove Block from list and decide to give bonus

Definition at line 739 of file game.cpp.

void Game::bombCreated ( Bomb *  bomb)
signal

Emitted when a bomb was created.

void Game::bombRemoved ( Bomb *  bomb)
signal

Emitted when a bomb was removed.

void Game::createBomb ( Player *  player,
qreal  x,
qreal  y,
bool  newBomb,
int  throwDistance 
)
slot

Creates a bomb in the Cell with the coordinates x and y or throws the bomb from that possition if the player has the throw bonus.

Parameters
playerthe player who dropped the bomb
xthe x-position where to put the bomb
ythe x-position where to put the bomb
newBombflag if a new bomb can be created or if only throwing is possible
throwDistancethe throw distance if the player has the throw bonus and the bomb shall be thrown

Definition at line 679 of file game.cpp.

void Game::createBonus ( )

Create the hidden Bonuses.

Definition at line 336 of file game.cpp.

void Game::gameOver ( )
signal

Emitted when the Game is over.

void Game::gameStarted ( )
signal

Emitted when the Game is started.

Arena * Game::getArena ( ) const
Returns
the Arena instance

Definition at line 306 of file game.cpp.

QList< Bonus * > Game::getBonus ( ) const
Returns
the Bonus instance

Definition at line 331 of file game.cpp.

bool Game::getGameOver ( ) const
Returns
flag if the game is over

Definition at line 316 of file game.cpp.

QList< Player * > Game::getPlayers ( ) const
Returns
the Player models

Definition at line 291 of file game.cpp.

int Game::getRemainingTime ( ) const
Returns
the remaining round time

Definition at line 301 of file game.cpp.

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

Definition at line 296 of file game.cpp.

QString Game::getWinner ( ) const
Returns
the winner of the game

Definition at line 321 of file game.cpp.

int Game::getWinPoints ( ) const
Returns
the points needed to win the game

Definition at line 326 of file game.cpp.

void Game::infoChanged ( const Granatier::Info::Type  p_info)
signal

Emitted when something to display has changed.

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

Definition at line 311 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 452 of file game.cpp.

void Game::keyReleaseEvent ( QKeyEvent *  p_event)
slot

Manages the key release events.

Parameters
p_eventthe key release event

Definition at line 517 of file game.cpp.

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 257 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::removeBomb ( Bomb *  bomb)

Removes exploded bombs from the bomb list.

Definition at line 719 of file game.cpp.

void Game::removeBonus ( Bonus *  bonus)
Parameters
bonusthe Bonus to remove

Definition at line 417 of file game.cpp.

void Game::setGameScene ( GameScene *  p_gameScene)

Sets the games gamescene.

Parameters
p_gameScenethe gamescene

Definition at line 243 of file game.cpp.

void Game::setRoundFinished ( )
slot

Checks if the round has finished and set it finished.

Definition at line 637 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 427 of file game.cpp.

void Game::start ( )

Starts the Game.

Definition at line 248 of file game.cpp.

void Game::switchPause ( )

Pauses / unpauses the game.

Definition at line 273 of file game.cpp.


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:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

granatier

Skip menu "granatier"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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