-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmeta_crush_saga.sh
executable file
·73 lines (58 loc) · 1.46 KB
/
meta_crush_saga.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
#!/usr/bin/env bash
clear
IFS=
keypressed='None'
while :
do
epoch_ms=$(date +%s%3N)
g++ -std=c++2a -Wall -Wextra -pedantic main.cpp -DKEYBOARD_INPUT="$keypressed" -DEPOCH_MS="$epoch_ms" -fconcepts -o renderer
if [ $? -ne 0 ]; then
echo " ---------------------------"
echo " - -"
echo " - GAME OVER -"
echo " - -"
echo " ---------------------------"
break
fi
clear
current_state=$(./renderer)
echo $current_state
while :
do
keypressed=''
read -t0.1 -n1 key
if [ $? -ne 0 ]; then
keypressed='None'
break
fi
if [ "$key" == ' ' ]
then
keypressed='Space'
elif [ "$key" == 'n' ]
then
keypressed='None'
break
else
read -n2 key
echo "$key"
if [ "$key" == '[A' ]
then
keypressed='Up'
elif [ "$key" == '[B' ]
then
keypressed='Down'
elif [ "$key" == '[C' ]
then
keypressed='Right'
elif [ "$key" == '[D' ]
then
keypressed='Left'
fi
fi
if [ "$keypressed" != '' ]
then
break
fi
done
echo "R\"($current_state)\"" > current_state.txt
done