diff options
| author | kotorifan <kotorifan05@gmail.com> | 2026-04-27 12:57:51 +0200 |
|---|---|---|
| committer | kotorifan <kotorifan05@gmail.com> | 2026-04-27 12:57:51 +0200 |
| commit | 3c6188de4729a31e41fa1a90dd13065170972e36 (patch) | |
| tree | dd1969d90598e5c7bfb8158178577b669c5e4ee8 /src/common.h | |
| parent | 1c373d7864ee3d3e86f48e060760ac3de020ba4d (diff) | |
| download | trashbinphysics-3c6188de4729a31e41fa1a90dd13065170972e36.tar.gz | |
Added SAT collision detection
Diffstat (limited to 'src/common.h')
| -rw-r--r-- | src/common.h | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/common.h b/src/common.h index b8fb306..85a4c98 100644 --- a/src/common.h +++ b/src/common.h @@ -10,27 +10,29 @@ typedef int_least16_t i16; typedef uint_least32_t u32; typedef int_least32_t i32; -#define SHAPE_ENUM_SIZE 3 -typedef enum { - SHAPE_CIRCLE, - SHAPE_SQUARE, - SHAPE_RECTANGLE -} shape_t; +/* #define SHAPE_ENUM_SIZE 4 */ +/* typedef enum { */ +/* SHAPE_CIRCLE, */ +/* SHAPE_SQUARE, */ +/* SHAPE_RECTANGLE, */ +/* SHAPE_TRIANGLE */ +/* } shape_t; */ typedef struct { - Color color; - float elast; -// Vector2 force; - float frict; - Vector2 pos; - Vector2 pos_prev; - Vector2 vel; - bool grabbed; - bool registered; - float mass; - float size_x; - float size_y; - shape_t obj_type; + Color color; + float elast; + float frict; + Vector2 angle; + Vector2 pos; + Vector2 pos_prev; + Vector2 vel; + bool grabbed; + bool registered; + float mass; + float size_x; + float size_y; + Vector2* vertices; + Vector2* edges; } object_t; @@ -51,11 +53,11 @@ typedef struct { #define RANDOM_SHAPE() ((shape_t)(GetRandomValue(0, SHAPE_ENUM_SIZE - 1))) #define RANDOM_COLOR() ((Color) { \ - GetRandomValue(0, 255), \ - GetRandomValue(0, 255), \ - GetRandomValue(0, 255), \ - 255 \ - }) + GetRandomValue(0, 255), \ + GetRandomValue(0, 255), \ + GetRandomValue(0, 255), \ + 255 \ + }) #endif // COMMON_H |
