eco2d/code/modules/modules/general.h

37 lines
756 B
C
Raw Normal View History

2021-05-04 17:41:30 +00:00
#pragma once
#include "flecs/flecs.h"
#include "flecs/flecs_meta.h"
#include "world/world.h"
2021-05-04 17:41:30 +00:00
ECS_STRUCT(Vector2D, {
2021-05-08 15:42:47 +00:00
float x;
float y;
2021-05-14 05:02:25 +00:00
});
2021-05-06 16:26:52 +00:00
ECS_STRUCT(Chunk, {
2021-05-04 17:41:30 +00:00
int16_t x;
int16_t y;
ecs_vector(uint8_t) blocks;
2021-05-04 17:41:30 +00:00
});
ECS_STRUCT(Drawable, {
uint16_t id;
});
ECS_ALIAS(Vector2D, Position);
typedef struct {
ECS_DECLARE_COMPONENT(Chunk);
ECS_DECLARE_COMPONENT(Position);
ECS_DECLARE_COMPONENT(Vector2D);
ECS_DECLARE_COMPONENT(Drawable);
} General;
#define GeneralImportHandles(handles)\
ECS_IMPORT_COMPONENT(handles, Chunk);\
ECS_IMPORT_COMPONENT(handles, Vector2D);\
ECS_IMPORT_COMPONENT(handles, Position);\
ECS_IMPORT_COMPONENT(handles, Drawable);\
void GeneralImport(ecs_world_t *ecs);