[Tux4kids-commits] r6 - in tuxmath/trunk: data/images/status src

dbruce at alioth.debian.org dbruce at alioth.debian.org
Thu Mar 8 20:56:31 CET 2007


Author: dbruce
Date: 2006-02-15 13:20:01 +0000 (Wed, 15 Feb 2006)
New Revision: 6

Added:
   tuxmath/trunk/data/images/status/opt_speed.png
Modified:
   tuxmath/trunk/src/images.h
   tuxmath/trunk/src/options.c
   tuxmath/trunk/src/options.h
   tuxmath/trunk/src/setup.c
Log:
Add speed control to Options screen (Yves Combe)


Added: tuxmath/trunk/data/images/status/opt_speed.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/status/opt_speed.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: tuxmath/trunk/src/images.h
===================================================================
--- tuxmath/trunk/src/images.h	2006-02-07 22:12:59 UTC (rev 5)
+++ tuxmath/trunk/src/images.h	2006-02-15 13:20:01 UTC (rev 6)
@@ -36,6 +36,7 @@
   IMG_OPT_MULTIPLICATION,
   IMG_OPT_DIVISION,
   IMG_OPT_MAX_ANSWER,
+  IMG_OPT_SPEED,
   IMG_OPT_Q_RANGE,
   IMG_OPT_RNG_1_5,
   IMG_OPT_RNG_1_5_ON,

Modified: tuxmath/trunk/src/options.c
===================================================================
--- tuxmath/trunk/src/options.c	2006-02-07 22:12:59 UTC (rev 5)
+++ tuxmath/trunk/src/options.c	2006-02-15 13:20:01 UTC (rev 6)
@@ -80,6 +80,18 @@
       /* Using "* 2" instead of "* 4" (even though string is 4 digits long)
          because "draw_nums()" actually centers around x; not left-justifies */
     }
+    else if (i == OPT_A_SPEED)
+    {
+      /* Maximum answer: */
+
+      snprintf(tmp_str, sizeof(tmp_str), "%.1f", speed);
+      draw_nums(tmp_str,
+		screen->w - ((images[IMG_NUMS]->w / 14) * 2) - 16,
+		y + images[IMG_OPT_SPEED]->h);
+
+      /* Using "* 2" instead of "* 4" (even though string is 4 digits long)
+         because "draw_nums()" actually centers around x; not left-justifies */
+    }
     else if (i == OPT_Q_RANGE)
     {
       x = 32 + images[IMG_TUX_HELMET1]->w + 4 + 64;
@@ -213,6 +225,32 @@
 			 images[IMG_TUX_HELMET1]->h)) +
 			images[IMG_OPT_MAX_ANSWER]->h);
 		  }
+		  else if (opt == OPT_A_SPEED)
+		  {
+		    speed = speed - 0.1;
+
+		    if (speed < 0.1)
+		      speed = 5;
+
+		    dest.x = screen->w - ((images[IMG_NUMS]->w / 14) * 4) - 16;
+		    dest.y = (images[IMG_OPTIONS]->h + 8 +
+			      ((opt - OPT_OP_ADD) *
+			       images[IMG_TUX_HELMET1]->h));
+
+		    dest.w = ((images[IMG_NUMS]->w / 14) * 4);
+		    dest.h = images[IMG_OPT_SPEED]->h;
+
+		    SDL_FillRect(screen, &dest,
+				 SDL_MapRGB(screen->format, 0, 0, 0));
+
+		    snprintf(tmp_str, sizeof(tmp_str), "%.1f", speed);
+		    draw_nums(tmp_str,
+			screen->w - ((images[IMG_NUMS]->w / 14) * 2) - 16,
+			(images[IMG_OPTIONS]->h + 8 +
+			 ((opt - OPT_OP_ADD) *
+			 images[IMG_TUX_HELMET1]->h)) +
+			images[IMG_OPT_SPEED]->h);
+		  }
 		  else if (opt == OPT_Q_RANGE)
 		  {
 		    /* Change which ranges are available: */

Modified: tuxmath/trunk/src/options.h
===================================================================
--- tuxmath/trunk/src/options.h	2006-02-07 22:12:59 UTC (rev 5)
+++ tuxmath/trunk/src/options.h	2006-02-15 13:20:01 UTC (rev 6)
@@ -25,6 +25,7 @@
   OPT_OP_MUL,
   OPT_OP_DIV,
   OPT_A_MAX,
+  OPT_A_SPEED,
   OPT_Q_RANGE,
   NUM_OPTS
 };

Modified: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c	2006-02-07 22:12:59 UTC (rev 5)
+++ tuxmath/trunk/src/setup.c	2006-02-15 13:20:01 UTC (rev 6)
@@ -52,6 +52,7 @@
   DATA_PREFIX "/images/status/opt_multiplication.png",
   DATA_PREFIX "/images/status/opt_division.png",
   DATA_PREFIX "/images/status/opt_max_answer.png",
+  DATA_PREFIX "/images/status/opt_speed.png",
   DATA_PREFIX "/images/status/opt_q_range.png",
   DATA_PREFIX "/images/status/opt_rng_1_5.png",
   DATA_PREFIX "/images/status/opt_rng_1_5_on.png",




More information about the Tux4kids-commits mailing list