File indexing completed on 2024-05-19 04:04:51

0001 /*
0002     This file is part of Killbots.
0003 
0004     SPDX-FileCopyrightText: 2006-2009 Parker Coates <coates@kde.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef KILLBOTS_SPRITE_H
0010 #define KILLBOTS_SPRITE_H
0011 
0012 #include <KGameRenderedItem>
0013 
0014 namespace Killbots
0015 {
0016 enum SpriteType {
0017     NoSprite,
0018     Junkheap,
0019     Hero,
0020     Robot,
0021     Fastbot
0022 };
0023 
0024 class Sprite : public KGameRenderedItem
0025 {
0026 public: // types
0027     enum {
0028         Type = UserType + 1
0029     };
0030 
0031 public: // functions
0032     explicit Sprite();
0033     virtual ~Sprite() override;
0034 
0035     SpriteType spriteType() const;
0036     void setSpriteType(SpriteType type);
0037 
0038     void enqueueGridPos(QPoint position);
0039     QPoint currentGridPos() const;
0040     QPoint nextGridPos() const;
0041     QPoint gridPos() const;
0042     void advanceGridPosQueue();
0043 
0044     int type() const override;
0045 
0046 protected:
0047     void receivePixmap(const QPixmap &pixmap) override;
0048 
0049 private: // data members
0050     SpriteType m_type;
0051     QList<QPoint> m_gridPositions;
0052 };
0053 }
0054 
0055 #endif