submarine.h Example File
animation/sub-attaq/submarine.h
#ifndef __SUBMARINE__H__
#define __SUBMARINE__H__
#include <QtWidgets/QGraphicsTransform>
#include "pixmapitem.h"
class Torpedo;
class SubMarine : public PixmapItem
{
Q_OBJECT
public:
enum Movement {
None = 0,
Left,
Right
};
enum { Type = UserType + 1 };
SubMarine(int type, const QString &name, int points);
int points() const;
void setCurrentDirection(Movement direction);
enum Movement currentDirection() const;
void setCurrentSpeed(int speed);
int currentSpeed() const;
void launchTorpedo(int speed);
void destroy();
int type() const override;
QGraphicsRotation *rotation() const { return graphicsRotation; }
signals:
void subMarineDestroyed();
void subMarineExecutionFinished();
void subMarineStateChanged();
private:
int subType;
QString subName;
int subPoints;
int speed;
Movement direction;
QGraphicsRotation *graphicsRotation;
};
#endif //__SUBMARINE__H__