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

granatier

  • sources
  • kde-4.14
  • kdegames
  • granatier
  • src
arena.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Mathias Kraus <k.hias@gmx.de>
3  * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
4  * Copyright 2007-2008 Pierre-BenoĆ®t Besse <besse.pb@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef ARENA_H
21 #define ARENA_H
22 
23 #include <QObject>
24 
25 #include "cell.h"
26 
27 #include <QList>
28 
29 class QPoint;
30 class QPointF;
31 class QString;
32 
36 class Arena : public QObject
37 {
38  Q_OBJECT
39 
40 private:
42  QString m_strArenaName;
43 
45  int m_nbRows;
46 
48  int m_nbColumns;
49 
51  Cell** m_cells;
52 
54  Cell m_emptyCell;
55 
57  QList <QPointF> m_playerPosition;
58 
59 public:
60 
64  Arena();
65 
69  ~Arena();
70 
76  void init(const int p_nbRows, const int p_nbColumns);
77 
82  QString getName () const;
83 
88  void setName (const QString &p_strArenaName);
89 
96  void setCellType(const int p_row, const int p_column, const Granatier::Cell::Type p_type);
97 
104  void setCellElement(const int p_row, const int p_column, Element* p_element);
105 
112  void removeCellElement(const int p_row, const int p_column, Element* p_element);
113 
118  void addPlayerPosition(const QPointF &p_position);
119 
125  QPointF getPlayerPosition(int p_player) const;
126 
133  Cell getCell(const int p_row, const int p_column) const;
134 
140  QPoint getCoords(Cell* p_cell) const;
141 
147  int getRowFromY(const qreal p_y) const;
148 
154  int getColFromX(const qreal p_x) const;
155 
160  int getNbColumns() const;
161 
166  int getNbRows() const;
167 };
168 
169 #endif
Cell
This class represents a Cell of the Arena.
Definition: cell.h:29
Arena::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: arena.cpp:72
Arena::getNbColumns
int getNbColumns() const
Gets the number of columns of the Arena.
Definition: arena.cpp:164
QPoint
Arena::removeCellElement
void removeCellElement(const int p_row, const int p_column, Element *p_element)
Removes the Element that is on the Cell whose coordinates are given in parameters.
Definition: arena.cpp:81
QPointF
cell.h
Arena::init
void init(const int p_nbRows, const int p_nbColumns)
Creates the Arena matrix.
Definition: arena.cpp:40
QObject
Arena::Arena
Arena()
Creates a new Arena instance.
Definition: arena.cpp:27
Arena::setName
void setName(const QString &p_strArenaName)
Sets the Arena name.
Definition: arena.cpp:58
Arena::~Arena
~Arena()
Deletes the Arena instance.
Definition: arena.cpp:31
Arena
This class represents the Arena of the game.
Definition: arena.h:36
QString
QList< QPointF >
Arena::getCoords
QPoint getCoords(Cell *p_cell) const
Gets the coordinates of the given Cell as a QPoint.
Definition: arena.cpp:129
Element
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:32
Arena::getName
QString getName() const
Returns the Arean name.
Definition: arena.cpp:53
Arena::addPlayerPosition
void addPlayerPosition(const QPointF &p_position)
Sets a player position on the arena.
Definition: arena.cpp:90
Arena::getPlayerPosition
QPointF getPlayerPosition(int p_player) const
Gets the player position on the arena.
Definition: arena.cpp:111
Granatier::Cell::Type
Type
Definition: granatierglobals.h:71
Arena::getColFromX
int getColFromX(const qreal p_x) const
Gets the column index corresponding to the given x-coordinate.
Definition: arena.cpp:154
Arena::setCellType
void setCellType(const int p_row, const int p_column, const Granatier::Cell::Type p_type)
Sets the CellType of the Cell whose coordinates are given in parameters.
Definition: arena.cpp:63
Arena::getNbRows
int getNbRows() const
Gets the number of rows of the Arena.
Definition: arena.cpp:169
Arena::getCell
Cell getCell(const int p_row, const int p_column) const
Gets the Cell at the given coordinates.
Definition: arena.cpp:120
Arena::getRowFromY
int getRowFromY(const qreal p_y) const
Gets the row index corresponding to the given y-coordinate.
Definition: arena.cpp:144
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