[Tux4kids-commits] r277 - in tuxmath/trunk: docs src

dbruce-guest at alioth.debian.org dbruce-guest at alioth.debian.org
Sat Sep 29 00:12:03 UTC 2007


Author: dbruce-guest
Date: 2007-09-29 00:12:03 +0000 (Sat, 29 Sep 2007)
New Revision: 277

Modified:
   tuxmath/trunk/docs/changelog
   tuxmath/trunk/src/Makefile.am
   tuxmath/trunk/src/Makefile.in
   tuxmath/trunk/src/highscore.c
   tuxmath/trunk/src/titlescreen.c
   tuxmath/trunk/src/titlescreen.h
Log:
More high score table stuff, correction of src/Makefile.am


Modified: tuxmath/trunk/docs/changelog
===================================================================
--- tuxmath/trunk/docs/changelog	2007-09-27 15:50:09 UTC (rev 276)
+++ tuxmath/trunk/docs/changelog	2007-09-29 00:12:03 UTC (rev 277)
@@ -1,4 +1,19 @@
-2007.Sep.88 (svn.debian.org/tux4kids - revision 260)
+2007.Sep.28 (svn.debian.org/tux4kids - revision 277)
+  Game:
+    * Completed implementation of high score table and 
+      reorganized related code into highscore.c/h.
+  Code:
+    * Re-implemented DrawButton in more flexible, 
+      generalized, and basically correct fashion - now
+      supports drawing of nice rounded rectangles with
+      any size, corner radius, RGB color, and alpha
+      channel.
+    * Added ConvertUTF.c/.h from Unicode, Inc to support
+      conversions between UTF-8 and wchar_t.
+    
+      David Bruce <dbruce at tampabay.rr.com>
+
+2007.Sep.18 (svn.debian.org/tux4kids - revision 260)
   Build:
     * Modified Makefile.am and data/fonts/Makefile.am to
       support building dist tarball either with font

Modified: tuxmath/trunk/src/Makefile.am
===================================================================
--- tuxmath/trunk/src/Makefile.am	2007-09-27 15:50:09 UTC (rev 276)
+++ tuxmath/trunk/src/Makefile.am	2007-09-29 00:12:03 UTC (rev 277)
@@ -10,15 +10,25 @@
 bin_PROGRAMS = tuxmath
 endif
 
-TuxMath_SOURCES = tuxmath.c setup.c titlescreen.c game.c \
-		options.c credits.c playsound.c highscore.c \
-		theme.c loaders.c alphabet.c pause.c audio.c \
-                mathcards.c fileops.c ConvertUTF.c tuxmathrc.rc
+tuxmath_SOURCES = tuxmath.c \
+	setup.c 	\
+	titlescreen.c	\
+	game.c 		\
+	options.c	\
+	credits.c	\
+	playsound.c	\
+	highscore.c	\
+	theme.c		\
+	loaders.c	\
+	alphabet.c	\
+	pause.c		\
+	audio.c 	\
+	mathcards.c	\
+	fileops.c	\
+	ConvertUTF.c	\
+	SDL_extras.c
 
-tuxmath_SOURCES = tuxmath.c setup.c titlescreen.c game.c \
-		options.c credits.c playsound.c highscore.c \
-		theme.c loaders.c alphabet.c pause.c audio.c \
-                mathcards.c fileops.c ConvertUTF.c SDL_extras.c
+TuxMath_SOURCES  = $(tuxmath_SOURCES) tuxmathrc.rc
 
 EXTRA_DIST = 	credits.h 	\
 		fileops.h 	\

Modified: tuxmath/trunk/src/Makefile.in
===================================================================
--- tuxmath/trunk/src/Makefile.in	2007-09-27 15:50:09 UTC (rev 276)
+++ tuxmath/trunk/src/Makefile.in	2007-09-29 00:12:03 UTC (rev 277)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,15 +15,11 @@
 @SET_MAKE@
 
 
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
 install_sh_SCRIPT = $(install_sh) -c
@@ -54,12 +50,13 @@
 am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
