will work (#1)

won't work

Reviewed-on: https://gitea.planet-casio.com/Shadow15510/Plague/pulls/1
Co-Authored-By: KikooDX <kikoodx@paranoici.org>
Co-Committed-By: KikooDX <kikoodx@paranoici.org>
This commit is contained in:
KikooDX 2021-05-31 15:30:26 +02:00 committed by Shadow15510
parent b44c91051e
commit 4de5708f3b
2 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,8 @@
#ifndef _PLAGUE_CORE_H
#define _PLAGUE_CORE_H
#include <gint/defs/types.h>
// Duration for internal clock (ms)
#define ENGINE_TICK 50
#define CURSOR_TICK 150
@ -12,6 +14,12 @@
// Number of planes on screen
#define NB_PLANES 5
struct grid {
int width;
int height;
uint8_t *data;
};
// game : all statistics of the current game
struct game
{
@ -36,7 +44,7 @@ struct game
struct plane *planes[NB_PLANES + 1];
// Grid for epidemologic model
int grid[16][32];
struct grid grid;
};
// plane : information about planes
@ -81,4 +89,4 @@ int callback_tick(volatile int *tick);
// message : display a message
void message(const char *msg[5]);
#endif /* _PLAGUE_CORE_H */
#endif /* _PLAGUE_CORE_H */

View File

@ -11,6 +11,8 @@
#include <gint/keyboard.h>
#include <gint/timer.h>
#include <gint/clock.h>
#include <gint/defs/types.h>
#include <gint/std/stdlib.h>
#include "core.h"
#include "display_engine.h"
@ -59,11 +61,18 @@ int main(void)
.planes = {&plane_1, &plane_2, &plane_3, &plane_4, &plane_5, NULL},
.grid = {{0}},
.grid = { 128, 64, NULL },
};
/* allocate memory */
current_game.grid.data = calloc(current_game.grid.width *
current_game.grid.height, sizeof(uint8_t));
main_loop(&current_game);
/* free memory */
free(current_game.grid.data);
return 1;
}