Merge branch 'feature/handle-quit-event'
[jumpnbump.git] / jumpnbump-xdialog
blobde92d75800a4515f6e56687fefbfc8a3d094ee5c
1 #!/bin/bash
3 # User: Setup here the location of Jump'n Bump stuff in your system
5 JUMPNBUMP_BINARY=/usr/local/games/jumpnbump
6 JUMPNBUMP_LEVELS_DIR=/usr/local/share/jumpnbump/
8 # Show a welcome message
10 Xdialog --title "Jump 'n Bump" --msgbox "Welcome to the Jump 'n Bump dialog!\nby Ricardo Cruz <rick2@aeiou.pt>\nA few options will be presented in the following dialog.\nThen, you may choose the level you want to play\n\n(In case this isn't working properly, open this file and edit JnB's locations.)" 0 0
12 # Ask user for Options and parse them
14 OPTIONS=`Xdialog --title "Select Options - Jump 'n Bump" --separator " " --checklist "Options:" 0 0 0 1 "Fullscreen" on 2 "Disable sound" off 3 "Disable gore" off 4 "Double resolution" off 5 "Mirror level" off 2>&1`
16 # cancel pressed, quit
17 if [ $? != 0 ]; then
18 exit 0
21 ARGUMENTS=""
23 for OPT in $OPTIONS
25 case $OPT in
26 '1') ARGUMENTS="$ARGUMENTS -fullscreen";;
27 '2') ARGUMENTS="$ARGUMENTS -nosound";;
28 '3') ARGUMENTS="$ARGUMENTS -nogore";;
29 '4') ARGUMENTS="$ARGUMENTS -scaleup";;
30 '5') ARGUMENTS="$ARGUMENTS -mirror";;
31 *) echo "Warning: unknown option";;
32 esac
33 done
35 # Ask user for a level
36 # (Even after running the game, ask for levels, until user presses Cancel button or Esc key)
38 while [ 1 ]
41 LEVEL_FILE=`Xdialog --title "Choose a Level - Jump 'n Bump" --fselect $JUMPNBUMP_LEVELS_DIR 0 0 2>&1`
42 # "*.dat | Levels"`
44 if [ $LEVEL_FILE ]; then
45 $JUMPNBUMP_BINARY $ARGUMENTS -dat $LEVEL_FILE
47 else
48 exit 0;
51 done