holesome/src/game/physics/holes/ground/collectable_sim_ground.hpp

43 lines
1.2 KiB
C++

#ifndef HOLESOME_COLLECTABLE_SIM_GROUND_HPP
#define HOLESOME_COLLECTABLE_SIM_GROUND_HPP
#include <vector>
#include <memory>
#include "collectable_sim_ground_segment.hpp"
#include "../layouts/depth_hole_layout.hpp"
class CollectableSimGround
{
public:
explicit CollectableSimGround(std::shared_ptr<b2World> world, float groundWidth = 1000);
void setGroundWidth(float width);
void createLayout(DepthHoleLayout &layout);
private:
std::vector<std::shared_ptr<CollectableSimGroundSegment>> segments;
std::shared_ptr<b2World> world;
std::vector<DepthHoleDescription> currentLayoutHoles;
float groundWidth;
struct SideSegments {
std::shared_ptr<CollectableSimGroundSegment> left;
std::shared_ptr<CollectableSimGroundSegment> right;
};
CollectableSimGround::SideSegments getOuterSegments();
void updateOuterSegmentsToWidth();
std::shared_ptr<CollectableSimGroundSegment> createSegment(float leftCorner, float rightCorner, std::shared_ptr<CollectableSimGroundSegment> segment = nullptr);
void closeAllHoles();
bool hasLayoutChanged(DepthHoleLayout &layout);
};
#endif //HOLESOME_COLLECTABLE_SIM_GROUND_HPP