-
Notifications
You must be signed in to change notification settings - Fork 0
/
startgame.sh
executable file
·111 lines (92 loc) · 1.94 KB
/
startgame.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# mx 2018, installs and runs the game
#
#
# SINGLE INT NUMBER CHARACTER AS FIRST ARGUMENT TO CHOOSE LEVEL
# CURRENTLY WORKS ONLY FOR LESS THAN 10 LEVELS
#
# .TTF FILE AS SECOND ARGUMENT TO CHOOSE PERSONAL FONT
#
#
# DEFAULT: LEVEL 4, FREESANS.TTF
RED='\033[1;31m'
GREEN='\033[1;32m'
NC='\033[0m'
CHEAT="" # set to "--cheat" if you are an idiot
# INSTALLATION
if [ ! -d "build" ]; then
echo
echo -e "${RED} [WARNING]${NC}"
echo
echo ">> Game not installed (correctly)"
echo ">> Do you want to (re-)install? (Y/N)"
echo
read -s var
while [[ "$var" != "y" && "$var" != "Y" && "$var" != "N" && "$var" != "n" ]]; do
echo ">> Type 'Y' or 'N'!"
read -s var
done
if [[ "$var" == "y" || "$var" == "Y" ]]; then
echo -e "${GREEN} [INSTALLATION STARTED]${NC}"
echo
mkdir build
cd build
cmake ..
if make; then
echo
echo -e "${GREEN} [INSTALLATION SUCCEEDED]${NC}"
echo
echo ">> Installation directory is '/build/' "
echo
fi
else
echo
echo ">> Bye Bye"
echo
exit 1
fi
fi
if [ -d "build" ]; then
echo
echo -e "${GREEN} [WELCOME!]${NC}"
echo
fi
# RUNNING THE MOTHERFUCKING GAME
LEVEL="$1"
FONT="$2"
if [ "$3"=="--cheat" ]; then
CHEAT="--cheat"
fi
if [ -z "$LEVEL" ]; then
LEVEL="4"
fi
if [ -z "$FONT" ]; then
FONT="../gfx/fonts/FreeSans.ttf"
fi
echo $FONT
if [ ! $(echo $FONT | sed "s/.*\.//") == ttf ]; then
echo
echo -e "${RED} [WARNING]${NC}"
echo
echo ">> Argument 2 is not a font!"
echo
exit 1
fi
echo
echo ">> playing level" $LEVEL
echo ">> with font" $FONT
echo
cd build
if ./speed -f $FONT -l ../levels/level0$LEVEL $CHEAT; then
echo
echo -e "${GREEN} [GOODBYE]${NC}"
echo ">> Thanks for playing"
echo
else
echo -e "${RED} [WARNING]${NC}"
echo ">> Broken installation"
echo ">> Please try again after removing 'build' directory"
echo
echo ">> Please check that the following 'curl' and 'smfl' are installed:"
echo ">> try 'sudo apt-get install libcurl4-gnutls-dev libsfml-dev'"
echo
fi