• 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
gamescene.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 Alexandre Galinier <alex.galinier@hotmail.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 GAMESCENE_H
21 #define GAMESCENE_H
22 
23 #include "granatierglobals.h"
24 
25 #include <QGraphicsScene>
26 #include <QList>
27 #include <QHash>
28 #include <QMap>
29 
30 class Game;
31 class BlockItem;
32 class BonusItem;
33 class ArenaItem;
34 class Player;
35 class PlayerItem;
36 class Bomb;
37 class BombItem;
38 class BombExplosionItem;
39 class InfoOverlay;
40 class InfoSidebar;
41 class QTimer;
42 
43 class KGameRenderer;
44 class KGameRenderedItem;
45 class KgThemeProvider;
46 
50 class GameScene : public QGraphicsScene {
51 
52 Q_OBJECT
53 
54 private:
55 
57  QRectF m_minSize;
58 
60  Game* m_game;
61 
63  ArenaItem*** m_arenaItem;
64 
66  QList<PlayerItem*> m_playerItems;
67 
69  QHash<BombItem*, QList<BombExplosionItem*> > m_bombItems;
70  QList<Bomb*> m_tempBombList;
71 
73  BlockItem*** m_blockItems;
74 
76  BonusItem*** m_bonusItems;
77 
79  KGameRenderedItem* m_arenaBackground;
80 
82  InfoOverlay* m_infoOverlay;
83 
85  InfoSidebar* m_infoSidebar;
86 
88  QGraphicsTextItem* m_arenaNameLabel;
89 
91  QGraphicsTextItem* m_remainingTimeLabel;
92 
93  qreal m_SvgScaleFactor;
94 
96  KGameRenderer* m_rendererSelectedTheme;
97  KGameRenderer* m_rendererDefaultTheme;
98  KGameRenderer* m_rendererBackground;
99  KGameRenderer* m_rendererArenaItems;
100  KGameRenderer* m_rendererBonusItems;
101  KGameRenderer* m_rendererBombItems;
102  KGameRenderer* m_rendererScoreItems;
103  KGameRenderer* m_rendererInfoSidebar;
104  QMap <Player*, KGameRenderer*> m_mapRendererPlayerItems;
105  KgThemeProvider* m_themeProvider;
106  QTimer* m_backgroundResizeTimer;
107 
108 public:
109 
114  GameScene(Game* p_game, KgThemeProvider* p_themeProvider);
115 
119  ~GameScene();
120 
124  Game* getGame() const;
125 
129  void init();
130 
134  void initItemsWithGraphicsFromTheme();
135 
139  void cleanUp();
140 
144  void cleanUpItemsWithGraphicsFromTheme();
145 
149  void showScore();
150 
154  void resizeSprites(int delayForBackground = 0);
155 
161  KGameRenderer* renderer(Granatier::Element::Type type, Player* player = NULL);
162 
164  void setupThemeRenderer();
165 
166 private slots:
167 
171  void start();
172 
173  void themeChanged();
174 
178  void resizeBackground();
179 
185  void setPaused(const bool p_pause, const bool p_fromUser);
186 
190  void removeBlockItem(BlockItem* blockItem);
191 
195  void removeBonusItem(BonusItem* bonusItem);
196 
201  void updateInfo(const Granatier::Info::Type p_info);
202 
206  void createBombItem(Bomb* bomb);
207 
211  void removeBombItem(BombItem* bombItem);
212 
216  void bombDetonated(Bomb* bomb);
217 
221  void updateBombExplosionItemAnimation(BombItem* bombItem, int nFrame);
222 
223 signals:
224 
228  void resizeGraphics(qreal svgScaleFactor);
229 };
230 
231 #endif
232 
QGraphicsScene
GameScene::resizeGraphics
void resizeGraphics(qreal svgScaleFactor)
Signals that the graphics need an update.
GameScene::showScore
void showScore()
Shows the labels with the points.
Definition: gamescene.cpp:657
BombItem
This class is the graphical representation of a Bomb.
Definition: bombitem.h:31
QMap< Player *, KGameRenderer * >
GameScene::~GameScene
~GameScene()
Deletes the Game instance.
Definition: gamescene.cpp:492
InfoOverlay
This class the game info if paused or a round is over.
Definition: infooverlay.h:35
BonusItem
This class is the graphical representation of a Bonus.
Definition: bonusitem.h:30
GameScene::GameScene
GameScene(Game *p_game, KgThemeProvider *p_themeProvider)
Creates a new GameScene instance.
Definition: gamescene.cpp:51
GameScene::initItemsWithGraphicsFromTheme
void initItemsWithGraphicsFromTheme()
Initializes all items with graphics from the theme.
Definition: gamescene.cpp:271
QTimer
QHash
BombExplosionItem
This class is the graphical representation of a Bomb explosion.
Definition: bombexplosionitem.h:33
ArenaItem
This class is the graphical view of the Arena.
Definition: arenaitem.h:30
Game
This class manages the game main loop : it regularly checks the key press events, computes the charac...
Definition: game.h:43
Bomb
This class describes the common characteristics and behaviour of the bomb item.
Definition: bomb.h:30
granatierglobals.h
QGraphicsTextItem
Granatier::Info::Type
Type
Definition: granatierglobals.h:136
QList< PlayerItem * >
GameScene::getGame
Game * getGame() const
Definition: gamescene.cpp:714
BlockItem
This class is the graphical representation of a Block.
Definition: blockitem.h:30
Granatier::Element::Type
Type
Definition: granatierglobals.h:89
GameScene::resizeSprites
void resizeSprites(int delayForBackground=0)
Updates the sprites after a resize.
Definition: gamescene.cpp:662
QRectF
GameScene::renderer
KGameRenderer * renderer(Granatier::Element::Type type, Player *player=NULL)
Returns the renderer for the requestet Element Type.
Definition: gamescene.cpp:638
PlayerItem
This class manage the display of the Player.
Definition: playeritem.h:32
GameScene
This class contains all the Game elements to be drawn on the screen by the GameView instance...
Definition: gamescene.h:50
GameScene::init
void init()
Initializes class.
Definition: gamescene.cpp:205
KGameRenderedItem
InfoSidebar
This class represents the game sidebar with game information about the player.
Definition: infosidebar.h:53
GameScene::cleanUp
void cleanUp()
Cleans class.
Definition: gamescene.cpp:521
GameScene::cleanUpItemsWithGraphicsFromTheme
void cleanUpItemsWithGraphicsFromTheme()
Initializes all items with graphics from the theme.
Definition: gamescene.cpp:538
GameScene::setupThemeRenderer
void setupThemeRenderer()
setup the KGameRenderer for the selected theme and if necessary the default theme ...
Definition: gamescene.cpp:112
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