#ifndef _SNAKE_H_ #define _SNAKE_H_ #include #include #include class QWidget; class QPaintEvent; class Snake; struct Cell; struct Ball; struct Paddle; class GameCore { private: QWidget *_widget; QTimer *_t; int _width, _height; QList _snakes; QList _balls; QList _paddles; int _deaths; qint64 _lastMeal; qint64 _lastPaddle; const Cell **_field; const Cell **_field2; public: const Cell *field(int x, int y) const { return _field[x + _width * y]; } void setField(int x, int y, const Cell *val); int width() const { return _width; } int height() const { return _height; } GameCore(QWidget *widget); virtual ~GameCore(); void paint(QPaintEvent *event); void addFood(); void scanDir(Snake *snake, int x, int y, const Cell* &what, int &dist); void addSnake(); void addBall(); void drawPaddleBorders(); void addBreakoutBlocks(); void checkPongGameOver(); void pauseAndResume(); }; #endif