I am not sure what You want to do. Maybe this way. But I think that snake's data should be separated from bitmap data.
struct Node
{
enum NodeType
{
Node = 0,
Tail,
Head
};
Node()
{
x = 0;
y = 0;
type = Node;
}
NodeType type;
int x;
int y;
};
{
Q_OBJECT
public:
Snake();
~Snake();
private:
QList<Node> snakeNodes;
};
struct Node
{
enum NodeType
{
Node = 0,
Tail,
Head
};
Node()
{
x = 0;
y = 0;
type = Node;
}
NodeType type;
int x;
int y;
};
class Snake: public QObject
{
Q_OBJECT
public:
Snake();
~Snake();
private:
QList<Node> snakeNodes;
QPixmap snakeNode;
QPixmap snakeTail;
QPixmap snakeHead;
};
To copy to clipboard, switch view to plain text mode
Bookmarks