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 --- libphysics/test/vis.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libphysics/test/vis.c') diff --git a/libphysics/test/vis.c b/libphysics/test/vis.c index 7d6466a..3111005 100644 --- a/libphysics/test/vis.c +++ b/libphysics/test/vis.c @@ -45,11 +45,12 @@ main() #define FLOAT_RAND (2 * (rand() / (float)RAND_MAX) - 1) for(int i = 0; i < SBODY; i++) { - Body *b = phxnew(BTYPE_AABB); - assert(b != NULL); + BodyID b = phxnew(BTYPE_AABB); + assert(b != -1); + phxsetpos(b, rand() % 800, rand() % 600); phxsetsize(b, 16.0, 16.0); - phxapplyaccel(b, (float[]){ 100000 * FLOAT_RAND, 100000 * FLOAT_RAND }); + phxapplyaccel(b, (float[]){ 30000 * FLOAT_RAND, 30000 * FLOAT_RAND }); } phxsetmap(8, 8, (int[]) { @@ -75,7 +76,7 @@ main() old_ticks = new_ticks; phxtick(delta); while(phxnextcollevent(&event)) { - printf("Collision with %p and %p\n", event.body1, event.body2); + printf("Collision with %d and %d\n", event.body1, event.body2); } render(); @@ -106,7 +107,6 @@ render(void) SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); SDL_RenderClear(renderer); - SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0xFF, 0xFF); for(int y = 0; y < phxmapheight; y++) for(int x = 0; x < phxmapwidth; x++) { -- cgit v1.2.3