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

David Bruce dbruce-guest at alioth.debian.org
Wed Apr 11 16:40:39 UTC 2007


Author: dbruce-guest
Date: 2007-04-11 16:40:37 +0000 (Wed, 11 Apr 2007)
New Revision: 151

Modified:
   tuxmath/trunk/configure.in
   tuxmath/trunk/docs/INSTALL.txt
   tuxmath/trunk/docs/README.txt
   tuxmath/trunk/docs/changelog
   tuxmath/trunk/src/alphabet.c
   tuxmath/trunk/src/titlescreen.c
Log:
Re-enabled game using options file; updated docs;


Modified: tuxmath/trunk/configure.in
===================================================================
--- tuxmath/trunk/configure.in	2007-04-09 22:34:35 UTC (rev 150)
+++ tuxmath/trunk/configure.in	2007-04-11 16:40:37 UTC (rev 151)
@@ -6,7 +6,7 @@
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 
-AM_INIT_AUTOMAKE(tuxmath, 1.5)
+AM_INIT_AUTOMAKE(tuxmath, 1.5.1)
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
 

Modified: tuxmath/trunk/docs/INSTALL.txt
===================================================================
--- tuxmath/trunk/docs/INSTALL.txt	2007-04-09 22:34:35 UTC (rev 150)
+++ tuxmath/trunk/docs/INSTALL.txt	2007-04-11 16:40:37 UTC (rev 151)
@@ -1,6 +1,7 @@
 INSTALL.txt for "Tux, Of Math Command" (aka "Tuxmath")
+Version 1.5.1
 
-March 5, 2007
+March 11, 2007
 
 
 Requirements
@@ -93,7 +94,7 @@
 
     Getting SDL
     -----------
-      You can download "libSDL," "SDL_image," and "SDL_mixer" from the
+      You can download "libSDL," "SDL_image," "SDL_ttf", and "SDL_mixer" from the
       SDL website:
 
       http://www.libsdl.org/
@@ -104,6 +105,7 @@
         libSDL:     http://www.libsdl.org/download-1.2.html
         SDL_image:  http://www.libsdl.org/projects/SDL_image/
         SDL_mixer:  http://www.libsdl.org/projects/SDL_mixer/
+        SDL_ttf:  http://www.libsdl.org/projects/SDL_ttf/
 
       Using SDL Packages
       ------------------
@@ -138,11 +140,11 @@
       will need the SDL dev files as noted above, as well as the GNU developer
       tools, including automake-1.9 and autotools-dev.
 
-      (Note: I have recently put some of the autogenerated files back under 
+      I have recently put some of the autogenerated files back under 
       version control, the idea being to allow building with "./configure;
       make; make install" even if autotools are not available, as may be the
-      case when trying to build for a different platform or OS.  I have not
-      yet confirmed that this works - DSB).
+      case when trying to build for a different platform or OS. Preliminary
+      testing indicates that this works fine.
 
       If you are using a deb or rpm-based distribution, your distro may have
       tuxmath in a prepared package, in which case your job is as simple as
@@ -263,4 +265,4 @@
 
      Currently, internationalization is disabled on MacOSX.
      Anyone who knows how to get the Linux internationalization
-     framework working on MacOSX is invited to contribute.
\ No newline at end of file
+     framework working on MacOSX is invited to contribute.

Modified: tuxmath/trunk/docs/README.txt
===================================================================
--- tuxmath/trunk/docs/README.txt	2007-04-09 22:34:35 UTC (rev 150)
+++ tuxmath/trunk/docs/README.txt	2007-04-11 16:40:37 UTC (rev 151)
@@ -2,24 +2,19 @@
 An educational math tutorial game starring Tux, the Linux Penguin
 -----------------------------------------------------------------
 
-NOTE: Tuxmath is under heavy construction and currently does
-not compile - the menu system is being overhauled with code from
-tuxtype. Please checkout revision 61 if you need something
-that actually builds and works - i.e.:
 
-svn checkout -r 61 https://svn.tux4kids.net/tuxmath/
 
-Nov 18, 2006
+Apri 10, 2007
 
-For tuxmath-1.0.1
+For tuxmath-1.5.1
 
 Objective
 ---------
   In "Tux, of Math Command," you play the part of Commander Tux, as he
-  defends his cities from an attack of math equations.
+  defends his friends from an attack of math equations.
 
