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

kapman

  • sources
  • kde-4.14
  • kdegames
  • kapman
maze.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
3  * Copyright 2007-2008 Pierre-BenoĆ®t Besse <besse.pb@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef MAZE_H
20 #define MAZE_H
21 
22 #include "cell.h"
23 
24 #include <QObject>
25 #include <QList>
26 #include <QPoint>
27 
31 class Maze : public QObject {
32 
33  Q_OBJECT
34 
35  private:
36 
38  QPoint m_resurrectionCell;
39 
41  int m_nbRows;
42 
44  int m_nbColumns;
45 
47  Cell** m_cells;
48 
50  int m_totalNbElem;
51 
53  int m_nbElem;
54 
55  public:
56 
60  Maze();
61 
65  ~Maze();
66 
72  void init(const int p_nbRows, const int p_nbColumns);
73 
80  void setCellType(const int p_row, const int p_column, const Cell::Type p_type);
81 
88  void setCellElement(const int p_row, const int p_column, Element* p_element);
89 
94  void setResurrectionCell(QPoint p_resurrectionCell);
95 
99  void decrementNbElem();
100 
104  void resetNbElem();
105 
113  QList<QPoint> getPathToGhostCamp(const int p_row, const int p_column) const;
114 
121  Cell getCell(const int p_row, const int p_column) const;
122 
128  QPoint getCoords(Cell* p_cell) const;
129 
135  int getRowFromY(const qreal p_y) const;
136 
142  int getColFromX(const qreal p_x) const;
143 
148  int getNbColumns() const;
149 
154  int getNbRows() const;
155 
160  int getNbElem() const;
161 
166  int getTotalNbElem() const;
167 
172  QPoint getResurrectionCell() const;
173 
174  signals:
175 
179  void allElementsEaten();
180 };
181 
182 #endif
183 
Maze::init
void init(const int p_nbRows, const int p_nbColumns)
Creates the Maze matrix.
Definition: maze.cpp:36
Maze::getPathToGhostCamp
QList< QPoint > getPathToGhostCamp(const int p_row, const int p_column) const
Gets the path, as a list of Cell coordinates, to go to the Ghost camp from the Cell whose coordinates...
Definition: maze.cpp:80
Cell
This class represents a Cell of the Maze.
Definition: cell.h:28
Maze::getCell
Cell getCell(const int p_row, const int p_column) const
Gets the Cell at the given coordinates.
Definition: maze.cpp:180
Maze::getNbRows
int getNbRows() const
Gets the number of rows of the Maze.
Definition: maze.cpp:211
QPoint
Maze::Maze
Maze()
Creates a new Maze instance.
Definition: maze.cpp:25
Maze::decrementNbElem
void decrementNbElem()
Decrements the number of remaining Elements.
Definition: maze.cpp:69
Maze::setCellElement
void setCellElement(const int p_row, const int p_column, Element *p_element)
Sets the Element that is on the Cell whose coordinates are given in parameters.
Definition: maze.cpp:52
Maze::resetNbElem
void resetNbElem()
Resets the number of remaining Elements to the initial number.
Definition: maze.cpp:76
Maze::getCoords
QPoint getCoords(Cell *p_cell) const
Gets the coordinates of the given Cell as a QPoint.
Definition: maze.cpp:188
Maze::setResurrectionCell
void setResurrectionCell(QPoint p_resurrectionCell)
Sets the cell on witch the ghosts resurrect from prey state.
Definition: maze.cpp:63
cell.h
QObject
QList< QPoint >
Maze::getNbColumns
int getNbColumns() const
Gets the number of columns of the Maze.
Definition: maze.cpp:207
Element
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:30
Maze::setCellType
void setCellType(const int p_row, const int p_column, const Cell::Type p_type)
Sets the CellType of the Cell whose coordinates are given in parameters.
Definition: maze.cpp:45
Maze::~Maze
~Maze()
Deletes the Maze instance.
Definition: maze.cpp:29
Maze::getTotalNbElem
int getTotalNbElem() const
Gets the number of Elements initially on the Maze.
Definition: maze.cpp:219
Cell::Type
Type
The Cell possible types.
Definition: cell.h:36
Maze::getNbElem
int getNbElem() const
Gets the number of remaining Elements still on the Maze.
Definition: maze.cpp:215
Maze::allElementsEaten
void allElementsEaten()
Emitted when all the elements on the Maze have been eaten.
Maze::getRowFromY
int getRowFromY(const qreal p_y) const
Gets the row index corresponding to the given y-coordinate.
Definition: maze.cpp:199
Maze::getColFromX
int getColFromX(const qreal p_x) const
Gets the column index corresponding to the given x-coordinate.
Definition: maze.cpp:203
Maze
This class represents the Maze of the game.
Definition: maze.h:31
Maze::getResurrectionCell
QPoint getResurrectionCell() const
Gets the cell on witch the ghosts resurects.
Definition: maze.cpp:223
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