summaryrefslogtreecommitdiff
path: root/include/physics.h
diff options
context:
space:
mode:
authoresquizo <esquizo+noreply@esquizo.net>2026-05-17 16:48:20 -0300
committeresquizo <esquizo+noreply@esquizo.net>2026-05-17 16:48:20 -0300
commitdf8e49f5019b6f33a30d4c9372a18d8d372d6af2 (patch)
treed8ddd5854a75e8194e74ce905e24202a62c6aa9e /include/physics.h
parentca457b3d0ed3dc6309e46633a2b467e3f9261753 (diff)
libphysics: mudada a interface publica para um id ao invés de um ponteiro
Isso aumenta a portabilidade e facilita appendage de userdata sem necessariamente alterar o sistema principal
Diffstat (limited to 'include/physics.h')
-rw-r--r--include/physics.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/include/physics.h b/include/physics.h
index 8a43915..5c4f377 100644
--- a/include/physics.h
+++ b/include/physics.h
@@ -1,3 +1,5 @@
+typedef int BodyID;
+
typedef enum {
BTYPE_AABB,
BTYPE_TILEMAP,
@@ -5,21 +7,21 @@ typedef enum {
typedef struct Body Body;
typedef struct CollisionEvent {
- Body *body1;
- Body *body2;
+ BodyID body1;
+ BodyID body2;
} CollisionEvent;
-Body *phxnew(BodyType type);
-void phxdel(Body *);
+BodyID phxnew(BodyType type);
+void phxdel(BodyID);
void phxsetmap(int w, int h, int *tiles);
-void phxsetpos(Body *, float x, float y);
-void phxsetsize(Body *, float w, float h);
-void phxapplyaccel(Body *, float f[2]);
+void phxsetpos(BodyID, float x, float y);
+void phxsetsize(BodyID, float w, float h);
+void phxapplyaccel(BodyID, float f[2]);
-void phxgetpos(Body *, float pos[2]);
-void phxgetsize(Body *, float size[2]);
+void phxgetpos(BodyID, float pos[2]);
+void phxgetsize(BodyID, float size[2]);
int phxnextcollevent(CollisionEvent *ev);
void phxtick(float delta);