[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[adonthell-wastesedge-commits] remove_sdl1_2 89bc14a 17/29: ADDED settin
From: |
Kai Sterker |
Subject: |
[adonthell-wastesedge-commits] remove_sdl1_2 89bc14a 17/29: ADDED settings screen to toggle Fullscreen/Window mode, Music Volume and Language |
Date: |
Mon, 25 Jul 2016 18:16:08 +0000 (UTC) |
tag: remove_sdl1_2
commit 89bc14a02205bd9bacc48bf31b7af5ed165a1608
Author: Kai Sterker <address@hidden>
Commit: Kai Sterker <address@hidden>
ADDED settings screen to toggle Fullscreen/Window mode, Music Volume and
Language
---
configure.in | 19 +-
missing | 455 ++++++++++++++------------------------
po/POTFILES.in | 1 +
scripts/modules/Makefile.am | 2 +-
scripts/modules/main_menu.py | 51 ++++-
scripts/modules/option_screen.py | 228 +++++++++++++++++++
6 files changed, 450 insertions(+), 306 deletions(-)
diff --git a/configure.in b/configure.in
index 3f30104..4a5bc31 100755
--- a/configure.in
+++ b/configure.in
@@ -2,9 +2,12 @@ dnl
**************************************************************
dnl Process this file with autoconf to produce a configure script.
dnl **************************************************************
-AC_PREREQ(2.50)
-AC_INIT(wastesedge, 0.3.5, address@hidden, wastesedge)
-AM_INIT_AUTOMAKE(wastesedge, 0.3.5)
+AC_PREREQ(2.60)
+AC_INIT([wastesedge], [0.3.6])
+AC_CONFIG_SRCDIR([README])
+AC_CONFIG_AUX_DIR(.)
+
+AM_INIT_AUTOMAKE
dnl ***************
dnl gettext support
@@ -25,9 +28,10 @@ AC_ARG_WITH(adonthell-binary,
adonthell_binary="$withval", adonthell_binary=none)
dnl Checking for Adonthell
+
if test x$adonthelldatadir = xnone; then
- AC_PATH_PROG(adonthell_binary, adonthell-0.3)
- if test x$adonthell_binary = x ; then
+ AC_PATH_PROG(adonthell_binary, adonthell-0.3, no)
+ if test "$adonthell_binary" = "no" ; then
echo "*** Waste's Edge requires the Adonthell game engine. Exiting ..."
exit 1
fi
@@ -51,17 +55,18 @@
adonthellver="$adonthell_major_ver.$adonthell_minor_ver.$adonthell_micro_ver"
AC_MSG_RESULT($adonthellver)
-if test $adonthell_major_ver -eq 0 -a $adonthell_minor_ver -eq 3 -a
$adonthell_micro_ver -gt 4 ;
+if test $adonthell_major_ver -eq 0 -a $adonthell_minor_ver -eq 3 -a
$adonthell_micro_ver -gt 5 ;
then
haveadonthell=yes
fi
if test x$haveadonthell != xyes ; then
- echo "*** This version of Waste's Edge requires Adonthell v0.3.5 or
greater!"
+ echo "*** This version of Waste's Edge requires Adonthell v0.3.6 or
greater!"
exit 1
fi
dnl Checking for the Adonthell data directory
+
if test x$adonthelldatadir = xnone; then
AC_MSG_CHECKING(for Adonthell data directory)
adonthelldatadir=`$adonthell_binary -d`
diff --git a/missing b/missing
index 6a37006..f62bbae 100755
--- a/missing
+++ b/missing
@@ -1,7 +1,10 @@
#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <address@hidden>, 1996.
+# Common wrapper for a few potentially missing GNU programs.
+
+scriptversion=2013-10-28.13; # UTC
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <address@hidden>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +17,7 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -24,313 +25,191 @@
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
-run=:
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
- configure_ac=configure.ac
-else
- configure_ac=configure.in
-fi
+case $1 in
-case "$1" in
---run)
- # Try to run requested program, and just exit if it succeeds.
- run=
- shift
- "$@" && exit 0
- ;;
-esac
+ --is-lightweight)
+ # Used by our autoconf macros to check whether the available missing
+ # script is modern enough.
+ exit 0
+ ;;
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
+ --run)
+ # Back-compat with the calling convention used by older automake.
+ shift
+ ;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
- --run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
- help2man touch the output file
- lex create \`lex.yy.c', if possible, from existing .c
- makeinfo touch the output file
- tar try tar, gnutar, gtar, then tar without non-portable flags
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ aclocal autoconf autoheader autom4te automake makeinfo
+ bison yacc flex lex help2man
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to <address@hidden>."
+ exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing 0.4 - GNU automake"
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
;;
-*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "$0: unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
- aclocal*)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified \`${configure_ac}'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p'
${configure_ac}`
- test -z "$files" && files="config.h"
- touch_files=
- for f in $files; do
- case "$f" in
- *:*) touch_files="$touch_files "`echo "$f" |
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
- *) touch_files="$touch_files $f.in";;
- esac
- done
- touch $touch_files
- ;;
-
- automake*)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print |
- sed 's/\.am$/.in/' |
- while read f; do touch "$f"; done
- ;;
-
- autom4te)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
- echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
- proper tools for further handling them.
- You can get \`$1Help2man' as part of \`Autoconf' from any GNU
- archive site."
-
- file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
- test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo "#! /bin/sh"
- echo "# Created by GNU Automake missing as a replacement of"
- echo "# $ $@"
- echo "exit 0"
- chmod +x $file
- exit 1
- fi
- ;;
-
- bison|yacc)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified a \`.y' file. You may need the \`Bison' package
- in order for those modifications to take effect. You can get
- \`Bison' from any GNU archive site."
- rm -f y.tab.c y.tab.h
- if [ $# -ne 1 ]; then
- eval LASTARG="\${$#}"
- case "$LASTARG" in
- *.y)
- SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" y.tab.c
- fi
- SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" y.tab.h
- fi
- ;;
- esac
- fi
- if [ ! -f y.tab.h ]; then
- echo >y.tab.h
- fi
- if [ ! -f y.tab.c ]; then
- echo 'main() { return 0; }' >y.tab.c
- fi
- ;;
-
- lex|flex)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified a \`.l' file. You may need the \`Flex' package
- in order for those modifications to take effect. You can get
- \`Flex' from any GNU archive site."
- rm -f lex.yy.c
- if [ $# -ne 1 ]; then
- eval LASTARG="\${$#}"
- case "$LASTARG" in
- *.l)
- SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" lex.yy.c
- fi
- ;;
- esac
- fi
- if [ ! -f lex.yy.c ]; then
- echo 'main() { return 0; }' >lex.yy.c
- fi
- ;;
-
- help2man)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified a dependency of a manual page. You may need the
- \`Help2man' package in order for those modifications to take
- effect. You can get \`Help2man' from any GNU archive site."
-
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
- fi
- if [ -f "$file" ]; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo ".ab help2man is required to generate this page"
- exit 1
- fi
- ;;
-
- makeinfo)
- if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
- # We have makeinfo, but it failed.
- exit 1
- fi
-
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/address@hidden/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
- fi
- touch $file
- ;;
-
- tar)
- shift
- if test -n "$run"; then
- echo 1>&2 "ERROR: \`tar' requires --run"
- exit 1
- fi
-
- # We have already tried tar in the generic part.
- # Look for gnutar/gtar before invocation to avoid ugly error
- # messages.
- if (gnutar --version > /dev/null 2>&1); then
- gnutar "$@" && exit 0
- fi
- if (gtar --version > /dev/null 2>&1); then
- gtar "$@" && exit 0
- fi
- firstarg="$1"
- if shift; then
- case "$firstarg" in
- *o*)
- firstarg=`echo "$firstarg" | sed s/o//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- case "$firstarg" in
- *h*)
- firstarg=`echo "$firstarg" | sed s/h//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- fi
+esac
- echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
- You may want to install GNU tar or Free paxutils, or check the
- command line arguments."
- exit 1
- ;;
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch. This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+ msg="probably too old"
+elif test $st -eq 127; then
+ # Program was missing.
+ msg="missing on your system"
+else
+ # Program was found and executed, but failed. Give up.
+ exit $st
+fi
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequirements for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+ case $1 in
+ aclocal|automake)
+ echo "The '$1' program is part of the GNU Automake package:"
+ echo "<$gnu_software_URL/automake>"
+ echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/autoconf>"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ autoconf|autom4te|autoheader)
+ echo "The '$1' program is part of the GNU Autoconf package:"
+ echo "<$gnu_software_URL/autoconf/>"
+ echo "It also requires GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ esac
+}
+
+give_advice ()
+{
+ # Normalize program name to check for.
+ normalized_program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+ printf '%s\n' "'$1' is $msg."
+
+ configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+ case $normalized_program in
+ autoconf*)
+ echo "You should only need it if you modified 'configure.ac',"
+ echo "or m4 files included by it."
+ program_details 'autoconf'
+ ;;
+ autoheader*)
+ echo "You should only need it if you modified 'acconfig.h' or"
+ echo "$configure_deps."
+ program_details 'autoheader'
+ ;;
+ automake*)
+ echo "You should only need it if you modified 'Makefile.am' or"
+ echo "$configure_deps."
+ program_details 'automake'
+ ;;
+ aclocal*)
+ echo "You should only need it if you modified 'acinclude.m4' or"
+ echo "$configure_deps."
+ program_details 'aclocal'
+ ;;
+ autom4te*)
+ echo "You might have modified some maintainer files that require"
+ echo "the 'autom4te' program to be rebuilt."
+ program_details 'autom4te'
+ ;;
+ bison*|yacc*)
+ echo "You should only need it if you modified a '.y' file."
+ echo "You may want to install the GNU Bison package:"
+ echo "<$gnu_software_URL/bison/>"
+ ;;
+ lex*|flex*)
+ echo "You should only need it if you modified a '.l' file."
+ echo "You may want to install the Fast Lexical Analyzer package:"
+ echo "<$flex_URL>"
+ ;;
+ help2man*)
+ echo "You should only need it if you modified a dependency" \
+ "of a man page."
+ echo "You may want to install the GNU Help2man package:"
+ echo "<$gnu_software_URL/help2man/>"
;;
-esac
-
-exit 0
+ makeinfo*)
+ echo "You should only need it if you modified a '.texi' file, or"
+ echo "any other file indirectly affecting the aspect of the manual."
+ echo "You might want to install the Texinfo package:"
+ echo "<$gnu_software_URL/texinfo/>"
+ echo "The spurious makeinfo call might also be the consequence of"
+ echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+ echo "want to install GNU make:"
+ echo "<$gnu_software_URL/make/>"
+ ;;
+ *)
+ echo "You might have modified some files without having the proper"
+ echo "tools for further handling them. Check the 'README' file, it"
+ echo "often tells you about the needed prerequisites for installing"
+ echo "this package. You may also peek at any GNU archive site, in"
+ echo "case some other package contains this missing '$1' program."
+ ;;
+ esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+ -e '2,$s/^/ /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 662da2c..f87cfb8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -40,6 +40,7 @@ scripts/modules/player_text.py
# --misc stuff
scripts/modules/character_screen.py
+scripts/modules/option_screen.py
scripts/modules/intro.py
scripts/modules/main_menu.py
scripts/game_events/search_chest.py
diff --git a/scripts/modules/Makefile.am b/scripts/modules/Makefile.am
index e0be1f7..cc45ea0 100755
--- a/scripts/modules/Makefile.am
+++ b/scripts/modules/Makefile.am
@@ -3,7 +3,7 @@ pkgdatadir = $(gamedatadir)/scripts/modules
pkgdata_DATA = *.pyc
EXTRA_DIST = console.py main_menu.py events.py character_screen.py intro.py \
- player_text.py
+ player_text.py option_screen.py
all:
$(adonthell_binary) -c
diff --git a/scripts/modules/main_menu.py b/scripts/modules/main_menu.py
index 25c543f..33a79c4 100755
--- a/scripts/modules/main_menu.py
+++ b/scripts/modules/main_menu.py
@@ -13,6 +13,7 @@
#
from adonthell import *
+from modules import option_screen
# -- pygettext support
def _(message): return nls_translate (message)
@@ -94,8 +95,6 @@ class main_menu (win_container):
self.options.set_text (_("Options"))
self.options.move (-self.options.length (), y_pos)
self.options.pack()
- self.options.set_can_be_selected (False)
- self.options.set_brightness (True)
self.options.thisown = 0
y_pos = y_pos + 30
@@ -168,9 +167,6 @@ class main_menu (win_container):
label.move (label.x () - 70, label.y () - 10)
self.select.add (label)
- # -- cleanup
- del self.labels
-
# -- add the title
self.set_align (win_base_ALIGN_CENTER)
self.add (self.a_title)
@@ -214,9 +210,8 @@ class main_menu (win_container):
lg = data_screen (LOAD_SCREEN)
lg.set_activate (True)
- # -- hide the game menu if we are not on the title screen
- if self.enable_save == 1:
- self.set_visible (False)
+ # -- hide the game menu
+ self.set_visible (False)
# -- open the Load screen
gamedata_engine ().main (lg, "load_screen")
@@ -224,6 +219,7 @@ class main_menu (win_container):
# -- if we are on the title screen, only close the
# game menu if a game has been loaded
if self.enable_save == 0 and lg.get_result () == 0:
+ self.set_visible (True)
return
# -- Save Game
@@ -234,8 +230,25 @@ class main_menu (win_container):
# -- hide the game menu
self.set_visible (False)
- # -- open the Load screen
+ # -- open the save screen
gamedata_engine ().main (lg, "save_screen")
+
+ # -- Settings
+ elif self.retval == 4:
+ lg = option_screen.option_screen()
+ lg.set_activate (True)
+
+ # -- hide the game menu
+ self.set_visible (False)
+
+ # -- open the settings screen
+ gamedata_engine ().main (lg, "option_screen")
+
+ if lg.language_changed():
+ self.update_labels()
+
+ self.set_visible (True)
+ return
# -- close the main menu
gamedata_engine ().main_quit ()
@@ -264,5 +277,23 @@ class main_menu (win_container):
return done
+ def update_labels(self):
+ # -- change label text
+ if self.enable_save == 0:
+ self.new_game.set_text (_("New Game"))
+ else:
+ self.new_game.set_text (_("Continue"))
+ self.save_game.set_text (_("Save Game"))
+
+ self.load_game.set_text (_("Load Game"))
+ self.options.set_text (_("Options"))
+ self.labquit.set_text (_("Quit"))
+
+ # -- center labels again
+ for label in self.labels:
+ label.pack()
+ label.move ((self.select.length()-label.length())//2, label.y ())
+
def __del__ (self):
- pass
+ # -- cleanup
+ del self.labels
diff --git a/scripts/modules/option_screen.py b/scripts/modules/option_screen.py
new file mode 100644
index 0000000..8d0bdb9
--- /dev/null
+++ b/scripts/modules/option_screen.py
@@ -0,0 +1,228 @@
+#
+# $Id$
+#
+# (C) Copyright 2016 Kai Sterker <address@hidden>
+# Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY.
+#
+# See the COPYING file for more details
+#
+
+import adonthell
+
+# -- pygettext support
+def _(message): return adonthell.nls_translate (message)
+
+# -- GUI for changing the most important game settings
+class option_screen (adonthell.win_container):
+
+ # -- Constructor
+ def __init__(self):
+ adonthell.win_container.__init__(self)
+
+ # -- list of supprted languages
+ # Default will try to use the system language
+ # English is the builtin language, so uses the C locale
+ # Others are the actual translations that are included
+ self.languages = [ \
+ ("", _("Default")), \
+ ("C", "English"), \
+ ("da_DA", "Dansk"), \
+ ("it_IT", "Italiano"), \
+ ("nl_NL", "Nederlands")]
+
+ self.current_values = []
+ self.config = adonthell.config()
+ if not self.config.read_adonthellrc():
+ return
+
+ self.initial_language = self.config.language
+
+ # -- get font and theme
+ self.font = adonthell.win_manager_get_font ("original")
+ self.theme = adonthell.win_manager_get_theme ("original")
+
+ self.move (50, 55)
+ self.resize (220, 120)
+ self.set_border (self.theme)
+ self.set_background (self.theme)
+ self.set_trans_background (True)
+
+ # -- list of options
+ self.option_list = adonthell.win_select()
+ self.option_list.move (10, 5)
+ self.option_list.resize (200, 110)
+ self.option_list.set_layout (adonthell.win_container_LIST_LAYOUT)
+ self.option_list.thisown = 0
+
+ # -- activate the list
+ self.option_list.set_activate (True)
+
+ # -- give focus to the list
+ self.add(self.option_list)
+ self.set_focus_object (self.option_list)
+
+ self.option_list.py_signal_connect (self.save_settings,
adonthell.win_event_ACTIVATE_KEY)
+
+ if self.config.screen_mode == 0:
+ screen_mode = _("Windowed")
+ else:
+ screen_mode = _("Fullscreen")
+
+ language = _("Default")
+ for x in self.languages:
+ if self.config.language == x[0]:
+ language = x[1]
+ break
+
+ # -- add options
+ self.option_list.add(self.make_option(_("Screen Mode"), screen_mode))
+ self.option_list.add(self.make_option(_("Music Volume"),
str(self.config.audio_volume)))
+ self.option_list.add(self.make_option(_("Language"), language))
+ self.option_list.add(self.make_option(None, _("Save")))
+
+ # -- set everything visible
+ self.set_visible_background (True)
+ self.set_visible_border (True)
+ self.set_visible_all (True)
+ self.set_activate (True)
+
+ self.py_signal_connect (self.on_update, adonthell.win_event_UPDATE)
+
+ def language_changed(self):
+ return self.initial_language != self.config.language
+
+ def make_option(self, name, value):
+ container = adonthell.win_container()
+ container.thisown = 0
+
+ if name != None:
+ label1 = adonthell.win_label()
+ label1.resize (0, 20)
+ label1.move (4, 0)
+ label1.set_font (self.font)
+ label1.set_form (adonthell.label_AUTO_SIZE)
+ label1.set_text (name)
+ label1.pack ()
+ label1.thisown = 0
+
+ label2 = adonthell.win_label()
+ label2.resize (10, 20)
+ label2.move (85, 0)
+ label2.set_font (self.font)
+ label2.set_text ("<")
+ label2.pack ()
+ label2.thisown = 0
+
+ label3 = adonthell.win_label()
+ label3.resize (10, 20)
+ label3.move (185, 0)
+ label3.set_font (self.font)
+ label3.set_text (">")
+ label3.pack ()
+ label3.thisown = 0
+
+ container.add(label1)
+ container.add(label2)
+ container.add(label3)
+
+ label4 = adonthell.win_label()
+ label4.resize (0, 20)
+ label4.set_font (self.font)
+ label4.set_form (adonthell.label_AUTO_SIZE)
+ label4.set_text (value)
+ label4.pack ()
+ label4.move (95 + (90 - label4.length())//2, 0)
+ label4.thisown = 0
+
+ self.current_values.append(label4)
+
+ container.add(label4)
+ container.move(0, 0)
+ container.resize (200, 15)
+ container.set_visible_all (True)
+
+ return container
+
+ # -- save and close settings
+ def save_settings(self):
+ if self.option_list.get_selected_position() == 4:
+ self.config.write_adonthellrc()
+ adonthell.gamedata_engine ().main_quit ()
+
+ # -- callback for custom updating
+ def on_update (self):
+ # -- pressing ESC will close settings without saving
+ if adonthell.input_has_been_pushed (adonthell.SDLK_ESCAPE):
+ adonthell.gamedata_engine ().main_quit ()
+ elif adonthell.input_has_been_pushed (adonthell.SDLK_LEFT):
+ self.change_value(-1)
+ elif adonthell.input_has_been_pushed (adonthell.SDLK_RIGHT):
+ self.change_value(1)
+
+ def change_value (self, increment):
+ label = None
+ option = self.option_list.get_selected_position()
+
+ if option == 1:
+ label = self.current_values[option-1]
+ # -- Screen Mode
+ if adonthell.screen.is_fullscreen():
+ if adonthell.screen.set_fullscreen(False):
+ label.set_text(_("Windowed"))
+ self.config.screen_mode = 0
+ else:
+ if adonthell.screen.set_fullscreen(True):
+ label.set_text(_("Fullscreen"))
+ self.config.screen_mode = 1
+
+ elif option == 2:
+ # -- Volume
+ if self.config.audio_volume == 0 and increment < 0 or \
+ self.config.audio_volume == 100 and increment > 0:
+ return
+
+ self.config.audio_volume = self.config.audio_volume + increment
+ if self.config.audio_volume == 0:
+ adonthell.audio.cleanup()
+ elif self.config.audio_volume == 1:
+ adonthell.audio.init(self.config)
+ else:
+ adonthell.audio.set_background_volume(self.config.audio_volume)
+
+ label = self.current_values[option-1]
+ label.set_text(str(self.config.audio_volume))
+
+ elif option == 3:
+ # -- Language
+ label = self.current_values[option-1]
+ language = label.text_char()
+ new_language = self.languages[0]
+
+ if increment < 0:
+ prev = self.languages[-1]
+ for x in self.languages:
+ if language == x[1]:
+ new_language = prev
+ break
+ prev = x
+ else:
+ next = self.languages[0]
+ for x in reversed(self.languages):
+ if language == x[1]:
+ new_language = next
+ break
+ next = x
+
+ self.config.language = new_language[0]
+ adonthell.nls_set_language(new_language[0])
+ label.set_text(new_language[1])
+
+ if label != None:
+ label.pack ()
+ label.move (100 + (80 - label.length())//2, 0)
+
\ No newline at end of file
- [adonthell-wastesedge-commits] remove_sdl1_2 e011a99 24/29: ADDED window to display locked/unlocked achievements, (continued)
- [adonthell-wastesedge-commits] remove_sdl1_2 e011a99 24/29: ADDED window to display locked/unlocked achievements, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 3c0a585 08/29: FIXED deprecated Copyright keyword (Thanks Mathieu!), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 3c8ad19 25/29: UPDATED README and assorted files, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 8aa7e16 01/29: UPDATED installer script for Waste's Edge v0.3.4 and NSIS 2.x, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 8f52c98 04/29: FIXED compile error (thanks Clément Plantier), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 b673eec 07/29: UPDATED for adonthell version 0.3.5, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 bca7c91 10/29: UPDATED configure.in to use sed instead of more (Thanks Mathieu!), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 c27acc3 09/29: ADDED wastesedge.desktop file (Thanks Mathieu!), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 98147de 27/29: FIXED extro cutscene not running smoothly and not quite in sync with music, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 7a67abf 18/29: FIXED running with Python 2.x, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 89bc14a 17/29: ADDED settings screen to toggle Fullscreen/Window mode, Music Volume and Language,
Kai Sterker <=
- [adonthell-wastesedge-commits] remove_sdl1_2 26039dc 28/29: ADDED abilitiy to skip forest sequence and credits, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 172fa18 13/29: FIXED typo in dialogue (thanks Joe!), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] remove_sdl1_2 8d0eadc 26/29: FIXED Erek potentially getting stuck in cellar hallway (hopefully!), Kai Sterker, 2016/07/25