diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-05 14:31:19 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-05 14:31:19 -0500 |
commit | 50fb1482f6dd3d738ba5fd23dfa6789c0f397c92 (patch) | |
tree | b8fb442a6165565a9eb3fc8ac37c4a3a0a613b79 /sim.h |
rotating line
Diffstat (limited to 'sim.h')
-rw-r--r-- | sim.h | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -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; + |