mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-27 18:24:41 +00:00
53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
#ifndef SNAKE_H
|
|
#define SNAKE_H
|
|
|
|
#define SPEEDSNAKE 10
|
|
|
|
#include <QVector>
|
|
#include "head.h"
|
|
#include "baseclass.h"
|
|
|
|
class GuiObject;
|
|
|
|
|
|
|
|
class Snake : public BaseClass
|
|
{
|
|
private:
|
|
double rataticonDistance = 1;
|
|
QVector<Head*> items;
|
|
double *speed = nullptr;
|
|
bool isClick = false;
|
|
int countClick = 0;
|
|
bool dead = false;
|
|
double sizeByLvl(double lvl, int count) const;
|
|
void changeCountObjects(int count);
|
|
|
|
double checDistance(int i);
|
|
void clearItems();
|
|
|
|
|
|
public:
|
|
Snake();
|
|
~Snake() override;
|
|
void clear();
|
|
void resetPosotion();
|
|
|
|
void kill();
|
|
bool isDead() const;
|
|
|
|
void reverse();
|
|
void render() override;
|
|
QMap<int, GuiObject *> init(int size, double *speed);
|
|
bool isInited() const;
|
|
const QVector<Head*>& getItems() const;
|
|
double getMovedLong() const;
|
|
double getRataticonDistance() const;
|
|
void setRataticonDistance(double value);
|
|
int getDeadTimer() const;
|
|
void setDeadTimer(int value);
|
|
void unPause();
|
|
};
|
|
|
|
#endif // SNAKE_H
|