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);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#if !defined(LD_GAME_CORE_H_)
|
||||
#define LD_GAME_CORE_H_
|
||||
#include "world.h"
|
||||
|
||||
typedef struct G_Camera G_Camera;
|
||||
struct G_Camera {
|
||||
@@ -18,6 +19,8 @@ struct G_State {
|
||||
|
||||
D_Context draw;
|
||||
G_Camera camera;
|
||||
|
||||
World *world;
|
||||
};
|
||||
|
||||
function void G_ImagesLoad(G_State *game);
|
||||
@@ -29,6 +32,5 @@ function void G_CalulateCamera(G_Camera *camera, F32 aspect);
|
||||
#include "player.h"
|
||||
#include "nav.h"
|
||||
#include "npc.h"
|
||||
#include "world.h"
|
||||
|
||||
#endif // LD_GAME_CORE_H_
|
||||
|
||||
Reference in New Issue
Block a user