• 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
element.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  *
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 ELEMENT_H
20 #define ELEMENT_H
21 
22 #include "granatierglobals.h"
23 
24 #include <QObject>
25 
26 class Arena;
27 class Player;
28 
32 class Element : public QObject {
33 
34 Q_OBJECT
35 
36 protected:
37 
39  Granatier::Element::Type m_type;
40 
42  qreal m_xInit;
43 
45  qreal m_yInit;
46 
48  qreal m_x;
49 
51  qreal m_y;
52 
54  Arena* m_arena;
55 
57  QString m_imageId;
58 
59 public:
60 
67  Element(qreal p_x, qreal p_y, Arena* p_arena);
68 
72  ~Element();
73 
78  virtual void doActionOnCollision(Player* p_player);
79 
84  void setArena(Arena* p_arena);
85 
90  void setInitialCoordinates (qreal p_x, qreal p_y);
91 
96  QString getImageId() const;
97 
102  Granatier::Element::Type getType() const;
103 
108  void setImageId(const QString & p_imageId);
109 
114  qreal getX() const;
115 
120  qreal getY() const;
121 
126  void setX(qreal p_x);
127 
132  void setY(qreal p_y);
133 
138  void initCoordinate();
139 
140 signals:
141 
147  void moved(qreal p_x, qreal p_y);
148 };
149 
150 #endif
151 
Element::initCoordinate
void initCoordinate()
Initializes Element x-coordinate and y-coordinate with initial values.
Definition: element.cpp:83
Element::setImageId
void setImageId(const QString &p_imageId)
Sets the Element image.
Definition: element.cpp:78
Element::m_type
Granatier::Element::Type m_type
The Element type.
Definition: element.h:39
Element::m_x
qreal m_x
The Element current x-coordinate.
Definition: element.h:48
Element::m_y
qreal m_y
The Element current y-coordinate.
Definition: element.h:51
Element::getX
qreal getX() const
Gets the Element x-coordinate.
Definition: element.cpp:46
Element::setY
void setY(qreal p_y)
Sets the Element y-coordinate to the given value.
Definition: element.cpp:62
Element::getImageId
QString getImageId() const
Gets the path to the Element image.
Definition: element.cpp:73
Element::getType
Granatier::Element::Type getType() const
Gets the type of the Element.
Definition: element.cpp:68
Element::setArena
void setArena(Arena *p_arena)
Sets arena for the element.
Definition: element.cpp:35
Element::setX
void setX(qreal p_x)
Sets the Element x-coordinate to the given value.
Definition: element.cpp:56
Element::m_xInit
qreal m_xInit
The Element initial x-coordinate.
Definition: element.h:42
Element::moved
void moved(qreal p_x, qreal p_y)
Emitted on Element move.
Element::m_arena
Arena * m_arena
The Arena the Element is on.
Definition: element.h:54
QObject
Element::setInitialCoordinates
void setInitialCoordinates(qreal p_x, qreal p_y)
Sets the path initial position.
Definition: element.cpp:40
Element::Element
Element(qreal p_x, qreal p_y, Arena *p_arena)
Creates a new Element instance.
Definition: element.cpp:21
Element::doActionOnCollision
virtual void doActionOnCollision(Player *p_player)
Computes an action on a collision with the Player.
Definition: element.cpp:30
granatierglobals.h
Element::~Element
~Element()
Deletes the Element instance.
Definition: element.cpp:26
Arena
This class represents the Arena of the game.
Definition: arena.h:36
QString
Element::m_imageId
QString m_imageId
The Id of the Element.
Definition: element.h:57
Granatier::Element::Type
Type
Definition: granatierglobals.h:89
Element
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:32
Element::getY
qreal getY() const
Gets the Element y-coordinate.
Definition: element.cpp:51
Element::m_yInit
qreal m_yInit
The Element initial y-coordinate.
Definition: element.h:45
Player
This class represents the main character of the game.
Definition: player.h:33
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