Refactor into more modular architecture
This commit is contained in:
31
physics.h
Normal file
31
physics.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef PHYSICS_H
|
||||
#define PHYSICS_H
|
||||
|
||||
#include "maths.h"
|
||||
|
||||
typedef struct {
|
||||
vec2_t pos;
|
||||
mat2_t dir;
|
||||
vec2_t vel;
|
||||
float rot;
|
||||
float mass;
|
||||
} physics_t;
|
||||
|
||||
typedef struct {
|
||||
float dist, va, vb;
|
||||
vec2_t norm;
|
||||
} physics_sep_t;
|
||||
|
||||
void physics_init();
|
||||
void physics_update();
|
||||
|
||||
void physics_add(
|
||||
unsigned entity, vec2_t pos, mat2_t dir, vec2_t vel, float rot,
|
||||
float mass);
|
||||
physics_t *physics_get(unsigned entity);
|
||||
|
||||
void physics_escape(unsigned entity);
|
||||
physics_sep_t physics_separation(unsigned a, unsigned b);
|
||||
void physics_bounce(unsigned a, unsigned b, physics_sep_t sep);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user