-  Comets are crashing towards your cities, and you must destroy
-  them by solving their equations.
+  Comets are crashing towards the friendly penguins in their igloos,
+  and you must destroy the comets by solving their equations.
 
 
 
@@ -61,11 +56,14 @@
 
   Command Line Options
   --------------------
-    NOTE: editing the config file is now a much better way to control the 
-    behavior of Tuxmath - SEE BELOW.  There is also a simple GUI-based
-    config program packaged with the Windows build.
+    NOTE: Tuxmath now has many pre-packaged "missions" (lessons), as  well
+    as four arcade-style open-ended games of progressive difficulty, so
+    there is much less need to change settings.  If desired, editing the
+    config file is a much better way to control the behavior of Tuxmath
+    than the command-line options, for the most part.  However, many
+    options are still supported.
 
-    The following command-line options can be sent to the program.
+    The following command-line options can be sent to the program:
      --optionfile filename - play game based on settings in the named file (see
                          below for more on tuxmath config files). Tuxmath will
                          look for a valid config file with a matching name in
@@ -154,44 +152,46 @@
 ------------------
   Title Screen
   ------------
-    On this screen, you can choose to play the game, go to the Options
-    Screen, view the credits, or quit.
+    Math Command Training Academy: choose this to go to a list of over fifty
+    prepared lessons, starting with simple typing of single digit numbers, and
+    progressing to multiplication and division involving negatives and 
+    "missing number" questions (e.g. "-17 x ? = 119").  The player wins if the
+    question list is completed successfully.
 
-    Use the [UP] and [DOWN] arrow keys to select what you wish to do,
-    and then press [ENTER / RETURN / SPACEBAR].  Or, use the mouse to click the
-    menu item.
+    Play Arcade Game: use this to select from one of four open-ended, "Arcade 
+    Style" games, meaning the game play gets faster and faster as long as the
+    player can keep up, with the goal being to get the highest score possible.
+    The options include:
+      Space Cadet - simple addition.
+      Scout -       addition and subtraction to ten.
+      Ranger -      addition, subtraction, multiplication, and division to ten.
+      Ace -         all four operations with operands to 20, including negative
+                    numbers and "missing number" type questions.
+    The high score tables ("Hall of Fame") are partially implemented as of this
+    writing.
 
-    Pressing [ESCAPE] will quit the program.
+    Play Custom Game: use this to play a game based on the config file in the 
+    player's home directory (see below). At some point, the options will be 
+    settable from within the game.
 
+    More Options - this will be developed into the menus to set options not 
+    directly related to math questions, such as toggling the music on and off,
+    playing fullscreen vs. windowed, using cities vs. igloos, and the like.
 
-  Options Screen
-  --------------
-    On this screen, you can select some of the gameplay options or return to 
-    the Title Screen.  Currently, the four math operations can be enabled
-    or disabled, as well as the speed setting and ranges of numbers to use. 
-
     Use the [UP] and [DOWN] arrow keys to select what you wish to do,
-    and then press [ENTER / RETURN /SPACEBAR].  Or, use the mouse to click the
+    and then press [ENTER / RETURN / SPACEBAR].  Or, use the mouse to click the
     menu item.
 
-    Mouse support has been added.
+    Pressing [ESCAPE] will quit the program.
 
-    Pressing [ESCAPE] will return to the Title Screen.  Currently, there is no
-    method of doing this with the mouse.
 
 
-  Credits Screen
-  --------------
-    This screen displays the credits.  You can press [ESCAPE] to return
-    to the title screen.
 
-
-
 How To Play
 -----------
   Destroying Comets
   -----------------
-    As the comets fall towards your cities, you must solve their equations.
+    As the comets fall towards your friends, you must solve the equations.
 
     To destroy it:
     --------------
@@ -208,11 +208,10 @@
 
 
     The comet that has the number you entered as its answer will
-    be shot down by Tux the penguin.
+    be shot down by Tux!
 
     Note: Sometimes more than one comet will have the same answer.
-          In this case, the comet closest to your cities will be
-          destroyed first.  [Perhaps all should be destroyed?]
+          In this case, the lowest comet will be destroyed.
 
     Note: After typing [ENTER / RETURN], the "LED"-style display will
           automatically reset to "000" for you, so you can answer the
@@ -240,39 +239,53 @@
     or for players who cannot use a keyboard.
 
 
