2021-03-08 18:49:51 +01:00
|
|
|
#pragma once
|
|
|
|
|
2021-04-20 15:00:16 +02:00
|
|
|
#define LEVEL_NB 3
|
2021-03-08 18:49:51 +01:00
|
|
|
#define LEVEL_SIZE 16
|
|
|
|
#define TILE_SIZE 12
|
2021-04-19 20:02:47 +02:00
|
|
|
#define PLAYER_SIZE 10
|
2021-03-08 18:49:51 +01:00
|
|
|
|
2021-04-20 15:00:16 +02:00
|
|
|
/* struct for a pair of int values */
|
2021-03-14 00:25:24 +01:00
|
|
|
typedef struct Vec2 {
|
2021-03-13 18:39:09 +01:00
|
|
|
int x, y;
|
2021-03-14 00:25:24 +01:00
|
|
|
} Vec2;
|
2021-03-13 18:39:09 +01:00
|
|
|
|
2021-04-20 15:00:16 +02:00
|
|
|
/* struct for a pair of float values */
|
|
|
|
typedef struct FVec2 {
|
|
|
|
float x, y;
|
|
|
|
} FVec2;
|
|
|
|
|
2021-03-14 10:13:31 +01:00
|
|
|
/* struct for player's data */
|
2021-03-14 00:25:24 +01:00
|
|
|
typedef struct Player {
|
|
|
|
Vec2 pos;
|
|
|
|
Vec2 spawn;
|
2021-04-20 15:00:16 +02:00
|
|
|
FVec2 frac;
|
2021-03-14 00:25:24 +01:00
|
|
|
} Player;
|
2021-03-13 18:39:09 +01:00
|
|
|
|
2021-03-14 10:13:31 +01:00
|
|
|
/* used for tiles */
|
2021-03-14 00:18:11 +01:00
|
|
|
typedef int tile_t;
|
|
|
|
|
2021-04-19 14:48:36 +02:00
|
|
|
Vec2 search(tile_t x, tile_t level[LEVEL_SIZE][LEVEL_SIZE]);
|
|
|
|
int collide_pixel(Vec2 pos, tile_t obj, tile_t level[LEVEL_SIZE][LEVEL_SIZE]);
|
|
|
|
int collide(Vec2 pos, int h, tile_t obj, tile_t level[LEVEL_SIZE][LEVEL_SIZE]);
|
2021-04-19 20:02:47 +02:00
|
|
|
int object_delete(Vec2 pos, tile_t obj, tile_t level[LEVEL_SIZE][LEVEL_SIZE]);
|
|
|
|
Player player_reset(Player player, tile_t level[LEVEL_SIZE][LEVEL_SIZE]);
|