chore: struct reorg
This commit is contained in:
60
code/first.c
60
code/first.c
@@ -61,6 +61,39 @@ int main(int argc, char **argv) {
|
||||
camera->farp = 1000.0f;
|
||||
|
||||
game->draw.camera = camera;
|
||||
World *world = M_ArenaPush(arena, World);
|
||||
game->world = world;
|
||||
world->npcCount = 2;
|
||||
NPC *npc1 = &world->npcs[0];
|
||||
npc1->collision.pos.x = 15;
|
||||
npc1->collision.pos.y = 15;
|
||||
npc1->collision.size.x = 10;
|
||||
npc1->collision.size.y = 10;
|
||||
npc1->name = S("Matt");
|
||||
npc1->mode = NPC_ACTION_WAITING;
|
||||
npc1->waitTime = 0;
|
||||
npc1->maxWaitTime = 5;
|
||||
npc1->currentNavNode = 87;
|
||||
npc1->collision.pos.x = 15;
|
||||
npc1->collision.pos.y = 15;
|
||||
npc1->collision.size.x = 10;
|
||||
npc1->collision.size.y = 10;
|
||||
|
||||
NPC *npc2 = &world->npcs[0];
|
||||
npc2->collision.pos.x = 15;
|
||||
npc2->collision.pos.y = 15;
|
||||
npc2->collision.size.x = 10;
|
||||
npc2->collision.size.y = 10;
|
||||
npc2->name = S("James");
|
||||
npc2->mode = NPC_ACTION_WAITING;
|
||||
npc2->waitTime = 0;
|
||||
npc2->maxWaitTime = 10;
|
||||
npc2->currentNavNode = 0;
|
||||
|
||||
world->navMesh = &TestNavMesh;
|
||||
world->npcPOI[0] = 100;
|
||||
world->player.pos.x = 0;
|
||||
world->player.pos.y = 0;
|
||||
}
|
||||
|
||||
Vk_Buffer rbo = { 0 };
|
||||
@@ -71,29 +104,6 @@ int main(int argc, char **argv) {
|
||||
Vk_BufferCreate(&rbo);
|
||||
|
||||
bool running = true;
|
||||
World world = {
|
||||
.npcCount = 2,
|
||||
.npcs = {
|
||||
{
|
||||
.collision = {{10, 10}, {10, 10}},
|
||||
.name = S("Matt"),
|
||||
.mode = NPC_ACTION_WAITING,
|
||||
.waitTime = 0,
|
||||
.maxWaitTime = 5,
|
||||
.currentNavNode = 87
|
||||
},{
|
||||
.collision = {{15, 15}, {10, 10}},
|
||||
.name = S("James"),
|
||||
.mode = NPC_ACTION_WAITING,
|
||||
.waitTime = 0,
|
||||
.maxWaitTime = 10,
|
||||
.currentNavNode = 0
|
||||
}
|
||||
},
|
||||
.navMesh = &TestNavMesh,
|
||||
.npcPOI = {100},
|
||||
.player = {.pos = {0,0}}
|
||||
};
|
||||
|
||||
printf("%zu size in bytes\n", sizeof(TestNavMesh));
|
||||
|
||||
@@ -106,9 +116,9 @@ int main(int argc, char **argv) {
|
||||
{
|
||||
running = false;
|
||||
}
|
||||
ProcessEvents(&e, &world);
|
||||
ProcessEvents(&e, game->world);
|
||||
}
|
||||
UpdateWorld(1.0/60.0, &world);
|
||||
UpdateWorld(1.0/60.0, game->world);
|
||||
|
||||
int w, h;
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
|
||||
Reference in New Issue
Block a user