-  Losing A City
-  -------------
-    If a comet crashes into one of your cities before you had the
-    chance to answer its equation, the city's shields will be
-    destroyed.  If the city is hit by another comet, it will be
-    completely destroyed.
+  Losing An Igloo or City
+  -----------------------
+    The default setting is to play with igloo-dwelling penguins.
+    If a comet reaches the igloo, the igloo is partially melted.
+    A second hit melts the igloo the rest of the way, and the 
+    saddened penguin trudges off the screen.
 
+    If cities are used (by placing "use_igloos = 0" in the config
+    file and selecting "Play Custom Game"), game play is the same.
+    The first comet strike deactivates the city's shields, and the
+    second hit destroys the city. If this seems too scary or violent,
+    please use the penguin/igloo theme! 
+
+  Regaining Igloos/Cities
+  -----------------------
+    When a question is answered correctly, the player earns progress toward
+    a bonus comet that allows an igloo or city to be rebuilt.  Progress is
+    indicated with a green bar in the upper left corner of the screen. The
+    bonus comet is red and moves faster than regular comets.  If the player
+    shoots down the bonus comet, a "snowstorm" image appears in place of the
+    bonus progress bar, and one of the igloos/cities will be rebuilt after 
+    the current wave.
+
   Ending The Game
   ---------------
 
     The default mode is now to play through a defined list of questions. This
-    mode is selected by setting the config file 'play_through_list' parameter
+    mode is used in the "Training Academy" games.  For "Custom" games, it can 
+    be selected by setting the config file 'play_through_list' parameter
     to 1 ('yes' or 'true'), or via the "--playthroughlist" command line argument. 
     The list is generated by TuxMath based on a series of selectable parameters
-    (selected math operations, number ranges, etc).
-    By default, the questions are asked in a random order.  If answered
-    correctly, they are removed.  A question that is not answered correctly
-    (allowing the comet to destroy its target) will reappear in random
-    order.  If all questions are successfully answered before the cities
-    have been destroyed, the player wins and a "victory" screen is displayed.
+    (selected math operations, number ranges, etc). By default, the questions
+    are asked in a random order.  If answered correctly, they are removed.
+    A question that is not answered correctly (allowing the comet to destroy
+    its target) will reappear in random order.  If all questions are successfully
+    answered before the igloos or cities have been destroyed, the player wins
+    and a "victory" screen is displayed.
 
     The older arcade-style mode is also supported, in which the game continues
-    until you lose all of your cities.  A GAME OVER screen is then displayed.
-    Select this mode by setting 'play_through_list' to '0' ('no', 'false', 'off').
-    By pressing any key or clicking the mouse, you return to the title
-    screen.
+    until you lose all of your igloos or cities.  A GAME OVER screen is then
+    displayed. For the "Custom" games, you can select this mode by setting
+    'play_through_list' to '0' ('no', 'false', 'off').
 
-  Regaining Cities
-  ----------------
-    [ Under construction ] Briefly, there will be special "bonus comets" at
-    certain intervals that will have the effect of either activating shields or
-    rebuilding cities if answered correctly.
+    By pressing Esc or clicking on the red circle in the upper right corner, you
+    can quit the game.
 
+  
 
   Advancing Waves
   ---------------
@@ -281,9 +294,12 @@
 
 Setting Game Options
 --------------------
-  [ UNDER CONSTRUCTION ]
+  The "Options" system remains in need of an overhaul. For now, you can
+  play the pre-packaged "Lesson" or "Arcade" games, or edit the options file
+  to create a "Custom" game.  At some point the "Custom" settings will be
+  modifiable from within TuxMath.
 
-  1. The program now reads and writes the settings to disk in a human-readable
+  1. The program reads and writes the settings to disk in a human-readable
   fashion, where they can be modified with a text editor. The file is created
   in the user's home directory within a directory called ".tuxmath" and is 
   simply called "options". As an example, a user "laura" on a Unix/Linux system
@@ -291,8 +307,7 @@
   extensive comments describing all settings. By editing and saving this file,
   very extensive control over the program is supported, particularly with
   respect to generation of math questions. There really is no need to use
-  command-line options any more. In the near future, I plan to
-  include a series of "lessons" that could be played in a planned order.
+  command-line options any more.
 
   On a Windows XP or Windows 2000 system, the config file is called "options.txt"
   and is located at C:\Documents And Settings\USER\Application Data\TuxMath\options.txt,
@@ -301,18 +316,7 @@
 
   2. Many command-line options are supported (see above). 
 
