63 lines
1.1 KiB
C
63 lines
1.1 KiB
C
#ifndef _CORE_H
|
|
#define _CORE_H
|
|
|
|
|
|
#define ENGINE_TICK 100
|
|
|
|
#define TILESET_WIDTH 19
|
|
#define TILE_SIZE 8
|
|
|
|
#define SCREEN_WIDTH 16
|
|
#define SCREEN_HEIGHT 8
|
|
|
|
#define MAP_WIDTH 64
|
|
#define MAP_HEIGHT 32
|
|
|
|
#define UP 0
|
|
#define RIGHT 1
|
|
#define DOWN 2
|
|
#define LEFT 3
|
|
|
|
struct player
|
|
{
|
|
int direction;
|
|
int animation_frame;
|
|
};
|
|
|
|
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
|
|
const struct map *map;
|
|
int world_x, world_y;
|
|
|
|
struct player *player;
|
|
|
|
int total_tick;
|
|
int water_frame;
|
|
};
|
|
|
|
// next_frame : compute the next frame to display
|
|
void next_frame(struct game *game);
|
|
|
|
// analyze_input : change the player's position
|
|
void analyze_input(struct game *game, const int last_key);
|
|
|
|
// is_walkable : check if the player can go on the targeted case
|
|
uint8_t is_walkable(const struct game *game, const int direction);
|
|
|
|
// rtc_key : returns the key code with RTC system
|
|
int rtc_key(void);
|
|
|
|
// callback_tick : timer's function
|
|
int callback_tick(volatile int *tick);
|
|
|
|
|
|
#endif /* _CORE_H */ |