CalcCity/src/main.c

38 lines
767 B
C
Raw Normal View History

#include <gint/display.h>
2022-06-23 11:03:57 +02:00
#include <gint/gint.h>
2021-10-31 15:12:30 +01:00
#include "core.h"
2022-06-23 11:03:57 +02:00
#include "save.h"
2021-10-23 18:51:28 +02:00
2021-10-10 15:08:56 +02:00
int main(void)
{
extern font_t font_calccity;
dfont(&font_calccity);
2021-10-23 18:51:28 +02:00
title_screen();
2021-10-31 15:12:30 +01:00
// Game initialisation
struct calccity *calccity;
calccity = (struct calccity*) malloc(sizeof *calccity);
struct camera *camera;
camera = (struct camera*) malloc(sizeof *camera);
struct map *map;
map = (struct map*) malloc(sizeof *map);
2021-10-10 15:08:56 +02:00
// Loading save
gint_world_switch(GINT_CALL(read_save, (void *)calccity, (void *)camera, (void *)map));
// Launch the game
main_loop(calccity, camera, map);
2022-06-23 11:03:57 +02:00
// Backup data
gint_world_switch(GINT_CALL(write_save, (void *)calccity, (void *)camera, (void *)map));
// Free memory
free(calccity);
free(camera);
free(map);
2022-06-23 11:03:57 +02:00
2021-10-10 15:08:56 +02:00
return 1;
2021-10-23 18:51:28 +02:00
}