Compare commits
No commits in common. "460e4e33ed4ac6459764267a5a11261cf9d2d34b" and "8b9fcdd3dfbf38fe27efb4906e9479827265ea19" have entirely different histories.
460e4e33ed
...
8b9fcdd3df
|
@ -1,23 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.5)
|
|
||||||
project(csnake VERSION 0.1.0 LANGUAGES C)
|
|
||||||
|
|
||||||
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
|
||||||
message(FATAL_ERROR "In-source builds are not allowed.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(csnake
|
|
||||||
src/main.c
|
|
||||||
src/screen.c
|
|
||||||
src/input.c
|
|
||||||
src/player.c
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(csnake PROPERTIES C_STANDARD 11)
|
|
||||||
set_target_properties(csnake PROPERTIES C_EXTENSIONS FALSE)
|
|
||||||
target_include_directories(csnake PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
set(SIZE 10 CACHE STRING "Size of game field")
|
|
||||||
set(DEFX 0 CACHE STRING "Start x")
|
|
||||||
set(DEFY 0 CACHE STRING "Start y")
|
|
||||||
|
|
||||||
configure_file(include/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h)
|
|
|
@ -1,3 +0,0 @@
|
||||||
#define SIZE ${SIZE}
|
|
||||||
#define DEFX ${DEFX}
|
|
||||||
#define DEFY ${DEFY}
|
|
|
@ -22,7 +22,7 @@ Food generateFood(Player *player)
|
||||||
Food food;
|
Food food;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
food = (Food){rand() % SIZE, rand() % SIZE};
|
food = (Food){random() % SIZE, random() % SIZE};
|
||||||
} while (playerCheckFoodCollision(player, food));
|
} while (playerCheckFoodCollision(player, food));
|
||||||
return food;
|
return food;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ void resetCoordinates(void)
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
srand(time(NULL));
|
srandom(time(NULL));
|
||||||
Player *player = playerCreate(DOWN, DEFX, DEFY, 0);
|
Player *player = playerCreate(DOWN, DEFX, DEFY, 0);
|
||||||
Screen *screen = screenCreate(SIZE, SIZE, ' ');
|
Screen *screen = screenCreate(SIZE, SIZE, ' ');
|
||||||
PlayerNode *node;
|
PlayerNode *node;
|
||||||
|
|
Loading…
Reference in New Issue