From df8e49f5019b6f33a30d4c9372a18d8d372d6af2 Mon Sep 17 00:00:00 2001 From: esquizo Date: Sun, 17 May 2026 16:48:20 -0300 Subject: libphysics: mudada a interface publica para um id ao invés de um ponteiro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Isso aumenta a portabilidade e facilita appendage de userdata sem necessariamente alterar o sistema principal --- include/physics.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'include/physics.h') 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); -- cgit v1.2.3