Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ fps_example
EBOOT.PBP
PARAM.SFO
*.prx

# dev tools
.vscode
4 changes: 3 additions & 1 deletion examples/ray_collision_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ extern "C"

return true;
}

return false;
}
else
{
Expand Down Expand Up @@ -198,7 +200,7 @@ extern "C"

float length = -INFINITY;

bool intersect = CheckCollisionRay2dRay2d(ray, edgeRay, &length);
CheckCollisionRay2dRay2d(ray, edgeRay, &length);

Vector2 nearest = Vector2Add(ray.Origin, Vector2Scale(ray.Direction, length));

Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ LIBNAME = kolibri
VERSION = 0.1.0

# Compiler
CC = gcc-14
CC = gcc
AR = ar
ARFLAGS = rcs

Expand Down Expand Up @@ -45,7 +45,7 @@ OBJS_RELEASE = $(SRCS:$(SRCDIR)/%.c=$(OBJDIR)/release/%.o)
OBJS_DEBUG = $(SRCS:$(SRCDIR)/%.c=$(OBJDIR)/debug/%.o)

# Compiler flags
CFLAGS_COMMON = -I$(INCDIR) -I./examples -Wall -Wextra -Wpedantic
CFLAGS_COMMON = -I$(INCDIR) -I./examples -Wall -Wextra -Wpedantic -Werror
CFLAGS_RELEASE = $(CFLAGS_COMMON) -O3 -DNDEBUG
CFLAGS_DEBUG = $(CFLAGS_COMMON) -g3 -O0 -DDEBUG

Expand Down
6 changes: 3 additions & 3 deletions src/collision.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ CollisionScene__checkCollision(
);

/* Check AABB collision with each candidate */
for (int i = 0; i < DynamicArray_length(candidates); i++) {
for (size_t i = 0; i < DynamicArray_length(candidates); i++) {
Entity *other = candidates[i];
if (other == entity) continue; /* Skip self */
if (!other->collision_shape) continue;
Expand Down Expand Up @@ -813,7 +813,7 @@ CollisionScene__moveEntity(
bounds
);

for (int i = 0; i < DynamicArray_length(candidates); i++) {
for (size_t i = 0; i < DynamicArray_length(candidates); i++) {
Entity *other = candidates[i];
if (other == entity || !other->collision_shape) continue;

Expand Down Expand Up @@ -1095,7 +1095,7 @@ CollisionScene__raycast(CollisionScene *scene, K_Ray ray, Entity *ignore)
bbox
);

for (int i = 0; i < DynamicArray_length(candidates); i++) {
for (size_t i = 0; i < DynamicArray_length(candidates); i++) {
Entity *entity = candidates[i];

/* Skip ignored entity */
Expand Down
1 change: 0 additions & 1 deletion src/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ void
Engine__insertEntity(Engine *self, EntityNode *node)
{
if (MAX_NUM_ENTITIES <= self->entity_count) return;
Entity *entity = NODE_TO_ENTITY(node);
if (!self->entities) {
self->entities = node;
}
Expand Down
3 changes: 2 additions & 1 deletion src/entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ EntityNode__remove(EntityNode *self)
*prev = self->prev,
*next = self->next;

DBG_OUT("EntityNode__remove: self=%p, prev=%p, next=%p", self, prev, next);
DBG_OUT("EntityNode__remove: self=%p, prev=%p, next=%p",
(void*)self, (void*)prev, (void*)next);

next->prev = prev;
prev->next = next;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Renderer__queryFrustum(
);

/* Optimized culling loop */
for (int i = 0; i < DynamicArray_length(candidates) && *visible_count < VIS_QUERY_SIZE; i++) {
for (size_t i = 0; i < DynamicArray_length(candidates) && *visible_count < VIS_QUERY_SIZE; i++) {
RenderableWrapper *wrapper = candidates[i];

if (wrapper->is_entity && !wrapper->entity->visible) continue;
Expand Down
2 changes: 1 addition & 1 deletion src/spatialhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ SpatialHash_queryRegion(
bool is_duplicate = false;
size_t count = DynamicArray_length(query_results);

for (int i = 0; i < count; i++) {
for (size_t i = 0; i < count; i++) {
if (query_results[i] == entry->data) {
is_duplicate = true;
break;
Expand Down