[Supertux-Commit] r5403 - trunk/supertux/src/gui

grumbel at millhouse.dreamhost.com grumbel at millhouse.dreamhost.com
Mon May 5 04:40:07 PDT 2008


Author: grumbel
Date: 2008-05-05 04:40:07 -0700 (Mon, 05 May 2008)
New Revision: 5403

Modified:
   trunk/supertux/src/gui/menu.cpp
Log:
Added some blinking to the current menu item

Modified: trunk/supertux/src/gui/menu.cpp
===================================================================
--- trunk/supertux/src/gui/menu.cpp	2008-05-05 11:30:52 UTC (rev 5402)
+++ trunk/supertux/src/gui/menu.cpp	2008-05-05 11:40:07 UTC (rev 5403)
@@ -24,6 +24,7 @@
 
 #include <iostream>
 #include <sstream>
+#include <math.h>
 #include <cstdlib>
 #include <cstdio>
 #include <string>
@@ -538,9 +539,10 @@
 
   if(active_item == index)
     {
+      float blink = (sinf(real_time * M_PI * 1.0f)/2.0f + 0.5f) * 0.5f + 0.25f;
       context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2 + 10 - 2, y_pos - 12 - 2),
                                     Vector(pos_x + menu_width/2 - 10 + 2, y_pos + 12 + 2)),
-                               Color(1.0f, 1.0f, 1.0f, 0.5f),
+                               Color(1.0f, 1.0f, 1.0f, blink),
                                14.0f,
                                LAYER_GUI-10);
       context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2 + 10, y_pos - 12),




More information about the Supertux-Commit mailing list