27 lines
663 B
C
27 lines
663 B
C
#ifndef RENDERABLE_H
|
|
#define RENDERABLE_H
|
|
|
|
#include "scene_node_entity.h"
|
|
#include "utils/typeclass_helpers.h"
|
|
|
|
typedef struct IRenderable {
|
|
void (*const draw)(void *self);
|
|
} IRenderable;
|
|
|
|
typedef struct Renderable {
|
|
IRenderable const *tc;
|
|
void *data;
|
|
ISceneNodeEntity const *scene_node_entity;
|
|
} Renderable;
|
|
|
|
#define impl_Renderable_for(T, draw_f)\
|
|
Renderable T##_as_Renderable(T *x) {\
|
|
TC_FN_TYPECHECK(void, draw_f, T*);\
|
|
static IRenderable const tc = {\
|
|
.draw = (void(*const)(void*)) draw_f\
|
|
};\
|
|
return (Renderable){ .tc = &tc, .data = x, .scene_node_entity = T##_as_SceneNodeEntity(x).tc };\
|
|
}
|
|
|
|
#endif // !RENDERABLE_H
|