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

44 lines
1.2 KiB
C++
Raw Normal View History

#ifndef HOLESOME_COLLECTABLE_SIM_GROUND_HPP
#define HOLESOME_COLLECTABLE_SIM_GROUND_HPP
#include <vector>
#include <memory>
#include "collectable_sim_ground_segment.hpp"
2023-07-05 01:06:57 +02:00
#include "../layouts/depth_hole_layout.hpp"
class CollectableSimGround
{
public:
2023-07-05 01:06:57 +02:00
explicit CollectableSimGround(std::shared_ptr<b2World> world, float groundWidth = 1000);
void setGroundWidth(float width);
2023-07-05 01:06:57 +02:00
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();
2023-07-05 01:06:57 +02:00
std::shared_ptr<CollectableSimGroundSegment> createSegment(float leftCorner, float rightCorner, std::shared_ptr<CollectableSimGroundSegment> segment = nullptr);
2023-07-05 01:06:57 +02:00
void closeAllHoles();
bool hasLayoutChanged(DepthHoleLayout &layout);
};
#endif //HOLESOME_COLLECTABLE_SIM_GROUND_HPP