diff options
Diffstat (limited to 'physics.c')
| -rw-r--r-- | physics.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/physics.c b/physics.c new file mode 100644 index 0000000..53a895d --- /dev/null +++ b/physics.c @@ -0,0 +1,40 @@ +#include "physics.h" + +PhysicsInfo physics = {0}; + +void +physics_init(void) { + physics.world_def = b3DefaultWorldDef(); + physics.world_id = b3CreateWorld(&physics.world_def); + physics.simulate = false; +} + +void +physics_exit(void) { + if (b3World_IsValid(physics.world_id)) { + b3DestroyWorld(physics.world_id); + } + + physics.world_id = b3_nullWorldId; +} + +void +physics_update(void) { + if (!physics.simulate) { + return; + } + + // TODO: timestep is temporary, should be global value + b3World_Step(physics.world_id, 1.0f / 60.0f, 4); +} + +// PhysicsObject +// physics_obj_create_def(void) { +// PhysicsObject obj = {0}; +// return obj; +// } + +// void +// physics_obj_delete(PhysicsObject* phys) { + +// } |
