-
Notifications
You must be signed in to change notification settings - Fork 0
/
bodyofsnake.h
47 lines (38 loc) · 1.03 KB
/
bodyofsnake.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
*This class is meant to create objects that can be used as snake body
*/
#ifndef BODYOFSNAKE_H
#define BODYOFSNAKE_H
#include <QGraphicsRectItem>
#include <QBrush>
#include <QGraphicsPixmapItem>
class BodyOfSnake : public QGraphicsPixmapItem
{
public:
/**
* @brief BodyOfSnake this constructor creates a body part
* @param parent
*/
BodyOfSnake(QGraphicsItem *parent = NULL);
/**
* @brief BodyOfSnake creates body part at x,y
* @param x
* @param y
*/
BodyOfSnake(int x, int y);
/**
* @brief BodyOfSnake creates bodypart with custom pixmap
* @param pixMapPath
*/
BodyOfSnake(QString pixMapPath);
/**
* @brief testRect this creates a QRectF for collision purposes and is used
* instead of native QT boundingRect(). boundingRect() always starts at 0,0
* when created, which limits its use here.
* @return
*/
QRectF testRect() const;
private:
QPixmap *bodyImage;
};
#endif // BODYOFSNAKE_H