summaryrefslogtreecommitdiff
path: root/prb_types.h
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-02-20 15:08:47 +0500
committerpryazha <pryadeiniv@mail.ru>2025-02-20 15:08:47 +0500
commit0bd7c5dc0725a4882cb33c5d8f1a3b101d4025cd (patch)
treeecb3e42bf4855ba9e4836a20b94cb4857943eda6 /prb_types.h
initial
Diffstat (limited to 'prb_types.h')
-rw-r--r--prb_types.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/prb_types.h b/prb_types.h
new file mode 100644
index 0000000..a1ac3ba
--- /dev/null
+++ b/prb_types.h
@@ -0,0 +1,84 @@
+#ifndef PRB_TYPES_H
+#define PRB_TYPES_H
+
+typedef int8_t S8;
+typedef int16_t S16;
+typedef int32_t S32;
+typedef int64_t S64;
+typedef uint8_t U8;
+typedef uint16_t U16;
+typedef uint32_t U32;
+typedef uint64_t U64;
+typedef S32 B32;
+typedef float F32;
+typedef double F64;
+
+/* NOTE(pryazha): The library uses a right-handed coordiante system (for now) */
+
+typedef struct {
+ F32 x, y;
+} V2;
+
+#define V2_ZERO (V2){ 0.0f, 0.0f }
+#define V2_ONE (V2){ 1.0f, 1.0f }
+#define V2_RIGHT (V2){ 1.0f, 0.0f }
+#define V2_UP (V2){ 0.0f, 1.0f }
+#define V2_LEFT (V2){-1.0f, 0.0f }
+#define V2_DOWN (V2){ 0.0f, -1.0f }
+
+typedef struct {
+ F32 x, y, z;
+} V3;
+
+#define V3_ZERO (V3){ 0.0f, 0.0f, 0.0f }
+#define V3_ONE (V3){ 1.0f, 1.0f, 1.0f }
+#define V3_RIGHT (V3){ 1.0f, 0.0f, 0.0f }
+#define V3_UP (V3){ 0.0f, 1.0f, 0.0f }
+#define V3_LEFT (V3){-1.0f, 0.0f, 0.0f }
+#define V3_DOWN (V3){ 0.0f, -1.0f, 0.0f }
+#define V3_FORWARD (V3){ 0.0f, 0.0f, 1.0f }
+#define V3_BACKWARD (V3){ 0.0f, 0.0f, -1.0f }
+
+typedef struct {
+ F32 x, y, z, w;
+} V4;
+
+#define V4_ZERO (V4){ 0.0f, 0.0f, 0.0f, 0.0f }
+#define V4_ONE (V4){ 1.0f, 1.0f, 1.0f, 1.0f }
+
+typedef struct {
+ V4 m0, m1, m2, m3;
+} Mat4;
+
+#define MAT4_IDENTITY (Mat4) { \
+ { 1.0f, 0.0f, 0.0f, 0.0f }, \
+ { 0.0f, 1.0f, 0.0f, 0.0f }, \
+ { 0.0f, 0.0f, 1.0f, 0.0f }, \
+ { 0.0f, 0.0f, 0.0f, 1.0f } }
+
+typedef struct {
+ U8 *mem;
+ U64 cap;
+ U64 used;
+} Arena;
+
+/* NOTE(pryazha): Strings */
+typedef struct {
+ U8 *ptr;
+ U64 length;
+} Str8;
+
+typedef struct Str8Node {
+ Str8 str;
+ struct Str8Node *next;
+ struct Str8Node *prev;
+} Str8Node;
+
+typedef struct {
+ Str8Node *first;
+ Str8Node *last;
+ U64 total_length;
+ U32 node_count;
+} Str8List;
+
+#endif /* PRB_TYPES_H */