-  3. The "Options" screen allows several parameters to be set at run-time,
-  or reset between individual games while the program is still running.
-  Currently supported settings include the math operations to be used for
-  questions, the starting speed, the maximum value of answers (for division
-  questions, this is the maximum size of the dividend, not actually the 
-  answer), and ranges of numbers to be used to generate questions. However,
-  many settings are only selectable via the config file.  This will be addressed
-  in a later version of the program.
-
-  4. The Windows build is packaged with a simple GUI-based config program that
-  can be used to set most of the options.
-
+  
 Setting Administrative Options
 ------------------------------
   "Tux, of Math Command" allows parents/teachers to control whether the game

Modified: tuxmath/trunk/docs/changelog
===================================================================
--- tuxmath/trunk/docs/changelog	2007-04-09 22:34:35 UTC (rev 150)
+++ tuxmath/trunk/docs/changelog	2007-04-11 16:40:37 UTC (rev 151)
@@ -1,5 +1,17 @@
 changelog for "tuxmath"
 
+2007.Apr.11 (svn.debian.org/tux4kids - revision 151)
+  Version 1.5.1
+
+  Game:
+    * Enabled play of custom game based on user's option file.
+  Graphics:
+    * Tweaked black_outline() slightly to improve font appearance.
+  Docs:
+    * Updated changelog, README.txt, INSTALL.txt.
+
+      David Bruce <dbruce at tampabay.rr.com>
+
 2007.Apr.09 (svn.debian.org/tux4kids - revision 150)
   Game:
     * Fixed lesson order bug - code now explicitly sorts the

Modified: tuxmath/trunk/src/alphabet.c
===================================================================
--- tuxmath/trunk/src/alphabet.c	2007-04-09 22:34:35 UTC (rev 150)
+++ tuxmath/trunk/src/alphabet.c	2007-04-11 16:40:37 UTC (rev 151)
@@ -152,7 +152,7 @@
                              32,
                              rmask, gmask, bmask, amask);
   /* Use color key for eventual transparency: */
-  color_key = SDL_MapRGB(bg->format, 10, 10, 10);
+  color_key = SDL_MapRGB(bg->format, 01, 01, 01);
   SDL_FillRect(bg, NULL, color_key);
 
   /* Now draw black outline/shadow 2 pixels on each side: */

Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c	2007-04-09 22:34:35 UTC (rev 150)
+++ tuxmath/trunk/src/titlescreen.c	2007-04-11 16:40:37 UTC (rev 151)
@@ -167,6 +167,7 @@
 void AddRect(SDL_Rect* src, SDL_Rect* dst);
 void InitEngine(void);
 int compare_lesson_entries(const lesson_entry* a, const lesson_entry* b);
+void ShowMessage(char* str1, char* str2, char* str3, char* str4);
 
 /***********************************************************/
 /*                                                         */
