diff options
| author | Andrew Guschin <saintruler@gmail.com> | 2021-09-13 16:10:57 +0400 |
|---|---|---|
| committer | Andrew Guschin <saintruler@gmail.com> | 2021-09-13 16:10:57 +0400 |
| commit | 11048808cbe3dc77bb2bee6d2643a33a45574509 (patch) | |
| tree | 0896fe3a242366161b2e5328827bdf66a193a824 /src/main.c | |
| parent | 5438fe938f6a15f4eadcc0bb2fd09a02130aafb4 (diff) | |
Added bitset
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -3,6 +3,7 @@ #include <string.h> #include "storage.h" +#include "bitset.h" typedef struct { @@ -29,6 +30,7 @@ initStorage(storage_t *storage) storage->componentsStored = 0; storage->objectsStored = 0; storage->objects = (component_pair_t *) malloc(MAX_COMPONENTS * sizeof(component_pair_t)); + bitarena_init(&storage->objectSignatures, MAX_OBJECTS); REGISTER_COMPONENT(storage, transform_t); REGISTER_COMPONENT(storage, collider_t); @@ -37,6 +39,19 @@ initStorage(storage_t *storage) void loadScene(storage_t *storage) { + bitset_t s1 = bitarena_at(&storage->objectSignatures, 0); + bitset_t s2 = bitarena_at(&storage->objectSignatures, 1); + + bitset_set(s1, 9); + bitset_set(s2, 9); + + bitset_print(s1); + bitset_print(s2); + + bitset_t sAnd = bitset_and(s1, s2); + printf("Bitset is zero: %i\n", bitset_isZero(sAnd)); + printf("Bitset is equals: %i\n", bitset_equals(s1, s2)); + entity_t e1 = createEntity(storage); transform_t *t1 = GET_COMPONENT(storage, transform_t, e1); t1->x = 13; |