2021-11-30 21:29:18 -06:00
|
|
|
#ifndef TWODPHYSICS_H
|
|
|
|
#define TWODPHYSICS_H
|
|
|
|
|
2023-01-11 16:57:34 -06:00
|
|
|
#include "script.h"
|
2023-05-12 13:22:05 -05:00
|
|
|
#include <chipmunk/chipmunk.h>
|
2023-12-11 08:36:45 -06:00
|
|
|
#include "gameobject.h"
|
2023-05-24 20:45:50 -05:00
|
|
|
#include "render.h"
|
2023-11-30 10:47:59 -06:00
|
|
|
#include "transform.h"
|
2021-11-30 21:29:18 -06:00
|
|
|
|
|
|
|
extern cpSpace *space;
|
|
|
|
|
2024-01-14 10:24:31 -06:00
|
|
|
typedef struct constraint {
|
|
|
|
cpConstraint *c;
|
|
|
|
JSValue break_cb; /* function called when it is forcibly broken */
|
|
|
|
JSValue remove_cb; /* called when it is removed at all */
|
|
|
|
} constraint;
|
|
|
|
|
|
|
|
constraint *constraint_make(cpConstraint *c);
|
|
|
|
void constraint_break(constraint *constraint);
|
|
|
|
void constraint_free(constraint *constraint);
|
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
void phys2d_init();
|
|
|
|
void phys2d_update(float deltaT);
|
2023-12-11 08:36:45 -06:00
|
|
|
void phys2d_setup_handlers(gameobject *go);
|
2024-04-06 19:41:14 -05:00
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
#endif
|