becs/test/main.c

38 lines
680 B
C

#include <stdio.h>
#include <stdlib.h>
#define BECS_IMPLEMENTATION
#include "../becs.h"
typedef struct compA {
uint32_t thing;
} compA;
typedef struct compB {
uint32_t thing;
} compB;
int main(void) {
BECS_Properties EcsProps = {};
size_t componentSizes[2] = {
sizeof(compA),
sizeof(compB),
};
EcsProps.componentSizes = componentSizes;
EcsProps.numComponents = 2;
EcsProps.maxEntities = 100;
size_t MinMemorySize = BECS_GetMinMemorySize(EcsProps);
printf("%llu\n", MinMemorySize);
BECS_ECS *ecs = malloc(MinMemorySize);
BECS_Init(ecs, MinMemorySize, &EcsProps);
compA A = {};
A.thing = 1;
BECS_AddComponent(ecs, 0, 1, &A);
printf("Initialized\n");
}