Fixed the ever-elusive crash when using lightmaps: Discard all lightmap requests...
[supertux.git] / src / gui / menu.cpp
index 613c8fa..c86bd98 100644 (file)
@@ -341,8 +341,7 @@ Menu::update()
     menuaction = MENU_ACTION_DOWN;
     menu_repeat_time = real_time + MENU_REPEAT_RATE;
   }
-  if(main_controller->pressed(Controller::JUMP)
-     || main_controller->pressed(Controller::ACTION)
+  if(main_controller->pressed(Controller::ACTION)
      || main_controller->pressed(Controller::MENU_SELECT)) {
     menuaction = MENU_ACTION_HIT;
   }
@@ -491,7 +490,7 @@ void
 Menu::draw_item(DrawingContext& context, int index)
 {
   float menu_height = get_height();
-  float menu_width = get_width();
+  float menu_width  = get_width();
 
   MenuItem& pitem = *(items[index]);
 
@@ -525,6 +524,20 @@ Menu::draw_item(DrawingContext& context, int index)
       text_font = active_font;
     }
 
+  if(active_item == index)
+    {
+      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),
+                               16.0f,
+                               LAYER_GUI-10);
+      context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2 + 10, y_pos - 12),
+                                    Vector(pos_x + menu_width/2 - 10, y_pos + 12)),
+                               Color(1.0f, 1.0f, 1.0f, 0.5f),
+                               16.0f,
+                               LAYER_GUI-10);
+    }
+
   switch (pitem.kind)
     {
     case MN_DEACTIVE:
@@ -706,13 +719,20 @@ Menu::draw(DrawingContext& context)
   }
 
   float menu_height = get_height();
-  float menu_width = get_width();
+  float menu_width  = get_width();
 
   /* Draw a transparent background */
-  context.draw_filled_rect(
-    Vector(pos_x - menu_width/2, pos_y - 24*items.size()/2 - 10),
-    Vector(menu_width,menu_height + 20),
-    Color(0.6f, 0.7f, 0.8f, 0.5f), LAYER_GUI-10);
+  context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2-4, pos_y - 24*items.size()/2 - 10-4),
+                                Vector(pos_x + menu_width/2+4, pos_y - 24*items.size()/2 + 10 + menu_height+4)),
+                           Color(0.2f, 0.3f, 0.4f, 0.8f), 
+                           16.0f,
+                           LAYER_GUI-10);
+
+  context.draw_filled_rect(Rect(Vector(pos_x - menu_width/2, pos_y - 24*items.size()/2 - 10),
+                                Vector(pos_x + menu_width/2, pos_y - 24*items.size()/2 + 10 + menu_height)),
+                           Color(0.6f, 0.7f, 0.8f, 0.5f), 
+                           16.0f,
+                           LAYER_GUI-10);
 
   for(unsigned int i = 0; i < items.size(); ++i)
     {