#ifndef VY_CONFIG_H #define VY_CONFIG_H typedef enum { VY_CVAR_TYPE_INT, VY_CVAR_TYPE_FLOAT, VY_CVAR_TYPE_STRING, } vy_cvar_type; typedef struct { const char *name; const char *description; union { int i; float f; const char *s; }; vy_cvar_type type; } vy_cvar; #define VY_CVAR_I(n, d, v) \ vy_cvar n = {.name = #n, \ .description = d, \ .i = (v), \ .type = VY_CVAR_TYPE_INT} #define VY_CVAR_F(n, d, v) \ vy_cvar n = {.name = #n, \ .description = d, \ .f = (v), \ .type = VY_CVAR_TYPE_FLOAT} #define VY_CVAR_S(n, d, v) \ vy_cvar n = {.name = #n, \ .description = d, \ .s = (v), \ .type = VY_CVAR_TYPE_STRING} void vyRegisterCVAR(vy_cvar *cvar); vy_cvar *vyGetCVAR(const char *name); #endif