Added some blinking to the current menu item
authorIngo Ruhnke <grumbel@gmx.de>
Mon, 5 May 2008 11:40:07 +0000 (11:40 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Mon, 5 May 2008 11:40:07 +0000 (11:40 +0000)
SVN-Revision: 5403

src/gui/menu.cpp

index e67d906..afa371e 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <iostream>
 #include <sstream>
+#include <math.h>
 #include <cstdlib>
 #include <cstdio>
 #include <string>
@@ -538,9 +539,10 @@ Menu::draw_item(DrawingContext& context, int index)
 
   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),