diff options
Diffstat (limited to 'src/physics.h')
| -rw-r--r-- | src/physics.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/physics.h b/src/physics.h index b1fef97..10148c1 100644 --- a/src/physics.h +++ b/src/physics.h @@ -3,25 +3,36 @@ #define PHYSICS_H #include <raylib.h> +#include <time.h> #include "common.h" +typedef enum { + SHAPE_CIRCLE, + SHAPE_SQUARE, + SHAPE_RECTANGLE +} shape_t; + typedef struct { - shape_t type; - Vec2d pos; - Vec2d vel; - Vec2d acc; - float width; - float height; Color color; + Vector2 elast; +// Vector2 force; + Vector2 frict; + Vector2 pos; + Vector2 pos_prev; + Vector2 vel; + bool grabbed; + bool registered; + float mass; + float size_x; + float size_y; + shape_t obj_type; } object_t; -typedef sturct { - object_t* object_arr; - u16 object_count; - size_t capacity; -} world_t; +void init_physics(object_t* world, uint32_t max_objs); +void update_physics(object_t* world, uint32_t objs_count, float gravity, float damping); +void apply_force(object_t* obj, Vector2 force); +void add_object(object_t* world, uint32_t* count, object_type_t type, Vector2 pos); +void clear_all_physics(object_t* world, uint32_t* count); +void push_pos(object_t* world, uint32_t count, Vector2 pos, float radius, float strength); -void register_new_object(world_t* world, u32 object_x, u32 object_y); -void delete_object(world_t* world); -void clear_scene(world_t* world); #endif // PHYSICS_H |
