2018-05-09 19:12:58 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export DIALOGOPTS='--no-lines --visit-items'
|
|
|
|
cols=$(tput cols)
|
|
|
|
lines=$(tput lines)
|
|
|
|
path="$(realpath "$0")"
|
|
|
|
path="${path%/*}"
|
|
|
|
declare -A gameList
|
|
|
|
for i in $path/*/ ; do
|
|
|
|
i="${i::-1}"
|
2018-05-09 19:29:50 -04:00
|
|
|
gameList[${i##*/}]="${i}"
|
2018-05-09 19:12:58 -04:00
|
|
|
done
|
|
|
|
gameList[exit]="Exit"
|
|
|
|
while : ; do
|
|
|
|
game="$(dialog --backtitle "Storm Games" \
|
|
|
|
--menu "Select A Game" $((lines - 5)) $cols $((lines / 2)) $(
|
|
|
|
for i in ${!gameList[@]} ; do
|
|
|
|
echo "$i"
|
|
|
|
echo '|'
|
|
|
|
done) --stdout)"
|
|
|
|
if [[ "$game" != "exit" && -n "$game" ]]; then
|
2018-05-09 19:29:50 -04:00
|
|
|
cd "${gameList[$game]}"
|
|
|
|
./$game""
|
2018-05-09 19:12:58 -04:00
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
exit 0
|