Skip to content

Commit 598fe2f

Browse files
committed
Update README.md
1 parent e8bd4cc commit 598fe2f

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ If You use MacOS You can install [newcurses][ncurses] with [homebrew][brew] simp
3636

3737
##### Unix-like OS
3838
Short answer: _It depends._
39-
For example, if You are using Ubuntu You can install [newcurses][ncurses] and [g++][compiler] by
39+
For example, if You are using Ubuntu You can install [newcurses][ncurses] and
40+
[g++][compiler] by
4041

4142
sudo apt-get install libncurses5-dev libncursesw5-dev clang
4243

@@ -58,28 +59,33 @@ Enter desired directory and run
5859
git clone https://github.com/Dolfost/snake-cpp
5960
cd snake-cpp
6061

61-
It will create the directory with name `snake-cpp` and enter it. Then You have to compile the game.
62+
It will create the directory with name `snake-cpp` and enter it. Then You have
63+
to compile the game.
6264

6365
### Compiling the game
6466
To build the game You can:
6567

6668
cmake -B build; cmake --build build
67-
./build/snake --build-help-pad
69+
./build/src/snakegame
6870

69-
It will create the game executable `snake` in the `build/` direcotry and build the help pad for current terminal.
71+
It will create the game executable `snakegame` in the `build/src` directory.
7072

7173
## Running the game
7274
- Open the terminal window not smaller than 42 lines by 80 columns
7375
- To start the game You can execute
7476
```
75-
./build/shanke
77+
./build/src/snakegame
7678
```
7779
in the git directory root.
7880
79-
If You are new to the game (probably You are), I recommend You to start game with the `--help` or `-h` option, so You can get used to it.
81+
If You are new to the game (probably You are), I recommend You to start
82+
game with the `--help` or `-h` option, so You can get used to it.
8083
```
81-
./build/snake --help
84+
./build/src/snakegame --help
8285
```
86+
Game files will be located in `../var` relative to game executable
87+
(`build/var` if following this guide).
88+
8389
## Contributing
8490
If You find any bugs or unexpected behaviors or just want to
8591
contribute to the snake-cpp, You are welcome at the [issues tab][issue].

src/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@ target_link_libraries(snakegame
2828
)
2929

3030
include(GNUInstallDirs)
31+
file(MAKE_DIRECTORY
32+
"${CMAKE_CURRENT_BINARY_DIR}/../${SNAKE_STATE_DIRECTORY}"
33+
)
3134
install(TARGETS snakegame)
32-
install(DIRECTORY DESTINATION "${CMAKE_INSTALL_LOCALSTATEDIR}")
35+
install(DIRECTORY DESTINATION "${SNAKE_STATE_DIRECTORY}")

src/snake/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ add_library(snakesnake
1111
)
1212

1313
include(GNUInstallDirs)
14+
set(SNAKE_STATE_DIRECTORY ${CMAKE_INSTALL_LOCALSTATEDIR})
1415
target_compile_definitions(snakesnake
15-
PUBLIC SNAKE_DATA_DIR="${CMAKE_INSTALL_LOCALSTATEDIR}"
16+
PUBLIC SNAKE_DATA_DIR="${SNAKE_STATE_DIRECTORY}"
1617
)
1718

1819
configure_file(
@@ -46,3 +47,5 @@ target_sources(snakesnake
4647
target_link_libraries(snakesnake
4748
PRIVATE ${CURSES_LIBRARIES}
4849
)
50+
51+
return(PROPAGATE SNAKE_STATE_DIRECTORY)

0 commit comments

Comments
 (0)