summaryrefslogtreecommitdiff
path: root/sim.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-12-05 14:31:19 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-12-05 14:31:19 -0500
commit50fb1482f6dd3d738ba5fd23dfa6789c0f397c92 (patch)
treeb8fb442a6165565a9eb3fc8ac37c4a3a0a613b79 /sim.h
rotating line
Diffstat (limited to 'sim.h')
-rw-r--r--sim.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/sim.h b/sim.h
new file mode 100644
index 0000000..cb05fb9
--- /dev/null
+++ b/sim.h
@@ -0,0 +1,42 @@
+// enums with a specified width are a clang C extension & available in C++11
+#if defined __clang__ || __cplusplus >= 201103L
+#define ENUM_U8 typedef enum : u8
+#define ENUM_U8_END(name) name
+#define ENUM_U16 typedef enum : u16
+#define ENUM_U16_END(name) name
+#else
+#define ENUM_U8 enum
+#define ENUM_U8_END(name) ; typedef u8 name
+#define ENUM_U16 enum
+#define ENUM_U16_END(name) ; typedef u16 name
+#endif
+
+
+#ifdef __GNUC__
+#define maybe_unused __attribute__((unused))
+#else
+#define maybe_unused
+#endif
+
+typedef struct {
+ v2 center;
+ float size;
+ float angle;
+} Platform;
+
+typedef struct {
+ bool initialized;
+ i32 win_width, win_height; // width,height of window
+
+ u32 nplatforms;
+ Platform platforms[1000];
+
+ u32 tmp_mem_used; // this is not measured in bytes, but in MaxAligns
+#define TMP_MEM_BYTES (4L<<20)
+ MaxAlign tmp_mem[TMP_MEM_BYTES / sizeof(MaxAlign)];
+#if DEBUG
+ u32 magic_number;
+ #define MAGIC_NUMBER 0x1234ACAB
+#endif
+} State;
+