2024-03-04 13:41:01 +08:00
|
|
|
|
|
|
|
#include "App.h"
|
2024-03-04 14:20:50 +08:00
|
|
|
#include "Entity.h"
|
2024-03-04 13:41:01 +08:00
|
|
|
#include "Input.h"
|
|
|
|
#include "Physics_Component.h"
|
|
|
|
#include "Player_Component.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
App *app_NewApp() {
|
|
|
|
App *app = malloc(sizeof(App));
|
|
|
|
|
|
|
|
app->input = input_NewSystem(app);
|
|
|
|
app->physics = physics_NewSystem(app);
|
|
|
|
app->player = player_NewSystem(app);
|
2024-03-04 14:20:50 +08:00
|
|
|
app->entity = entity_NewSystem(app);
|
2024-03-04 13:41:01 +08:00
|
|
|
|
|
|
|
return app;
|
|
|
|
}
|
|
|
|
|
|
|
|
void app_DeleteApp(App *app) {
|
|
|
|
input_DeleteSystem(app->input);
|
2024-03-04 14:20:50 +08:00
|
|
|
entity_DeleteSystem(app->entity);
|
2024-03-04 13:41:01 +08:00
|
|
|
physics_DeleteSystem(app->physics);
|
|
|
|
player_DeleteSystem(app->player);
|
|
|
|
|
|
|
|
free(app);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void app_Advance(App *app, Duration deltaTime) {
|
|
|
|
input_Advance(app->input);
|
|
|
|
player_Advance(app->player, deltaTime);
|
|
|
|
physics_Advance(app->physics, deltaTime);
|
2024-03-04 14:20:50 +08:00
|
|
|
entity_Advance(app->entity, deltaTime);
|
2024-03-04 13:41:01 +08:00
|
|
|
}
|