Odyssee/project/src/core.h

63 lines
1.1 KiB
C
Raw Normal View History

2021-07-04 09:40:38 +02:00
#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
2021-07-04 09:40:38 +02:00
2021-07-17 15:32:47 +02:00
#define MAP_WIDTH 64
#define MAP_HEIGHT 32
2021-07-04 09:40:38 +02:00
#define UP 0
#define RIGHT 1
#define DOWN 2
#define LEFT 3
struct player
{
int direction;
2021-07-17 15:32:47 +02:00
int animation_frame;
2021-07-04 09:40:38 +02:00
};
struct map
2021-07-04 09:40:38 +02:00
{
int data[MAP_HEIGHT][MAP_WIDTH];
uint8_t collision[MAP_HEIGHT][MAP_WIDTH];
2021-07-04 09:40:38 +02:00
};
struct game
{
// Current map and coord's map in the world
2021-07-17 15:32:47 +02:00
const struct map *map;
2021-07-04 09:40:38 +02:00
int world_x, world_y;
2021-07-17 15:32:47 +02:00
struct player *player;
2021-07-04 09:40:38 +02:00
int total_tick;
2021-07-16 13:21:42 +02:00
int water_frame;
2021-07-04 09:40:38 +02:00
};
2021-07-16 13:21:42 +02:00
// next_frame : compute the next frame to display
void next_frame(struct game *game);
2021-07-04 09:40:38 +02:00
// analyze_input : change the player's position
void analyze_input(struct game *game, const int last_key);
2021-07-16 13:21:42 +02:00
// is_walkable : check if the player can go on the targeted case
2021-07-17 15:32:47 +02:00
uint8_t is_walkable(const struct game *game, const int direction);
2021-07-16 13:21:42 +02:00
2021-07-04 09:40:38 +02:00
// rtc_key : returns the key code with RTC system
int rtc_key(void);
// callback_tick : timer's function
int callback_tick(volatile int *tick);
2021-07-04 09:40:38 +02:00
#endif /* _CORE_H */