-am_TuxMath_OBJECTS = tuxmath.$(OBJEXT) setup.$(OBJEXT) \
+am__objects_1 = tuxmath.$(OBJEXT) setup.$(OBJEXT) \
 	titlescreen.$(OBJEXT) game.$(OBJEXT) options.$(OBJEXT) \
 	credits.$(OBJEXT) playsound.$(OBJEXT) highscore.$(OBJEXT) \
 	theme.$(OBJEXT) loaders.$(OBJEXT) alphabet.$(OBJEXT) \
 	pause.$(OBJEXT) audio.$(OBJEXT) mathcards.$(OBJEXT) \
-	fileops.$(OBJEXT) ConvertUTF.$(OBJEXT)
+	fileops.$(OBJEXT) ConvertUTF.$(OBJEXT) SDL_extras.$(OBJEXT)
+am_TuxMath_OBJECTS = $(am__objects_1)
 TuxMath_OBJECTS = $(am_TuxMath_OBJECTS)
 TuxMath_LDADD = $(LDADD)
 am_tuxmath_OBJECTS = tuxmath.$(OBJEXT) setup.$(OBJEXT) \
@@ -70,7 +67,7 @@
 	fileops.$(OBJEXT) ConvertUTF.$(OBJEXT) SDL_extras.$(OBJEXT)
 tuxmath_OBJECTS = $(am_tuxmath_OBJECTS)
 tuxmath_LDADD = $(LDADD)
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -81,25 +78,24 @@
 DIST_SOURCES = $(TuxMath_SOURCES) $(tuxmath_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
-	install-exec-recursive install-info-recursive \
-	install-recursive installcheck-recursive installdirs-recursive \
-	pdf-recursive ps-recursive uninstall-info-recursive \
-	uninstall-recursive
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
 HEADERS = $(noinst_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BUILD_MINGW32_FALSE = @BUILD_MINGW32_FALSE@
-BUILD_MINGW32_TRUE = @BUILD_MINGW32_TRUE@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -114,6 +110,7 @@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -123,15 +120,12 @@
 LIBS = @LIBS@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
 NAME_VERSION = @NAME_VERSION@
 NSIS = @NSIS@
-NSI_BUILD_FALSE = @NSI_BUILD_FALSE@
-NSI_BUILD_TRUE = @NSI_BUILD_TRUE@
 NSI_DLL_DIR = @NSI_DLL_DIR@
 NSI_INSTALL_DIR = @NSI_INSTALL_DIR@
 NSI_TUXMATH_CONF_DIR = @NSI_TUXMATH_CONF_DIR@
-NSI_USE_TUXMATH_CONF_FALSE = @NSI_USE_TUXMATH_CONF_FALSE@
-NSI_USE_TUXMATH_CONF_TRUE = @NSI_USE_TUXMATH_CONF_TRUE@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -152,9 +146,11 @@
 
 # SUBDIRS = po
 WINDRES = @WINDRES@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -166,6 +162,7 @@
 build_cpu = @build_cpu@
 build_os = @build_os@
 build_vendor = @build_vendor@
+builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
@@ -193,24 +190,36 @@
 psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 SUBDIRS = po
 @BUILD_MINGW32_FALSE at TUXMATHRC = 
-TuxMath_SOURCES = tuxmath.c setup.c titlescreen.c game.c \
-		options.c credits.c playsound.c highscore.c \
-		theme.c loaders.c alphabet.c pause.c audio.c \
-                mathcards.c fileops.c ConvertUTF.c tuxmathrc.rc
+tuxmath_SOURCES = tuxmath.c \
+	setup.c 	\
+	titlescreen.c	\
+	game.c 		\
+	options.c	\
+	credits.c	\
+	playsound.c	\
+	highscore.c	\
+	theme.c		\
+	loaders.c	\
+	alphabet.c	\
+	pause.c		\
+	audio.c 	\
+	mathcards.c	\
+	fileops.c	\
+	ConvertUTF.c	\
+	SDL_extras.c
 
-tuxmath_SOURCES = tuxmath.c setup.c titlescreen.c game.c \
-		options.c credits.c playsound.c highscore.c \
-		theme.c loaders.c alphabet.c pause.c audio.c \
-                mathcards.c fileops.c ConvertUTF.c SDL_extras.c
-
+TuxMath_SOURCES = $(tuxmath_SOURCES) tuxmathrc.rc
 EXTRA_DIST = credits.h 	\
 		fileops.h 	\
 		game.h		\
@@ -265,7 +274,7 @@
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
 	@list='$(bin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
 	  if test -f $$p \
@@ -288,10 +297,10 @@
 	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
 TuxMath$(EXEEXT): $(TuxMath_OBJECTS) $(TuxMath_DEPENDENCIES) 
 	@rm -f TuxMath$(EXEEXT)
-	$(LINK) $(TuxMath_LDFLAGS) $(TuxMath_OBJECTS) $(TuxMath_LDADD) $(LIBS)
+	$(LINK) $(TuxMath_OBJECTS) $(TuxMath_LDADD) $(LIBS)
 tuxmath$(EXEEXT): $(tuxmath_OBJECTS) $(tuxmath_DEPENDENCIES) 
 	@rm -f tuxmath$(EXEEXT)
-	$(LINK) $(tuxmath_LDFLAGS) $(tuxmath_OBJECTS) $(tuxmath_LDADD) $(LIBS)
+	$(LINK) $(tuxmath_OBJECTS) $(tuxmath_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -318,19 +327,18 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tuxmath.Po at am__quote@
 
 .c.o:
- at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
- at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
- at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
- at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
-uninstall-info-am:
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -363,8 +371,7 @@
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
+$(RECURSIVE_CLEAN_TARGETS):
 	@failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
@@ -465,22 +472,21 @@
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-	list='$(DISTFILES)'; for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-	  esac; \
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-	    dir="/$$dir"; \
-	    $(mkdir_p) "$(distdir)$$dir"; \
-	  else \
-	    dir=''; \
-	  fi; \
 	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
 	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
 	    fi; \
@@ -494,7 +500,7 @@
 	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
 	    test -d "$(distdir)/$$subdir" \
-	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
 	    || exit 1; \
 	    distdir=`$(am__cd) $(distdir) && pwd`; \
 	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
@@ -502,6 +508,8 @@
 	      $(MAKE) $(AM_MAKEFLAGS) \
 	        top_distdir="$$top_distdir" \
 	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -512,7 +520,7 @@
 installdirs: installdirs-recursive
 installdirs-am:
 	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-recursive
 install-exec: install-exec-recursive
@@ -560,12 +568,20 @@
 
 install-data-am:
 
+install-dvi: install-dvi-recursive
+
 install-exec-am: install-binPROGRAMS
 
+install-html: install-html-recursive
+
 install-info: install-info-recursive
 
 install-man:
 
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -585,23 +601,25 @@
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+uninstall-am: uninstall-binPROGRAMS
 
-uninstall-info: uninstall-info-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
-	clean clean-binPROGRAMS clean-generic clean-recursive ctags \
-	ctags-recursive distclean distclean-compile distclean-generic \
-	distclean-recursive distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-binPROGRAMS \
-	install-data install-data-am install-exec install-exec-am \
-	install-info install-info-am install-man install-strip \
-	installcheck installcheck-am installdirs installdirs-am \
-	maintainer-clean maintainer-clean-generic \
-	maintainer-clean-recursive mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am \
-	uninstall-binPROGRAMS uninstall-info-am
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic ctags ctags-recursive distclean \
+	distclean-compile distclean-generic distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am \
+	uninstall-binPROGRAMS
 
 
 # How to make an RC file

Modified: tuxmath/trunk/src/highscore.c
===================================================================
--- tuxmath/trunk/src/highscore.c	2007-09-27 15:50:09 UTC (rev 276)
+++ tuxmath/trunk/src/highscore.c	2007-09-29 00:12:03 UTC (rev 277)
@@ -50,15 +50,11 @@
   unsigned char score_strings[HIGH_SCORES_SAVED][HIGH_SCORE_NAME_LENGTH + 10] = {{'\0'}};
 
   SDL_Rect score_rects[HIGH_SCORES_SAVED];
-  SDL_Rect leftRect, rightRect, stopRect, TuxRect;
+  SDL_Rect leftRect, rightRect, stopRect, TuxRect, table_bg;
 
-  SDL_Rect table_bg,
-           Titledest,
-           cursor;
 
-  int max_width = 300;
+  const int max_width = 300;
   int score_table_y = 100;
-  const int diff_level_y = 50;
 
   sprite* Tux = LoadSprite("tux/bigtux", IMG_ALPHA);
 
@@ -343,14 +339,13 @@
 /* multibyte encoding.                                                    */
 void HighScoreNameEntry(unsigned char* pl_name)
 {
-  SDL_Surface *s1, *s2, *s3, *s4;
+  unsigned char UTF8_buf[HIGH_SCORE_NAME_LENGTH * 3] = {'\0'};
+
   SDL_Rect loc;
   SDL_Rect redraw_rect;
-  SDL_Rect dest,
-           Tuxdest,
+  SDL_Rect TuxRect,
            Titledest,
-           stopRect,
-           cursor;
+           stopRect;
 
   int redraw = 0;
   int first_draw = 1;
@@ -358,19 +353,17 @@
   int tux_frame = 0;
   Uint32 frame = 0;
   Uint32 start = 0;
-  char* str1, *str2, *str3, *str4;
   wchar_t wchar_buf[HIGH_SCORE_NAME_LENGTH + 1] = {'\0'};
-  unsigned char UTF8_buf[HIGH_SCORE_NAME_LENGTH * 3] = {'\0'};
   TTF_Font* name_font = NULL;
   const int NAME_FONT_SIZE = 32;
+  const int BG_Y = 100;
+  const int BG_WIDTH = 400;
+  const int BG_HEIGHT = 200;
 
   sprite* Tux = LoadSprite("tux/bigtux", IMG_ALPHA);
 
   if (!pl_name)
     return;
-  
-  s1 = s2 = s3 = s4 = NULL;
-  str1 = str2  = str3 = str4 = NULL;
 
   name_font = LoadFont(DEFAULT_FONT_NAME, NAME_FONT_SIZE);
   if (!name_font)
@@ -383,23 +376,10 @@
   fprintf(stderr, "\nEnter HighScoreNameEntry()\n" );
 #endif
 
-  str1 = _("Great Score - You Are In The Hall of Fame!");
-  str2 = _("Enter Your Name:");
 
-  if (str1)
-    s1 = BlackOutline(str1, default_font, &white);
-  if (str2)
-    s2 = BlackOutline(str2, default_font, &white);
-  if (str3)
-    s3 = BlackOutline(str3, default_font, &white);
-  /* When we get going with i18n may need to modify following - see below: */
-  if (str4)
-    s4 = BlackOutline(str4, default_font, &white);
-
-
-  /* Redraw background: */
+  /* Draw background: */
   if (images[IMG_MENU_BKG])
-    SDL_BlitSurface( images[IMG_MENU_BKG], NULL, screen, NULL );
+    SDL_BlitSurface(images[IMG_MENU_BKG], NULL, screen, NULL);
 
   /* Red "Stop" circle in upper right corner to go back to main menu: */
   if (images[IMG_STOP])
@@ -411,32 +391,52 @@
     SDL_BlitSurface(images[IMG_STOP], NULL, screen, &stopRect);
   }
 
-  if (Tux && Tux->num_frames) /* make sure sprite has at least one frame */
+  if (Tux && Tux->frame[0]) /* make sure sprite has at least one frame */
   {
-    SDL_BlitSurface(Tux->frame[0], NULL, screen, &Tuxdest);
+    TuxRect.w = Tux->frame[0]->w;
+    TuxRect.h = Tux->frame[0]->h;
+    TuxRect.x = 0;
+    TuxRect.y = screen->h - Tux->frame[0]->h;
   }
 
-  /* Draw lines of text (do after drawing Tux so text is in front): */
-  if (s1)
+  /* Draw translucent background for text: */
   {
-    loc.x = 320 - (s1->w/2); loc.y = 10;
-    SDL_BlitSurface( s1, NULL, screen, &loc);
+    SDL_Rect bg_rect;
+    bg_rect.x = (screen->w)/2 - BG_WIDTH/2;
+    bg_rect.y = BG_Y;
+    bg_rect.w = BG_WIDTH;
+    bg_rect.h = BG_HEIGHT;
+    DrawButton(&bg_rect, 15, REG_RGBA);
+
+    bg_rect.x += 10;
+    bg_rect.y += 10;
+    bg_rect.w -= 20;
+    bg_rect.h = 60;
+    DrawButton(&bg_rect, 10, SEL_RGBA);
   }
-  if (s2)
+
+  /* Draw heading: */
   {
-    loc.x = 320 - (s2->w/2); loc.y = 60;
-    SDL_BlitSurface( s2, NULL, screen, &loc);
+    SDL_Surface* s = BlackOutline(_("You Are In The Hall of Fame!"),
+                                  default_font, &white);
+    if (s)
+    {
+      loc.x = 320 - (s->w/2);
+      loc.y = 110;
+      SDL_BlitSurface(s, NULL, screen, &loc);
+      SDL_FreeSurface(s);
+    }
+
+    s = BlackOutline(_("Enter Your Name:"),
+                     default_font, &white);
+    if (s)
+    {
+      loc.x = 320 - (s->w/2);
+      loc.y = 140;
+      SDL_BlitSurface(s, NULL, screen, &loc);
+      SDL_FreeSurface(s);
+    }
   }
-  if (s3)
-  {
-    loc.x = 320 - (s3->w/2); loc.y = 300;
-    SDL_BlitSurface( s3, NULL, screen, &loc);
-  }
-  if (s4)
-  {
-    loc.x = 320 - (s4->w/2); loc.y = 340;
-    SDL_BlitSurface( s4, NULL, screen, &loc);
-  }
 
   /* and update: */
   SDL_UpdateRect(screen, 0, 0, 0, 0);
@@ -490,7 +490,6 @@
               break;
             }
 
-
             /* For any other keys, if the key has a Unicode value, */
             /* we add it to our string:                            */
             default:
@@ -511,11 +510,17 @@
             /* Now draw name, if needed: */
           if (redraw)
           {
+            SDL_Surface* s = NULL;
             redraw = 0;
-            /* Redraw background in area where we drew text last time: */ 
+
+            /* Convert text to UTF-8 so BlackOutline() can handle it: */
+            wcstombs((char*) UTF8_buf, wchar_buf, HIGH_SCORE_NAME_LENGTH * 3);
+
+            /* Redraw background and shading in area where we drew text last time: */ 
             if (!first_draw)
             {
               SDL_BlitSurface(images[IMG_MENU_BKG], &redraw_rect, screen, &redraw_rect);
+              DrawButton(&redraw_rect, 0, REG_RGBA);
               SDL_UpdateRect(screen,
                              redraw_rect.x,
                              redraw_rect.y,
@@ -523,22 +528,20 @@
                              redraw_rect.h);
             }
 
-            /* Convert text to UTF-8: */
-            //Unicode_to_UTF8((const wchar_t*)buf, player_name);
-            wcstombs((char*) UTF8_buf, wchar_buf, HIGH_SCORE_NAME_LENGTH * 3);
-
-            s3 = BlackOutline(UTF8_buf, name_font, &yellow);
-            if (s3)
+            s = BlackOutline(UTF8_buf, name_font, &yellow);
+            if (s)
             {
-              loc.x = 320 - (s3->w/2);
-              loc.y = 300;
-              SDL_BlitSurface( s3, NULL, screen, &loc);
+              /* set up loc and blit: */
+              loc.x = 320 - (s->w/2);
+              loc.y = 200;
+              SDL_BlitSurface(s, NULL, screen, &loc);
 
-              /* for some reason we need to update a little beyond s3 to get clean image */
+              /* Remember where we drew so we can update background next time through:  */
+              /* (for some reason we need to update a wider area to get clean image)    */
               redraw_rect.x = loc.x - 20;
               redraw_rect.y = loc.y - 10;
-              redraw_rect.h = s3->h + 20;
-              redraw_rect.w = s3->w + 40;
+              redraw_rect.h = s->h + 20;
+              redraw_rect.w = s->w + 40;
               first_draw = 0;
 
               SDL_UpdateRect(screen,
@@ -546,10 +549,9 @@
                              redraw_rect.y,
                              redraw_rect.w,
                              redraw_rect.h);
-              SDL_FreeSurface(s3);
-              s3 = NULL;
+              SDL_FreeSurface(s);
+              s = NULL;
             }
-
           }
         }
       }
