56 lines
919 B
C
56 lines
919 B
C
#ifndef _CORE_H
|
|
#define _CORE_H
|
|
|
|
|
|
#define ENGINE_TICK 100
|
|
#define PARTICULE_NB 50
|
|
|
|
#define TILESET_WIDTH 19
|
|
#define TILE_SIZE 8
|
|
|
|
#define MAP_WIDTH 32
|
|
#define MAP_HEIGHT 16
|
|
#define SCREEN_WIDTH 16
|
|
#define SCREEN_HEIGHT 8
|
|
|
|
#define UP 0
|
|
#define RIGHT 1
|
|
#define DOWN 2
|
|
#define LEFT 3
|
|
|
|
struct player
|
|
{
|
|
int direction;
|
|
};
|
|
|
|
struct map
|
|
{
|
|
int data[MAP_HEIGHT][MAP_WIDTH];
|
|
|
|
uint8_t collision[MAP_HEIGHT][MAP_WIDTH];
|
|
};
|
|
|
|
|
|
struct game
|
|
{
|
|
// Current map and coord's map in the world
|
|
struct map map;
|
|
int world_x, world_y;
|
|
|
|
struct player player;
|
|
|
|
int total_tick;
|
|
};
|
|
|
|
// analyze_input : change the player's position
|
|
void analyze_input(struct game *game, const int last_key);
|
|
|
|
// rtc_key : returns the key code with RTC system
|
|
int rtc_key(void);
|
|
|
|
// callback_tick : timer's function
|
|
int callback_tick(volatile int *tick);
|
|
|
|
int is_walkable(const struct game game, const int direction);
|
|
|
|
#endif /* _CORE_H */ |