@@ -576,8 +577,12 @@
 
       case OPTIONS:
       {
-//        NotImplemented();
-//        redraw = 1;
+        char *s1, *s2, *s3, *s4;
+        s1 = _("Edit 'options' file in your home directory");
+        s2 = _("to create customized game!");
+        s3 = _("See README.txt for more information");
+        s4 = N_("tuxmath-devel at lists.sourceforge.net");
+        ShowMessage(s1, s2, s3, s4);
 
         if (read_user_config_file())
         {
@@ -1253,142 +1258,14 @@
 
 void NotImplemented(void)
 {
-  SDL_Surface *s1, *s2, *s3, *s4;
-  SDL_Rect loc;
-  int finished = 0;
-  int tux_frame = 0;
-  Uint32 frame = 0;
-  Uint32 start = 0;
+  char *s1, *s2, *s3, *s4;
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "NotImplemented() - creating text\n" );
-#endif
+  s1 = _("Work In Progress!");
+  s2 = _("This feature is not ready yet");
+  s3 = _("Discuss the future of TuxMath at");
+  s4 = N_("tuxmath-devel at lists.sourceforge.net");
 
-  s1 = black_outline( _("Work In Progress!"), default_font, &white);
-  s2 = black_outline( _("This feature is not ready yet"), default_font, &white);
-  s3 = black_outline( _("Discuss the future of TuxMath at"), default_font, &white);
-  /* When we get going with i18n may need to modify following - see below: */
-  s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", default_font, &white);
-
-//   /* we always want the URL in english */
-//   if (!useEnglish)
-//   {
-//     TTF_Font *english_font;
-//     useEnglish = 1;
-//     english_font = LoadFont( menu_font, menu_font_size );
-//     s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", english_font, &white);
-//     TTF_CloseFont(english_font);
-//     useEnglish = 0;
-//   }
-//   else 
-//   {
-//     s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", default_font, &white);
-//   }
-
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "NotImplemented() - drawing screen\n" );
-#endif
-
-  /* Draw lines of text: */
-  if (images[IMG_MENU_BKG])
-    SDL_BlitSurface( images[IMG_MENU_BKG], NULL, screen, NULL );
-  if (s1)
-  {
-    loc.x = 320-(s1->w/2); loc.y = 10;
-    SDL_BlitSurface( s1, NULL, screen, &loc);
-  }
-  if (s2)
-  {
-    loc.x = 320-(s2->w/2); loc.y = 60;
-    SDL_BlitSurface( s2, NULL, screen, &loc);
-  }
-  if (s3)
-  {
-    loc.x = 320-(s3->w/2); loc.y = 400;
-    SDL_BlitSurface( s3, NULL, screen, &loc);
-  }
-  if (s4)
-  {
-    loc.x = 320-(s4->w/2); loc.y = 440;
-    SDL_BlitSurface( s4, NULL, screen, &loc);
-  }
-
-  /* Red "Stop" circle in upper right corner to go back to main menu: */
-  if (images[IMG_STOP])
-  {
-    stopRect.w = images[IMG_STOP]->w;
-    stopRect.h = images[IMG_STOP]->h;
-    stopRect.x = screen->w - images[IMG_STOP]->w;
-    stopRect.y = 0;
-    SDL_BlitSurface(images[IMG_STOP], NULL, screen, &stopRect);
-  }
-
-  if (Tux && Tux->num_frames) /* make sure sprite has at least one frame */
-  {
-    SDL_BlitSurface(Tux->frame[0], NULL, screen, &Tuxdest);
-  }
-  SDL_UpdateRect(screen, 0, 0, 0, 0);
-
-  while (!finished)
-  {
-    start = SDL_GetTicks();
-
-    while (SDL_PollEvent(&event)) 
-    {
-      switch (event.type)
-      {
-        case SDL_QUIT:
-        {
-          cleanup();
-        }
-
-        case SDL_MOUSEBUTTONDOWN:
-        /* "Stop" button - go to main menu: */
-        { 
-          if (inRect(stopRect, event.button.x, event.button.y ))
-          {
-            finished = 1;
-            tuxtype_playsound(sounds[SND_TOCK]);
-            break;
-          }
-        }
-        case SDL_KEYDOWN:
-        {
-          finished = 1;
-          tuxtype_playsound(sounds[SND_TOCK]);
-        }
-      }
-    }
-
-    /* --- make tux blink --- */
-    switch (frame % TUX6)
-    {
-      case 0:    tux_frame = 1; break;
-      case TUX1: tux_frame = 2; break;
-      case TUX2: tux_frame = 3; break;
-      case TUX3: tux_frame = 4; break;			
-      case TUX4: tux_frame = 3; break;
-      case TUX5: tux_frame = 2; break;
-      default: tux_frame = 0;
-    }
-
-    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);
-    }
-    /* Wait so we keep frame rate constant: */
-    while ((SDL_GetTicks() - start) < 33)
-    {
-      SDL_Delay(20);
-    }
-    frame++;
-  }  // End of while (!finished) loop
-
-  SDL_FreeSurface(s1);
-  SDL_FreeSurface(s2);
-  SDL_FreeSurface(s3);
-  SDL_FreeSurface(s4);
+  ShowMessage(s1, s2, s3, s4);
 }
 
 
@@ -1632,8 +1509,157 @@
   }  // End of while (!finished) loop
 }
 
