diff options
| author | esquizo <esquizo+noreply@esquizo.net> | 2026-05-19 13:43:07 -0300 |
|---|---|---|
| committer | esquizo <esquizo+noreply@esquizo.net> | 2026-05-19 13:43:07 -0300 |
| commit | d04c932b33c8565ca49e7b4dafcd4cc944707878 (patch) | |
| tree | 0b712554e2e0b201bb92b55c8d2a8ea26f9733c0 /libphysics/test/perf.c | |
| parent | 371c861b58dd8fca62c47526bd5b1852a9b5e3d4 (diff) | |
Adicionado perf pra validar performance do sistema de física
Diffstat (limited to 'libphysics/test/perf.c')
| -rw-r--r-- | libphysics/test/perf.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libphysics/test/perf.c b/libphysics/test/perf.c new file mode 100644 index 0000000..67999be --- /dev/null +++ b/libphysics/test/perf.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> +#include <physics.h> +#include <assert.h> + +#define SBODY 2048 +#define FLOAT_RAND (2 * (rand() / (float)RAND_MAX) - 1) + +int +main() +{ + for(int i = 0; i < SBODY; i++) { + BodyID b = phxnew(BTYPE_AABB); + assert(b != -1); + + phxsetpos(b, rand() % 800, rand() % 600); + phxsetsize(b, 5.0, 5.0); + phxapplyaccel(b, (float[]){ 50000 * FLOAT_RAND, 50000 * FLOAT_RAND }); + } + + phxsetmap(8, 8, (int[]) { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 1, 0, 0, + 0, 1, 1, 0, 0, 1, 1, 0, + 0, 1, 1, 0, 0, 1, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 0, 0, 1, 1, 0, + 0, 1, 1, 0, 0, 1, 1, 0, + 0, 0, 1, 0, 0, 0, 1, 0, + }); + + phxtick(10.0); + + return 0; +} |
