2 * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
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.
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.
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/>.
23 #include <QGraphicsView>
27 * @brief This class manages the drawing of each element of the Game instance.
28 * It creates a GameScene instance associated to the given Game instance in order to manage the elements to be drawn at each moment of the game.
30 class GameView
: public QGraphicsView
{
37 * Creates a new GameView instance.
38 * @param p_game the Game instance whose elements have to be drawn
40 GameView(Game
* p_game
);
43 * Deletes the GameView instance.
48 * Resizes the items when the view is resized.
49 * @param p_event the resize event
51 void resizeEvent(QResizeEvent
* p_event
);
56 * Manages the player actions by hanlding the key press events.
57 * @param p_event the key press event
59 void keyPressEvent(QKeyEvent
* p_event
);
62 * Pauses the game on focus lost.
63 * @param p_event the focus event
65 void focusOutEvent(QFocusEvent
* p_event
);
70 * Emitted on key press event for the Game instance
71 * @param p_event the key press event
73 void keyPressed(QKeyEvent
* p_event
);