SVN_SILENT made messages (.desktop file)
[kdegames.git] / kapman / gameview.h
bloba4969acaf0f6f6c970791540c5fb78e46113c1f7
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.
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/>.
18 #ifndef GAMEVIEW_H
19 #define GAMEVIEW_H
21 #include "game.h"
23 #include <QGraphicsView>
24 #include <QKeyEvent>
26 /**
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 {
32 Q_OBJECT
34 public:
36 /**
37 * Creates a new GameView instance.
38 * @param p_game the Game instance whose elements have to be drawn
40 GameView(Game* p_game);
42 /**
43 * Deletes the GameView instance.
45 ~GameView();
47 /**
48 * Resizes the items when the view is resized.
49 * @param p_event the resize event
51 void resizeEvent(QResizeEvent* p_event);
53 protected:
55 /**
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);
61 /**
62 * Pauses the game on focus lost.
63 * @param p_event the focus event
65 void focusOutEvent(QFocusEvent* p_event);
67 signals:
69 /**
70 * Emitted on key press event for the Game instance
71 * @param p_event the key press event
73 void keyPressed(QKeyEvent* p_event);
76 #endif