Files
ld58/code/game/impl/world.c

31 lines
718 B
C
Raw Normal View History

#include "../world.h"
#include "../npc.h"
#include "../player.h"
#include <SDL3/SDL_events.h>
2025-10-05 16:05:57 +01:00
void UpdateWorld(F32 delta, World *world)
{
UpdateNPCs(delta, world);
2025-10-05 18:05:01 +01:00
PlayerUpdate(delta, &world->player);
}
2025-10-05 16:05:57 +01:00
void UpdateNPCs(F32 delta, World *world)
{
for (U32 i = 0; i < world->npcCount; i++)
{
updateNPC(delta, &world->npcs[i], world);
}
}
2025-10-05 16:05:57 +01:00
void ProcessEvents(SDL_Event *event, World *world)
{
2025-10-05 18:05:01 +01:00
PlayerInput(event, &world->player);
}
2025-10-05 16:49:18 +01:00
void RenderWorld(World *world, D_Context *draw) {
for(int i = 0; i < world->npcCount; i++) {
D_Rect(draw, world->npcs[i].collision.pos.x, world->npcs[i].collision.pos.y, .texture = 1);
}
2025-10-05 18:05:01 +01:00
D_Rect(draw, world->player.pos.x, world->player.pos.y, .texture = 1);
2025-10-05 16:49:18 +01:00
}