+void ShowMessage(char* str1, char* str2, char* str3, char* str4)
+{
+  SDL_Surface *s1, *s2, *s3, *s4;
+  SDL_Rect loc;
+  int finished = 0;
+  int tux_frame = 0;
+  Uint32 frame = 0;
+  Uint32 start = 0;
 
+  s1 = s2 = s3 = s4 = NULL;
 
+#ifdef TUXMATH_DEBUG
+  fprintf(stderr, "ShowMessage() - creating text\n" );
+#endif
+
+  if (str1)
+    s1 = black_outline(str1, default_font, &white);
+  if (str2)
+    s2 = black_outline(str2, default_font, &white);
+  if (str3)
+    s3 = black_outline(str3, default_font, &white);
+  /* When we get going with i18n may need to modify following - see below: */
+  if (str4)
+    s4 = black_outline(str4, default_font, &white);
+
+//   /* we always want the URL in english */
+//   if (!useEnglish)
+//   {
+//     TTF_Font *english_font;
+//     useEnglish = 1;
+//     english_font = LoadFont( menu_font, menu_font_size );
+//     s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", english_font, &white);
+//     TTF_CloseFont(english_font);
+//     useEnglish = 0;
+//   }
+//   else 
+//   {
+//     s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", default_font, &white);
+//   }
+
+#ifdef TUXMATH_DEBUG
+  fprintf(stderr, "NotImplemented() - drawing screen\n" );
+#endif
+
+  /* Draw lines of text: */
+  if (images[IMG_MENU_BKG])
+    SDL_BlitSurface( images[IMG_MENU_BKG], NULL, screen, NULL );
+  if (s1)
+  {
+    loc.x = 320-(s1->w/2); loc.y = 10;
+    SDL_BlitSurface( s1, NULL, screen, &loc);
+  }
+  if (s2)
+  {
+    loc.x = 320-(s2->w/2); loc.y = 60;
+    SDL_BlitSurface( s2, NULL, screen, &loc);
+  }
+  if (s3)
+  {
+    loc.x = 320-(s3->w/2); loc.y = 400;
+    SDL_BlitSurface( s3, NULL, screen, &loc);
+  }
+  if (s4)
+  {
+    loc.x = 320-(s4->w/2); loc.y = 440;
+    SDL_BlitSurface( s4, NULL, screen, &loc);
+  }
+
+  /* Red "Stop" circle in upper right corner to go back to main menu: */
+  if (images[IMG_STOP])
+  {
+    stopRect.w = images[IMG_STOP]->w;
+    stopRect.h = images[IMG_STOP]->h;
+    stopRect.x = screen->w - images[IMG_STOP]->w;
+    stopRect.y = 0;
+    SDL_BlitSurface(images[IMG_STOP], NULL, screen, &stopRect);
+  }
+
+  if (Tux && Tux->num_frames) /* make sure sprite has at least one frame */
+  {
+    SDL_BlitSurface(Tux->frame[0], NULL, screen, &Tuxdest);
+  }
+  SDL_UpdateRect(screen, 0, 0, 0, 0);
+
+  while (!finished)
+  {
+    start = SDL_GetTicks();
+
+    while (SDL_PollEvent(&event)) 
+    {
+      switch (event.type)
+      {
+        case SDL_QUIT:
+        {
+          cleanup();
+        }
+
+        case SDL_MOUSEBUTTONDOWN:
+        /* "Stop" button - go to main menu: */
+        { 
+          if (inRect(stopRect, event.button.x, event.button.y ))
+          {
+            finished = 1;
+            tuxtype_playsound(sounds[SND_TOCK]);
+            break;
+          }
+        }
+        case SDL_KEYDOWN:
+        {
+          finished = 1;
+          tuxtype_playsound(sounds[SND_TOCK]);
+        }
+      }
+    }
+
+    /* --- make tux blink --- */
+    switch (frame % TUX6)
+    {
+      case 0:    tux_frame = 1; break;
+      case TUX1: tux_frame = 2; break;
+      case TUX2: tux_frame = 3; break;
+      case TUX3: tux_frame = 4; break;			
+      case TUX4: tux_frame = 3; break;
+      case TUX5: tux_frame = 2; break;
+      default: tux_frame = 0;
+    }
+
+    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);
+    }
+    /* Wait so we keep frame rate constant: */
+    while ((SDL_GetTicks() - start) < 33)
+    {
+      SDL_Delay(20);
+    }
+    frame++;
+  }  // End of while (!finished) loop
+
+  SDL_FreeSurface(s1);
+  SDL_FreeSurface(s2);
+  SDL_FreeSurface(s3);
+  SDL_FreeSurface(s4);
+}
+
+
+
+
+
+
 /* choose_config_file() - adapted from chooseWordlist() from tuxtype. */
 /* Display a list of tuxmath config files in the missions directory   */
 /* and allow the player to pick one (AKA "Lessons").                  */




More information about the Tux4kids-commits mailing list