mirror of https://github.com/bjornbytes/lovr.git
32 lines
566 B
C
32 lines
566 B
C
#include "physics.h"
|
|
#include <stdlib.h>
|
|
|
|
void lovrPhysicsInit() {
|
|
dInitODE();
|
|
|
|
if (!dCheckConfiguration("ODE_single_precision")) {
|
|
error("lovr.physics must use single precision");
|
|
}
|
|
|
|
atexit(lovrPhysicsDestroy);
|
|
}
|
|
|
|
void lovrPhysicsDestroy() {
|
|
dCloseODE();
|
|
}
|
|
|
|
World* lovrWorldCreate() {
|
|
World* world = lovrAlloc(sizeof(World), lovrWorldDestroy);
|
|
if (!world) return NULL;
|
|
|
|
world->id = dWorldCreate();
|
|
|
|
return world;
|
|
}
|
|
|
|
void lovrWorldDestroy(const Ref* ref) {
|
|
World* world = containerof(ref, World);
|
|
dWorldDestroy(world->id);
|
|
free(world);
|
|
}
|