rtengine/include/config.h
Kevin Trogant 63e3f973b2 feat: config variables, mutex abstraction
- Mutex abstraction (create, destroy, lock, unlock)
- Config variables (cvars)
2023-10-14 00:15:05 +02:00

43 lines
1.5 KiB
C

#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