sdfps/types.h

48 lines
1.1 KiB
C
Raw Normal View History

2022-03-21 17:58:17 +00:00
// types.h
#ifdef TYPES_SUBINCLUDE
#undef TYPES_SUBINCLUDE
/*
* Idea i had would be to have user data point to a key-value store based on struct meta data of
* our state, we would then encode into that before unloading, when we reload we check to see
* what's been serialised and pull it back out in to gur new potentially changed struct, this
* would in theory be more straight forward to understand than having 2 copies, or alternatively
* copying them in place like i was doing before
*/
struct(Sdfps,
field(SDL_Window *, window, NULL)
field(SDL_GLContext, context, NULL)
field(GLuint, vert_shader, 0)
field(GLuint, frag_shader, 0)
field(GLuint, shader_program, 0)
)
#else
#include <stdint.h>
typedef int8_t s8;
typedef uint8_t u8;
typedef int16_t s16;
typedef uint16_t u16;
typedef int32_t s32;
typedef uint32_t u32;
typedef int64_t s64;
typedef uint64_t u64;
typedef float f32;
typedef double f64;
/* initial struct definitions */
#define struct(TN, ...) typedef struct TN TN; struct TN { __VA_ARGS__ };
#define field(T, N, D) T N;
#define TYPES_SUBINCLUDE
#include __FILE__
#undef struct
#undef field
#endif