hydrangea/include/physics/dynamic_body.h
2024-07-31 00:06:54 -05:00

33 lines
624 B
C++

#include "nodes/node.h"
#include "box2d/b2_body.h"
#include "box2d/b2_polygon_shape.h"
#include "box2d/b2_fixture.h"
#ifndef HYDRANGEA_DYNAMIC_BODY_H
#define HYDRANGEA_DYNAMIC_BODY_H
class DynamicBody : public Node {
public:
explicit DynamicBody(float size_x = 10.0f, float size_y = 10.0f);
~DynamicBody();
void update() override;
void render();
void SetWorldPosition(float pos_x, float pos_y);
Vec2 size;
float friction;
float density;
private:
b2BodyDef bBodyDef;
b2Body *bBody;
b2PolygonShape bShape;
b2FixtureDef bFixtureDef;
};
#endif //HYDRANGEA_DYNAMIC_BODY_H