there is now a player character and the world renders using a cammera

This commit is contained in:
2026-04-09 13:11:55 -07:00
parent 09c310cb4a
commit af639e62c3
47 changed files with 1737 additions and 83 deletions

View File

@@ -0,0 +1,30 @@
#include "entity_handler.h"
#include "world.h"
#include <bits/time.h>
#include <time.h>
#include <stdio.h>
void EntityListInit(entity_list* list) {
list->count = 0;
for(int i = 0; i < 256; i++) {
list->entities[i] = NULL;
}
clock_gettime(CLOCK_MONOTONIC, &list->start);
}
int EntityListUpdate(entity_list* list) {
clock_gettime(CLOCK_MONOTONIC, &list->current);
double elapsed = (list->current.tv_sec - list->start.tv_sec);
elapsed += (list->current.tv_nsec - list->start.tv_nsec) / 1000000000.0;
if(elapsed > 0.125/4) {
for(int i = 0; i < 256; i++) {
if(list->entities[i] != NULL) {
printf("running index %d\n", i);
list->entities[i]->callback.update(0,list->entities[i]);
}
}
clock_gettime(CLOCK_MONOTONIC, &list->start);
}
return 0;
}