54 lines
No EOL
1.1 KiB
C
54 lines
No EOL
1.1 KiB
C
#include "raylib.h"
|
|
|
|
static Color const ERROR_COLOR = {255, 0, 255, 255};
|
|
static Color const FLOOR_COLOR = {255, 255, 255, 255};
|
|
static Color const WALL_COLOR = {0, 0, 0, 255};
|
|
static Color const PLAYER_COLOR = {64, 64, 64 + 128, 255};
|
|
|
|
typedef struct Vector2i
|
|
{
|
|
int x;
|
|
int y;
|
|
} Vector2i;
|
|
|
|
typedef struct Entity
|
|
{
|
|
Vector2i position;
|
|
Color color;
|
|
} Entity;
|
|
|
|
typedef struct Room
|
|
{
|
|
int height;
|
|
int width;
|
|
Vector2i position;
|
|
Vector2i center;
|
|
} Room;
|
|
|
|
typedef struct Tile
|
|
{
|
|
bool walkable;
|
|
Color color;
|
|
} Tile;
|
|
|
|
bool tryMovePlayer(Vector2i const new_position);
|
|
|
|
Entity *createPlayer(Vector2i const start_position);
|
|
Tile **createMapTiles(void);
|
|
Vector2i setupMap(void);
|
|
void freeMapTiles(Tile **map_tiles);
|
|
|
|
Room createRoom(int x, int y, int height, int width);
|
|
void addRoomToMap(Room room);
|
|
void connectRoomCenters(Vector2i centerOne, Vector2i centerTwo);
|
|
|
|
void renderEverything(void);
|
|
|
|
void initGame(void);
|
|
void mainLoop(void);
|
|
void endGame(void);
|
|
|
|
extern unsigned int const MAP_HEIGHT;
|
|
extern unsigned int const MAP_WIDTH;
|
|
extern Entity *player;
|
|
extern Tile **map; |