map tiles

This commit is contained in:
2025-10-06 00:38:10 +01:00
parent 64a84e3a8d
commit b09bdc6209
3 changed files with 89 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
#include "../player.h"
#include "../aabb.h"
#include <SDL3/SDL_events.h>
#include "../map.h"
void UpdateWorld(F32 delta, World *world)
{
@@ -33,6 +34,11 @@ void ProcessEvents(SDL_Event *event, World *world)
}
void RenderWorld(World *world, D_Context *draw) {
World_Tile tileTypes[] = {dirt, middlePath, middlePathEdgeTop, middlePathEdgeRight, middlePathEdgeBottom, middlePathEdgeLeft, middlePathCornerTopLeft, middlePathCornerTopRight, middlePathCornerBottomRight, middlePathCornerTurnBottomLeft};
for (int i = 0; i < 4800; i++)
{
D_Rect(draw, (i % 96), __floor(i / 96), .texture = tileTypes[map[i]].tile, .angle = tileTypes[map[i]].rotation);
}
for(U32 i = 0; i < world->npcCount; i++) {
NPC npc = world->npcs[i];
if(npc.currentArea == world->player.currentArea) {