aboutsummaryrefslogtreecommitdiff
path: root/src/gameCommon.h
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-07-07 00:57:19 -0600
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-07-07 00:57:19 -0600
commit028cf5d33d99274deea9567159a4eb07c13ef85c (patch)
treeb2d9f0ae8fb640fdbe1a41114c7c8314f9223103 /src/gameCommon.h
parent416a5cbab21c480ae9e85b07fd9424452cbcb611 (diff)
This fucker is flying
Diffstat (limited to 'src/gameCommon.h')
-rw-r--r--src/gameCommon.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/gameCommon.h b/src/gameCommon.h
index b53b955..0d18d32 100644
--- a/src/gameCommon.h
+++ b/src/gameCommon.h
@@ -9,12 +9,39 @@
#include <raylib.h>
#include <raymath.h>
-#include "raylib.h"
+#include <rlgl.h>
+#include "raygui.h"
#ifndef GAME_COMMON_H
#define GAME_COMMON_H
+// Types be like.
+typedef struct Game Game;
+typedef struct Entity Entity;
+
#define WINDOW_WIDTH 960
#define WINDOW_HEIGHT 540
+// Bit shit.
+#define SET_BIT(b, n) (b | (0x1 << n))
+#define CLEAR_BIT(b, n) (b & ~(0x1 << n))
+#define IS_BIT_SET(b, n) ((b >> n) & 0x1)
+#define TOGGLE_BIT(b, n) (b ^ (0x1 << n))
+#define HAS_FLAG(v, f) ((v & f) == f)
+
+// Memory management.
+#define KF_MALLOC(size) malloc(size)
+#define KF_CALLOC(nmemb, size) calloc(nmemb, size)
+#define KF_REALLOC(ptr, size) realloc(ptr, size)
+#define KF_REALLOCARRAY(ptr, nmemb, size) reallocarray(ptr, nmemb, size)
+#define KF_FREE(ptr) free(ptr)
+
+#define ALLOCATION_ERROR TraceLog(LOG_ERROR, "Allocation error in %s:%d", __FILE__, __LINE__)
+
+// Errors.
+typedef enum KfError {
+ KFERROR = -1,
+ KFSUCCESS = 0
+} KfError;
+
#endif