spacebox/demo/2d_collision/CollisionTest.hpp

43 lines
875 B
C++

#ifndef CollisionTest_h_
#define CollisionTest_h_
#include "Game.hpp"
#include "Sprite.hpp"
#include "Pixels.hpp"
#include "Color.hpp"
#include "extension.hpp"
class CollisionTest : public Game
{
private:
Sprite wooper = Sprite(this, "wooper.png");
Sprite enemy = Sprite(this, "wooper.png");
SDL_Texture* canvas;
std::vector<Box> boxes = {
{{50, 20}, {20, 10}},
{{300, 100}, {50, 60}},
{{160, 300}, {30, 10}},
};
std::vector<Segment> segments = {
{{5, 50}, {15, 90}},
{{250, 250}, {200, 240}}
};
std::vector<glm::vec2> points = {{100, 300}, {205, 20}, {450, 300}};
bool collide_all = false;
bool collide_all_other = false;
bool precise = false;
void test_crop(const std::vector<Box>&);
void respond(SDL_Event&);
void update();
public:
CollisionTest();
};
#endif