summaryrefslogtreecommitdiffstats
path: root/src/snake.h
blob: 937757510f5a1461563f77f3c590fe6684034de8 (plain) (blame)
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
#ifndef _SNAKE_H_
#define _SNAKE_H_

#include <QList>
#include <QPoint>

class QWidget;
class QPaintEvent;

class RealSnake;

struct Cell;

class Snake
{
private:
	QWidget *_widget;
    const Cell **_field;
    int _width, _height;
    QList<RealSnake*> _snakes;
    int _deaths;
    qint64 _lastMeal;

public:
    Snake(QWidget *widget);

    virtual ~Snake();

    void paint(QPaintEvent *event);

    void addFood();

    void scanDir(RealSnake *snake, int x, int y, const Cell* &what, int &dist);

    void addSnake();

    void initField();
};

#endif