feat: Hitbox drawing

This commit is contained in:
2025-10-06 14:50:32 +01:00
parent 3a84947750
commit 8a360df98a
6 changed files with 44 additions and 9 deletions

View File

@@ -30,6 +30,7 @@ struct G_Editor {
S32 currentAsset;
G_EDITOR_MODE mode;
V2f cursor;
V2f dragStart;
};
typedef struct G_State G_State;

View File

@@ -37,13 +37,15 @@ void ProcessEvents(SDL_Event *event, World *world)
}
void RenderWorld(World *world, D_Context *draw) {
for (int i = 0; i < 4800; i++) {
D_Rect(
draw,
(F32) (i % 96), (F32) (i / 96),
.texture = world->tileTypes[world->map[i]].tile,
.angle = (F32) world->tileTypes[world->map[i]].rotation,
);
if(world->player.currentArea == WORLD_AREA_OUTSIDE) {
for (int i = 0; i < 4800; i++) {
D_Rect(
draw,
(F32) (i % 96), (F32) (i / 96),
.texture = world->tileTypes[world->map[i]].tile,
.angle = (F32) world->tileTypes[world->map[i]].rotation,
);
}
}
for (int i = 0; i < world->propCount; i++) {
if(world->props[i].area == world->player.currentArea) {

View File

@@ -50,6 +50,8 @@ struct World {
World_PropType propTypes[64];
U32 propCount;
World_Prop props[256];
U32 hitboxCount;
AABB hitboxes[4096];
//// Player
Player player;