1/*
2 * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
3 * Copyright 2007-2008 Pierre-Benoit Besse <besse.pb@gmail.com>
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 GHOSTITEM_H
20#define GHOSTITEM_H
21
22#include "characteritem.h"
23#include "ghost.h"
24
25/**
26 * @brief This class is the graphical representation of a Ghost.
27 */
28class GhostItem : public CharacterItem {
29
30 Q_OBJECT
31
32 private:
33
34 /** Timer to start the ghosts blinking */
35 QTimer* m_startBlinkingTimer;
36
37 public:
38
39 /**
40 * Creates a new GhostItem instance.
41 * @param p_model the Ghost model
42 */
43 GhostItem(Ghost* p_model);
44
45 /**
46 * Deletes the CharacterItem instance.
47 */
48 ~GhostItem();
49
50 /**
51 * Ensures the blink timers are correctly set
52 */
53 void updateBlinkTimersDuration();
54
55 public slots:
56
57 /**
58 * Updates the view coordinates.
59 * @param p_x the new x-coordinate
60 * @param p_y the new y-coordinate
61 */
62 void update(qreal p_x, qreal p_y);
63
64 /**
65 * Update the image function of the Ghost state.
66 */
67 void updateState();
68
69 /**
70 * Implements the CharacterItem method.
71 */
72 void blink();
73};
74
75#endif
76
77