2018-09-27 00:10:42 +03:00
|
|
|
#ifndef WORLD_H
|
|
|
|
#define WORLD_H
|
|
|
|
|
|
|
|
#define SPEEDWORLD 10
|
|
|
|
|
|
|
|
#include <QVector>
|
|
|
|
#include "itemworld.h"
|
|
|
|
#include "baseclass.h"
|
2018-10-11 00:04:52 +03:00
|
|
|
#include "utils.h"
|
|
|
|
#include "snake.h"
|
2018-09-27 00:10:42 +03:00
|
|
|
|
2018-09-30 16:26:06 +03:00
|
|
|
class World : public BaseClass
|
2018-09-27 00:10:42 +03:00
|
|
|
{
|
2018-10-11 00:04:52 +03:00
|
|
|
private:
|
|
|
|
|
|
|
|
Snake snake;
|
2018-09-27 00:10:42 +03:00
|
|
|
QVector<ItemWorld*> items;
|
2018-10-11 00:04:52 +03:00
|
|
|
double currentLong;
|
|
|
|
int endLong;
|
|
|
|
double spead;
|
2018-09-27 00:10:42 +03:00
|
|
|
QString background;
|
2018-10-11 18:09:35 +03:00
|
|
|
double speed;
|
|
|
|
qint64 time;
|
2018-10-11 00:04:52 +03:00
|
|
|
bool defiat = false;
|
2018-10-11 18:09:35 +03:00
|
|
|
WorldRules oldRules;
|
2018-10-11 00:04:52 +03:00
|
|
|
|
|
|
|
void clearItems();
|
|
|
|
|
2018-10-11 18:09:35 +03:00
|
|
|
void changeCountObjects(const QString &name, int count);
|
|
|
|
|
2018-09-27 00:10:42 +03:00
|
|
|
public:
|
|
|
|
World();
|
2018-10-11 00:04:52 +03:00
|
|
|
QMap<int, GuiObject*> init(const WorldRules &rules);
|
2018-09-27 00:10:42 +03:00
|
|
|
~World() override;
|
|
|
|
void render() override;
|
2018-10-11 18:09:35 +03:00
|
|
|
bool move();
|
2018-10-11 00:04:52 +03:00
|
|
|
bool isEnd();
|
2018-09-27 00:10:42 +03:00
|
|
|
const QVector<ItemWorld*>& getItems() const;
|
2018-10-11 00:04:52 +03:00
|
|
|
bool isDefiat() const;
|
2018-11-04 16:11:55 +03:00
|
|
|
WorldRules currentRules() const;
|
2018-09-27 00:10:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WORLD_H
|