eco2d/code/apps/server/header/components/net.h

32 lines
631 B
C
Raw Normal View History

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(ClientInfo, {
2021-01-17 15:33:56 +00:00
uint16_t peer_id;
});
typedef struct {
2021-01-18 12:16:38 +00:00
ECS_DECLARE_ENTITY(EcsClient);
ECS_DECLARE_COMPONENT(ClientInfo);
2021-01-17 15:33:56 +00:00
} Net;
#define NetImportHandles(handles)\
2021-01-18 12:16:38 +00:00
ECS_IMPORT_ENTITY(handles, EcsClient);\
ECS_IMPORT_COMPONENT(handles, ClientInfo);\
2021-01-17 15:33:56 +00:00
static inline void NetImport(ecs_world_t *ecs) {
ECS_MODULE(ecs, Net);
ecs_set_name_prefix(ecs, "Net");
2021-01-18 12:16:38 +00:00
ECS_TAG(ecs, EcsClient);
2021-01-17 15:33:56 +00:00
ECS_IMPORT(ecs, FlecsMeta);
2021-01-18 12:16:38 +00:00
ECS_META(ecs, ClientInfo);
2021-01-17 15:33:56 +00:00
2021-01-18 12:16:38 +00:00
ECS_EXPORT_ENTITY(EcsClient);
ECS_EXPORT_COMPONENT(ClientInfo);
2021-01-17 15:33:56 +00:00
}