- replaced a few pure pointers with std::vector<>
[supertux.git] / src / menu.cpp
index 7d59a90..276f49f 100644 (file)
 MenuAction menuaction = MENU_ACTION_NONE;
 bool show_menu;
 bool menu_change;
-texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right;
+
+Surface* checkbox;
+Surface* checkbox_checked;
+Surface* back;
+Surface* arrow_left;
+Surface* arrow_right;
 
 Menu* main_menu      = 0;
 Menu* game_menu      = 0;
+Menu* worldmap_menu  = 0;
 Menu* options_menu   = 0;
 Menu* options_controls_menu   = 0;
 Menu* highscore_menu = 0;
@@ -353,7 +359,7 @@ Menu::draw_item(int index, // Position of the current item in the menu
   int text_width  = strlen(pitem.text) * font_width;
   int input_width = strlen(pitem.input) * font_width;
   int list_width  = strlen(string_list_active(pitem.list)) * font_width;
-  text_type* text_font = &white_text;
+  Text* text_font = white_text;
 
   if (arrange_left)
     x_pos += 24 - menu_width/2 + (text_width + input_width + list_width)/2;
@@ -361,16 +367,16 @@ Menu::draw_item(int index, // Position of the current item in the menu
   if(index == active_item)
     {
       shadow_size = 3;
-      text_font = &blue_text;
+      text_font = blue_text;
     }
 
   switch (pitem.kind)
     {
     case MN_DEACTIVE:
       {
-        text_draw_align(&black_text, pitem.text,
-                        x_pos, y_pos,
-                        A_HMIDDLE, A_VMIDDLE, 2);
+        black_text->draw_align(pitem.text,
+                               x_pos, y_pos,
+                               A_HMIDDLE, A_VMIDDLE, 2);
         break;
       }
 
@@ -389,9 +395,9 @@ Menu::draw_item(int index, // Position of the current item in the menu
       }
     case MN_LABEL:
       {
-        text_draw_align(&white_big_text, pitem.text,
-                        x_pos, y_pos,
-                        A_HMIDDLE, A_VMIDDLE, 2);
+        white_big_text->draw_align(pitem.text,
+                                   x_pos, y_pos,
+                                   A_HMIDDLE, A_VMIDDLE, 2);
         break;
       }
     case MN_TEXTFIELD:
@@ -408,13 +414,13 @@ Menu::draw_item(int index, // Position of the current item in the menu
                  input_width + font_width, 18,
                  0,0,0,128);
 
-        text_draw_align(&gold_text, pitem.input,
-                        x_pos + text_pos, y_pos,
-                        A_HMIDDLE, A_VMIDDLE, 2);
+        gold_text->draw_align(pitem.input,
+                              x_pos + text_pos, y_pos,
+                              A_HMIDDLE, A_VMIDDLE, 2);
 
-        text_draw_align(text_font, pitem.text,
-                        x_pos - (input_width + font_width)/2, y_pos,
-                        A_HMIDDLE, A_VMIDDLE, shadow_size);
+        text_font->draw_align(pitem.text,
+                              x_pos - (input_width + font_width)/2, y_pos,
+                              A_HMIDDLE, A_VMIDDLE, shadow_size);
         break;
       }
     case MN_STRINGSELECT:
@@ -424,8 +430,8 @@ Menu::draw_item(int index, // Position of the current item in the menu
         int text_pos   = (text_width + font_width)/2;
 
         /* Draw arrows */
-        texture_draw(&arrow_left,  x_pos - list_pos + text_pos - 17, y_pos - 8);
-        texture_draw(&arrow_right, x_pos - list_pos + text_pos - 1 + list_pos_2, y_pos - 8);
+        arrow_left->draw(  x_pos - list_pos + text_pos - 17, y_pos - 8);
+        arrow_right->draw( x_pos - list_pos + text_pos - 1 + list_pos_2, y_pos - 8);
 
         /* Draw input background */
         fillrect(x_pos - list_pos + text_pos - 1, y_pos - 10,
@@ -435,42 +441,42 @@ Menu::draw_item(int index, // Position of the current item in the menu
                  list_pos_2, 18,
                  0,0,0,128);
 
-        text_draw_align(&gold_text, string_list_active(pitem.list),
+        gold_text->draw_align(string_list_active(pitem.list),
                         x_pos + text_pos, y_pos,
                         A_HMIDDLE, A_VMIDDLE,2);
 
-        text_draw_align(text_font, pitem.text,
+        text_font->draw_align(pitem.text,
                         x_pos - list_pos_2/2, y_pos,
                         A_HMIDDLE, A_VMIDDLE, shadow_size);
         break;
       }
     case MN_BACK:
       {
-        text_draw_align(text_font, pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size);
-        texture_draw(&back, x_pos + text_width/2  + font_width, y_pos - 8);
+        text_font->draw_align(pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size);
+        back->draw( x_pos + text_width/2  + font_width, y_pos - 8);
         break;
       }
 
     case MN_TOGGLE:
       {
-        text_draw_align(text_font, pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size);
+        text_font->draw_align(pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size);
 
         if(pitem.toggled)
-          texture_draw(&checkbox_checked,
+          checkbox_checked->draw(
                        x_pos + (text_width+font_width)/2,
                        y_pos - 8);
         else
-          texture_draw(&checkbox,
+          checkbox->draw(
                        x_pos + (text_width+font_width)/2,
                        y_pos - 8);
         break;
       }
     case MN_ACTION:
-      text_draw_align(text_font, pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size);
+      text_font->draw_align(pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size);
       break;
 
     case MN_GOTO:
-      text_draw_align(text_font, pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size);
+      text_font->draw_align(pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size);
       break;
     }
 }