2021-01-17 15:33:56 +00:00
|
|
|
#pragma once
|
|
|
|
#include "flecs/flecs.h"
|
|
|
|
#include "flecs/flecs_meta.h"
|
|
|
|
|
2021-01-18 12:16:38 +00:00
|
|
|
ECS_STRUCT(Vector2D, {
|
2021-01-17 15:33:56 +00:00
|
|
|
int16_t x;
|
|
|
|
int16_t y;
|
|
|
|
});
|
|
|
|
|
2021-01-18 13:45:16 +00:00
|
|
|
ECS_STRUCT(Drawable, {
|
2021-01-18 13:47:03 +00:00
|
|
|
char filename[80];
|
2021-01-18 13:45:16 +00:00
|
|
|
});
|
|
|
|
|
2021-01-18 12:16:38 +00:00
|
|
|
typedef Vector2D Chunk;
|
|
|
|
typedef Vector2D Position;
|
2021-01-17 15:33:56 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
ECS_DECLARE_COMPONENT(Chunk);
|
|
|
|
ECS_DECLARE_COMPONENT(Position);
|
2021-01-18 12:16:38 +00:00
|
|
|
ECS_DECLARE_COMPONENT(Vector2D);
|
2021-01-18 13:45:16 +00:00
|
|
|
ECS_DECLARE_COMPONENT(Drawable);
|
2021-01-18 12:16:38 +00:00
|
|
|
} General;
|
2021-01-17 15:33:56 +00:00
|
|
|
|
2021-01-18 12:16:38 +00:00
|
|
|
#define GeneralImportHandles(handles)\
|
2021-01-17 15:33:56 +00:00
|
|
|
ECS_IMPORT_COMPONENT(handles, Chunk);\
|
2021-01-18 12:16:38 +00:00
|
|
|
ECS_IMPORT_COMPONENT(handles, Vector2D);\
|
2021-01-18 13:45:16 +00:00
|
|
|
ECS_IMPORT_COMPONENT(handles, Position);\
|
|
|
|
ECS_IMPORT_COMPONENT(handles, Drawable);\
|
2021-01-17 15:33:56 +00:00
|
|
|
|
2021-01-18 12:16:38 +00:00
|
|
|
static inline void GeneralImport(ecs_world_t *ecs) {
|
|
|
|
ECS_MODULE(ecs, General);
|
|
|
|
ecs_set_name_prefix(ecs, "General");
|
2021-01-17 15:33:56 +00:00
|
|
|
|
2021-01-18 12:16:38 +00:00
|
|
|
ECS_COMPONENT(ecs, Chunk);
|
|
|
|
ECS_COMPONENT(ecs, Position);
|
2021-01-17 15:33:56 +00:00
|
|
|
|
|
|
|
ECS_IMPORT(ecs, FlecsMeta);
|
|
|
|
|
2021-01-18 12:16:38 +00:00
|
|
|
ECS_META(ecs, Vector2D);
|
2021-01-18 13:45:16 +00:00
|
|
|
ECS_META(ecs, Drawable);
|
2021-01-17 15:33:56 +00:00
|
|
|
|
2021-01-18 12:16:38 +00:00
|
|
|
ECS_SET_COMPONENT(Chunk);
|
|
|
|
ECS_SET_COMPONENT(Vector2D);
|
|
|
|
ECS_SET_COMPONENT(Position);
|
2021-01-18 13:45:16 +00:00
|
|
|
ECS_SET_COMPONENT(Drawable);
|
2021-01-17 15:33:56 +00:00
|
|
|
}
|