36 lines
747 B
C++
36 lines
747 B
C++
|
#ifndef HOLESOME_MAP_SIMULATION_HPP
|
||
|
#define HOLESOME_MAP_SIMULATION_HPP
|
||
|
|
||
|
#include <memory>
|
||
|
#include <box2d/box2d.h>
|
||
|
#include <SFML/System/Vector2.hpp>
|
||
|
#include "../player/player.hpp"
|
||
|
#include "map_player.hpp"
|
||
|
|
||
|
class MapSimulation
|
||
|
{
|
||
|
public:
|
||
|
MapSimulation();
|
||
|
|
||
|
void updateSimulation();
|
||
|
|
||
|
void resetMap(sf::Vector2f worldMapSize);
|
||
|
|
||
|
static std::shared_ptr<MapSimulation> getInstance();
|
||
|
|
||
|
void addPlayer(Player *player);
|
||
|
|
||
|
|
||
|
private:
|
||
|
static inline std::shared_ptr<MapSimulation> singletonInstance = nullptr;
|
||
|
|
||
|
std::shared_ptr<b2World> world;
|
||
|
std::map<int, std::shared_ptr<MapPlayer>> mapPlayersById;
|
||
|
|
||
|
void constructSquareObstacle(float minX, float minY, float maxX, float maxY);
|
||
|
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif //HOLESOME_MAP_SIMULATION_HPP
|