transfered from codeberg
This commit is contained in:
43
source_code/main.c
Normal file
43
source_code/main.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "function_success.h"
|
||||
#include "player.h"
|
||||
#include "game_initializer.h"
|
||||
#include "game_renderer.h"
|
||||
#include "chunk_scheduler.h"
|
||||
#include "world.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
// This is the main function. You know what it is for.
|
||||
int main(void)
|
||||
{
|
||||
world_struct* world = NULL;
|
||||
player_struct* player = NULL;
|
||||
|
||||
if (!function_success(create_game(&world,
|
||||
&player),
|
||||
"failed to create world in main"))
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
(void)start_chunk_scheduler(world);
|
||||
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
(void)destroy_inactive_chunks(world);
|
||||
(void)update_player_controller(player);
|
||||
|
||||
(void)update_players_known_chunks(player,
|
||||
world);
|
||||
(void)update_world(world,
|
||||
player);
|
||||
|
||||
(void)draw_game(world,
|
||||
player);
|
||||
}
|
||||
(void)stop_chunk_scheduler();
|
||||
(void)destroy_world(&world);
|
||||
(void)destroy_player(&player);
|
||||
(void)CloseWindow();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user