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"
|
2019-02-19 16:07:38 +03:00
|
|
|
#include "snakeutils.h"
|
2018-10-11 00:04:52 +03:00
|
|
|
#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-11-28 22:17:30 +03:00
|
|
|
QMultiMap<QString, ItemWorld*> items;
|
2018-11-25 03:24:41 +03:00
|
|
|
double currentLong = 0;
|
2018-10-11 00:04:52 +03:00
|
|
|
int endLong;
|
2018-11-25 03:24:41 +03:00
|
|
|
double spead = 0, d_spead = 0;
|
2018-09-27 00:10:42 +03:00
|
|
|
QString background;
|
2018-10-11 18:09:35 +03:00
|
|
|
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-11-25 03:24:41 +03:00
|
|
|
void clear();
|
2018-11-28 22:17:30 +03:00
|
|
|
QMap<int, GuiObject*> init(WorldRules rules);
|
2018-09-27 00:10:42 +03:00
|
|
|
~World() override;
|
|
|
|
void render() override;
|
2018-11-25 18:10:08 +03:00
|
|
|
void resetPosition();
|
2018-10-11 18:09:35 +03:00
|
|
|
bool move();
|
2018-10-11 00:04:52 +03:00
|
|
|
bool isEnd();
|
|
|
|
bool isDefiat() const;
|
2018-11-04 16:11:55 +03:00
|
|
|
WorldRules currentRules() const;
|
2018-11-16 02:08:35 +03:00
|
|
|
void reversClick();
|
2018-11-25 03:24:41 +03:00
|
|
|
double getCurrentLong() const;
|
2018-11-28 22:17:30 +03:00
|
|
|
QMultiMap<QString, ItemWorld *> getItems() const;
|
2018-12-01 22:39:03 +03:00
|
|
|
void unPause();
|
2018-09-27 00:10:42 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WORLD_H
|