From 6a58e39f38ae66435f94876edd6e4a99fa2d9b2f Mon Sep 17 00:00:00 2001 From: Antoine Stevan Date: Mon, 5 Jul 2021 12:22:04 +0200 Subject: [PATCH] v1.1 README + run script. --- README.md | 19 ++++++++++++------- run | 13 ++++++++++--- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7d37f6a..0e594f0 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,17 @@ -# snake +# Neo-snake -gsettings set org.gnome.desktop.interface monospace-font-name 'Ubuntu Mono 13' -gsettings set org.gnome.desktop.interface monospace-font-name 'square 13' -gsettings set org.gnome.desktop.interface monospace-font-name 'square 13' && python src/main.py && gsettings set org.gnome.desktop.interface monospace-font-name 'Ubuntu Mono 13' +## 1. Installation +### a. The game font. +**Neo-snake** uses a special font that allows the terminal to display squares characters. +One can download the *square* font [here](https://strlen.com/square/). -Dowload font [here](https://strlen.com/square/). +Once the .ttf file in dowloaded, simply move it inside one of the system fonts directory. -Put it inside `/usr/share/fonts`, `/usr/local/share/fonts` or `~/.fonts`. The latter does not require `sudo`. +On Ubuntu 20.04 LTS, such directories are under `/usr/share/fonts`, `/usr/local/share/fonts` or `~/.fonts`. The latter does not require `sudo` rights as it is only local. -Run the code with `./run` \ No newline at end of file +### b. Python modules +No particular dependencies (?). + +## 2. Run the code. +Run the code by running the `./run` command in the shell. \ No newline at end of file diff --git a/run b/run index 923d2de..a518489 100755 --- a/run +++ b/run @@ -1,4 +1,11 @@ #! /usr/bin/bash -gsettings set org.gnome.desktop.interface monospace-font-name 'square 13' -python src/main.py -gsettings set org.gnome.desktop.interface monospace-font-name 'Ubuntu Mono 13' +terminal_font=$(gsettings get org.gnome.desktop.interface monospace-font-name) +game_font='square 13' + +if [[ $(fc-list | grep -c square) == 0 ]]; + then echo "square.ttf not found."; + echo "please install the square font (available at https://strlen.com/square/) inside /usr/share/fonts, /usr/local/share/fonts or ~/.fonts"; + else gsettings set org.gnome.desktop.interface monospace-font-name "$game_font"; + python src/main.py; + gsettings set org.gnome.desktop.interface monospace-font-name "$terminal_font"; +fi