@@ -569,13 +571,10 @@
 
     if (Tux && tux_frame)
     {
-      SDL_BlitSurface(Tux->frame[tux_frame - 1], NULL, screen, &Tuxdest);
-      SDL_UpdateRect(screen, Tuxdest.x+37, Tuxdest.y+40, 70, 45);
+      SDL_BlitSurface(Tux->frame[tux_frame - 1], NULL, screen, &TuxRect);
+      SDL_UpdateRect(screen, TuxRect.x, TuxRect.y, TuxRect.w, TuxRect.h);
     }
 
-
-
-
     /* Wait so we keep frame rate constant: */
     while ((SDL_GetTicks() - start) < 33)
     {
@@ -584,10 +583,6 @@
     frame++;
   }  // End of while (!finished) loop
 
-  SDL_FreeSurface(s1);
-  SDL_FreeSurface(s2);
-  SDL_FreeSurface(s3);
-  SDL_FreeSurface(s4);
   TTF_CloseFont(name_font);
   FreeSprite(Tux);
 

Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c	2007-09-27 15:50:09 UTC (rev 276)
+++ tuxmath/trunk/src/titlescreen.c	2007-09-29 00:12:03 UTC (rev 277)
@@ -552,9 +552,9 @@
       case LESSONS: /* Go to 'lessons' menu: */
                              /* i.e. Math Command Training Academy */
       {
-        /* choose_config_file() returns after selected lessons are  */
+        /* ChooseMission() returns after selected lessons are  */
         /* done - game() called from there.                         */
-        if (choose_config_file())  
+        if (ChooseMission())  
         {
           if (Opts_MenuMusic())  // Restart music after game
             audioMusicLoad( "tuxi.ogg", -1 );
@@ -1422,7 +1422,7 @@
 /* returns 0 if user pressed escape
  *         1 if config was set correctly
  */
-int choose_config_file(void)
+int ChooseMission(void)
 {
   int chosen_lesson = -1;
   menu_options menu_opts;
@@ -1845,8 +1845,8 @@
 
         /* Now set up mouse button rects: */
         menu_mouse_button_rect[imod].x = menu_text_rect[imod].x - 15;
-        menu_mouse_button_rect[imod].y = menu_text_rect[imod].y;
-        menu_mouse_button_rect[imod].h = menu_text_rect[imod].h;
+        menu_mouse_button_rect[imod].y = menu_text_rect[imod].y - 5;
+        menu_mouse_button_rect[imod].h = menu_text_rect[imod].h + 10;
         menu_mouse_button_rect[imod].w = menu_text_rect[imod].w + 30;
 	mouse_rects_are_valid = 1;
 

Modified: tuxmath/trunk/src/titlescreen.h
===================================================================
--- tuxmath/trunk/src/titlescreen.h	2007-09-27 15:50:09 UTC (rev 276)
+++ tuxmath/trunk/src/titlescreen.h	2007-09-29 00:12:03 UTC (rev 277)
@@ -237,7 +237,7 @@
 
 void TitleScreen( void );
 void switch_screen_mode( void );
-int choose_config_file(void);  //FIXME really should be in fileops.c
+int ChooseMission(void);  //FIXME really should be in fileops.c
 int choose_menu_item(const unsigned char**,int,menu_options);
 
 /* in theme.c (from tuxtype): */




More information about the Tux4kids-commits mailing list