File indexing completed on 2024-10-13 03:43:43
0001 /* 0002 SPDX-FileCopyrightText: 2006 Mauricio Piacentini <mauricio@tabuleiro.com> 0003 SPDX-FileCopyrightText: 2009 Ian Wadham <iandw.au@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KGRSPRITE_H 0009 #define KGRSPRITE_H 0010 0011 0012 #include <KGameRenderedItem> 0013 0014 0015 class KGrSprite : public KGameRenderedItem 0016 { 0017 public: 0018 explicit KGrSprite (KGameRenderer * renderer, QString & key, 0019 const char type, const int tickTime = 20); 0020 ~KGrSprite() override; 0021 0022 inline char spriteType () { return m_type; } 0023 inline QPointF currentLoc () { return QPointF (m_x, m_y); } 0024 inline int currentFrame () { return frame(); } 0025 inline void setZ (qreal z) { setZValue(z); } 0026 0027 void move (double x, double y, int frame); 0028 void animate (bool missed); 0029 void setAnimation (bool repeating, int x, int y, int startFrame, 0030 int nFrames, int dx, int dy, int dt, 0031 int nFrameChanges); 0032 void setCoordinateSystem (int topLeftX, int topLeftY, int tileSize); 0033 void changeCoordinateSystem (int topLeftX, int topLeftY, int tileSize); 0034 0035 private: 0036 char m_type; 0037 char m_tickTime; 0038 bool m_stationary; 0039 bool m_repeating; 0040 double m_x; 0041 double m_y; 0042 int m_startFrame; 0043 int m_nFrames; 0044 int m_frameCtr; 0045 double m_dx; 0046 double m_dy; 0047 int m_dt; 0048 int m_nFrameChanges; 0049 int m_ticks; 0050 double m_frameTicks; 0051 double m_frameChange; 0052 double m_oldX; 0053 double m_oldY; 0054 int m_oldFrame; 0055 0056 int m_topLeftX; 0057 int m_topLeftY; 0058 int m_tileSize; 0059 }; 0060 0061 #endif // KGRSPRITE_H