File indexing completed on 2024-04-21 04:01:57

0001 /*
0002     SPDX-FileCopyrightText: 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
0003     SPDX-FileCopyrightText: 2007-2008 Pierre-Benoit Besse <besse.pb@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef GHOSTITEM_H
0009 #define GHOSTITEM_H
0010 
0011 #include "characteritem.h"
0012 #include "ghost.h"
0013 
0014 /**
0015  * @brief This class is the graphical representation of a Ghost.
0016  */
0017 class GhostItem : public CharacterItem
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     /**
0023      * Creates a new GhostItem instance.
0024      * @param p_model the Ghost model
0025      */
0026     explicit GhostItem(Ghost *p_model);
0027 
0028     /**
0029      * Deletes the CharacterItem instance.
0030      */
0031     ~GhostItem() override;
0032 
0033     /**
0034      * Ensures the blink timers are correctly set
0035      */
0036     void updateBlinkTimersDuration();
0037 
0038 public Q_SLOTS:
0039 
0040     /**
0041      * Updates the view coordinates.
0042      * @param p_x the new x-coordinate
0043      * @param p_y the new y-coordinate
0044      */
0045     void update(qreal p_x, qreal p_y) override;
0046 
0047     /**
0048      * Update the image function of the Ghost state.
0049      */
0050     void updateState();
0051 
0052     /**
0053      * Implements the CharacterItem method.
0054      */
0055     void blink() override;
0056 };
0057 
0058 #endif