23 lines
584 B
C
23 lines
584 B
C
#pragma once
|
|
#include <raylib.h>
|
|
#include <stdio.h>
|
|
|
|
#define BOARD_WIDTH 4
|
|
#define BOARD_HEIGHT 4
|
|
#define STARTING_TILES 3
|
|
|
|
typedef enum { UP, DOWN, LEFT, RIGHT } move_direction_t;
|
|
typedef enum { PLAYING, WON, LOST } game_status_t;
|
|
|
|
typedef struct {
|
|
unsigned int board[BOARD_HEIGHT][BOARD_WIDTH];
|
|
game_status_t status;
|
|
unsigned int score;
|
|
unsigned int moves_made;
|
|
} GameState_t;
|
|
|
|
bool move(GameState_t *state, move_direction_t direction);
|
|
void reset_board(GameState_t *state);
|
|
void spawn_tile(GameState_t *state, Vector2 *spawned_tile_pos);
|
|
bool can_move(GameState_t *state);
|