• 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
element.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ELEMENT_H
19 #define ELEMENT_H
20 
21 #include <QObject>
22 
23 #include "maze.h"
24 
25 class Kapman;
26 
30 class Element : public QObject {
31 
32  Q_OBJECT
33 
34  public:
35 
37  enum Type {
38  KAPMAN = 0,
39  GHOST = 1,
40  PILL = 2,
41  ENERGYZER = 3,
42  BONUS = 4
43  };
44 
45  protected:
46 
48  Type m_type;
49 
51  qreal m_xInit;
52 
54  qreal m_yInit;
55 
57  qreal m_x;
58 
60  qreal m_y;
61 
63  Maze* m_maze;
64 
66  QString m_imageId;
67 
69  int m_points;
70 
71  public:
72 
79  Element(qreal p_x, qreal p_y, Maze* p_maze);
80 
84  ~Element();
85 
90  virtual void doActionOnCollision(Kapman* p_kapman);
91 
96  QString getImageId() const;
97 
102  int getPoints() const;
103 
108  Element::Type getType() const;
109 
114  void setImageId(const QString & p_imageId);
115 
120  qreal getX() const;
121 
126  qreal getY() const;
127 
132  void setX(qreal p_x);
133 
138  void setY(qreal p_y);
139 
144  void initCoordinate();
145 
146  signals:
147 
153  void moved(qreal p_x, qreal p_y);
154 };
155 
156 #endif
157 
Element::initCoordinate
void initCoordinate()
Initializes Element x-coordinate and y-coordinate with initial values.
Definition: element.cpp:66
Element::getPoints
int getPoints() const
Gets the value of the Element.
Definition: element.cpp:50
Element::setImageId
void setImageId(const QString &p_imageId)
Sets the Element image.
Definition: element.cpp:62
Element::m_x
qreal m_x
The Element current x-coordinate.
Definition: element.h:57
Element::m_y
qreal m_y
The Element current y-coordinate.
Definition: element.h:60
Element::getX
qreal getX() const
Gets the Element x-coordinate.
Definition: element.cpp:32
Element::setY
void setY(qreal p_y)
Sets the Element y-coordinate to the given value.
Definition: element.cpp:45
Element::m_points
int m_points
Points won when the Element is eaten.
Definition: element.h:69
Element::m_type
Type m_type
The Element type.
Definition: element.h:48
Element::getImageId
QString getImageId() const
Gets the path to the Element image.
Definition: element.cpp:58
Element::PILL
Definition: element.h:40
Element::GHOST
Definition: element.h:39
Element::setX
void setX(qreal p_x)
Sets the Element x-coordinate to the given value.
Definition: element.cpp:40
Element::m_xInit
qreal m_xInit
The Element initial x-coordinate.
Definition: element.h:51
Element::moved
void moved(qreal p_x, qreal p_y)
Emitted on Element move.
QObject
Element::doActionOnCollision
virtual void doActionOnCollision(Kapman *p_kapman)
Computes an action on a collision with the Kapman.
Definition: element.cpp:28
maze.h
Element::Type
Type
The Element possible types.
Definition: element.h:37
Element::~Element
~Element()
Deletes the Element instance.
Definition: element.cpp:25
QString
Element::Element
Element(qreal p_x, qreal p_y, Maze *p_maze)
Creates a new Element instance.
Definition: element.cpp:20
Element::m_imageId
QString m_imageId
The Id of the Element.
Definition: element.h:66
Element
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:30
Element::getY
qreal getY() const
Gets the Element y-coordinate.
Definition: element.cpp:36
Element::ENERGYZER
Definition: element.h:41
Element::m_yInit
qreal m_yInit
The Element initial y-coordinate.
Definition: element.h:54
Element::m_maze
Maze * m_maze
The Maze the Element is on.
Definition: element.h:63
Element::getType
Element::Type getType() const
Gets the type of the Element.
Definition: element.cpp:54
Element::KAPMAN
Definition: element.h:38
Kapman
This class represents the main character of the game.
Definition: kapman.h:26
Element::BONUS
Definition: element.h:42
Maze
This class represents the Maze of the game.
Definition: maze.h:31
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