diff --git a/include/arc/math/circle.h b/include/arc/math/circle.h index 60d9acb..b93f406 100644 --- a/include/arc/math/circle.h +++ b/include/arc/math/circle.h @@ -25,6 +25,8 @@ typedef struct ARC_DCircle { double r; } ARC_DCircle; +void TEMP_Circle_Placeholder(void); + #ifdef __cplusplus } #endif diff --git a/packages/graphics/sdl3/config.c b/packages/graphics/sdl3/config.c index cbed504..082ac80 100644 --- a/packages/graphics/sdl3/config.c +++ b/packages/graphics/sdl3/config.c @@ -80,7 +80,7 @@ void ARC_ConfigType_SpriteCopyFn(void **type, ARC_ParserTagToken *parsedData, AR //really large number in case a system has 64 digit pointer addresses char pointerCString[64]; - sprintf(pointerCString, "%p", sprite); + sprintf(pointerCString, "%p", (void *)sprite); /* ~ spritesheet ~ */ @@ -198,7 +198,7 @@ void ARC_ConfigType_SpriteDestroyFn(ARC_Config *config, void *type){ //really large number in case a system has 64 digit pointer addresses char pointerCString[64]; - sprintf(pointerCString, "%p", sprite); + sprintf(pointerCString, "%p", (void *)sprite); /* ~ spritesheet ~ */ //create a name based on the type and the sprite pointer to have a unique name for cleanup on remove diff --git a/packages/graphics/sdl3/renderer.c b/packages/graphics/sdl3/renderer.c index dc93cda..939b62e 100644 --- a/packages/graphics/sdl3/renderer.c +++ b/packages/graphics/sdl3/renderer.c @@ -35,7 +35,7 @@ void ARC_Renderer_CreateWithEngineData(ARC_Renderer **renderer, ARC_EngineData * if((*renderer)->renderer == NULL){ arc_errno = ARC_ERRNO_NULL; - ARC_DEBUG_LOG_ERROR_WITH_VARIABLES("SDL_CreateRenderer(%p, NULL);", data->window); + ARC_DEBUG_LOG_ERROR_WITH_VARIABLES("SDL_CreateRenderer(%p, NULL);", (void *)data->window); free(renderer); return; } diff --git a/packages/graphics/sdl3/sprite.c b/packages/graphics/sdl3/sprite.c index c07a4b7..6809bfd 100644 --- a/packages/graphics/sdl3/sprite.c +++ b/packages/graphics/sdl3/sprite.c @@ -42,7 +42,7 @@ void ARC_Sprite_Copy(ARC_Sprite **newSprite, ARC_Sprite *oldSprite){ } void ARC_Sprite_Render(ARC_Sprite *sprite, ARC_Renderer *renderer, ARC_FRect renderBounds){ - SDL_RenderTexture(renderer->renderer, sprite->spritesheet->texture, (SDL_FRect *)(sprite->frames.data + sprite->frameIndex), (SDL_FRect *)&renderBounds); + SDL_RenderTexture(renderer->renderer, sprite->spritesheet->texture, ((SDL_FRect *)sprite->frames.data) + sprite->frameIndex, (SDL_FRect *)&renderBounds); } void ARC_Sprite_RenderAt(ARC_Sprite *sprite, ARC_Renderer *renderer, ARC_FPoint point, double scale){ diff --git a/src/math/circle.c b/src/math/circle.c index e69de29..9a5e8d1 100644 --- a/src/math/circle.c +++ b/src/math/circle.c @@ -0,0 +1,4 @@ +#include "arc/math/circle.h" + +void TEMP_Circle_Placeholder(void){ +} diff --git a/src/std/entity.c b/src/std/entity.c index d83a4bd..77859c2 100644 --- a/src/std/entity.c +++ b/src/std/entity.c @@ -42,6 +42,10 @@ void ARC_EntitySystem_Create(ARC_EntitySystem **entitySystem){ //init an empty query (*entitySystem)->query = NULL; + + //add the first offset as 0 + uint32_t zero = 0; + ARC_VectorInline_Add(((*entitySystem)->offsetVector), (void *)&zero); } void ARC_EntitySystem_Destroy(ARC_EntitySystem *entitySystem){ @@ -76,10 +80,7 @@ uint32_t ARC_EntitySystem_RegisterComponent(ARC_EntitySystem *entitySystem, uint //get the total component size uint32_t offsetEndIndex = ARC_VectorInline_GetSize(entitySystem->offsetVector); - uint32_t totalSize = 0; - if(ARC_VectorInline_GetSize(entitySystem->offsetVector) != 0){ - totalSize = *(uint32_t *)ARC_VectorInline_Get(entitySystem->offsetVector, offsetEndIndex - 1); - } + uint32_t totalSize = *(uint32_t *)ARC_VectorInline_Get(entitySystem->offsetVector, offsetEndIndex - 1); //if the new component size would overflow, throw an error if(totalSize > (~(uint32_t)0) - componentSize){ @@ -88,16 +89,18 @@ uint32_t ARC_EntitySystem_RegisterComponent(ARC_EntitySystem *entitySystem, uint return ~(uint32_t)0; } + //add the component size to the total size for the next offset + totalSize += componentSize; + //add the component size to the total size and the offset vector array ARC_VectorInline_Add(entitySystem->offsetVector, &totalSize); ARC_VectorInline_Add(entitySystem->sizeVector , &componentSize); - totalSize += componentSize; //create the resized data vector that can now house the registered component ARC_VectorInline_Create(&(entitySystem->data), totalSize, NULL, NULL); //get the id (last index) in the offset vector - return ARC_VectorInline_GetSize(entitySystem->offsetVector) - 1; + return ARC_VectorInline_GetSize(entitySystem->sizeVector) - 1; } ARC_Entity ARC_EntitySystem_InitEntity(ARC_EntitySystem *entitySystem){ @@ -169,7 +172,8 @@ ARC_Bool ARC_EntitySystem_HasComponent(ARC_EntitySystem *entitySystem, ARC_Entit void *ARC_EntitySystem_GetComponentData(ARC_EntitySystem *entitySystem, ARC_Entity entity, ARC_EntityComponent component){ //get the entity row, then offset that for the component to get the component data void *data = ARC_VectorInline_Get(entitySystem->data, (uint32_t)entity); - return data + *(int32_t *)ARC_VectorInline_Get(entitySystem->offsetVector, (uint32_t)component); + int32_t temp = *(int32_t *)ARC_VectorInline_Get(entitySystem->offsetVector, (uint32_t)component); + return data + temp; } ARC_Array ARC_EntitySystem_QueryComponentsData(ARC_EntitySystem *entitySystem, ARC_Array components){