• 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.cpp
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 #include "element.h"
19 
20 Element::Element(qreal p_x, qreal p_y, Maze* p_maze) : m_xInit(p_x), m_yInit(p_y), m_maze(p_maze) {
21  m_points = 0;
22  initCoordinate();
23 }
24 
25 Element::~Element() {
26 }
27 
28 void Element::doActionOnCollision(Kapman*) {
29  // Do nothing by default : will be redefined within the subclasses
30 }
31 
32 qreal Element::getX() const {
33  return m_x;
34 }
35 
36 qreal Element::getY() const {
37  return m_y;
38 }
39 
40 void Element::setX(qreal p_x) {
41  m_x = p_x;
42  emit(moved(m_x, m_y));
43 }
44 
45 void Element::setY(qreal p_y) {
46  m_y = p_y;
47  emit(moved(m_x, m_y));
48 }
49 
50 int Element::getPoints() const {
51  return m_points;
52 }
53 
54 Element::Type Element::getType() const {
55  return m_type;
56 }
57 
58 QString Element::getImageId() const {
59  return m_imageId;
60 }
61 
62 void Element::setImageId(const QString & p_imageId){
63  m_imageId = p_imageId;
64 }
65 
66 void Element::initCoordinate(){
67  setX(m_xInit);
68  setY(m_yInit);
69 }
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.h
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::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.
Element::doActionOnCollision
virtual void doActionOnCollision(Kapman *p_kapman)
Computes an action on a collision with the Kapman.
Definition: element.cpp:28
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::getY
qreal getY() const
Gets the Element y-coordinate.
Definition: element.cpp:36
Element::m_yInit
qreal m_yInit
The Element initial y-coordinate.
Definition: element.h:54
Element::getType
Element::Type getType() const
Gets the type of the Element.
Definition: element.cpp:54
Kapman
This class represents the main character of the game.
Definition: kapman.h:26
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