Turned stuff in supertux/resources.cpp into a class Resources
authorgrumbel <grumbel@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Thu, 19 Nov 2009 04:33:45 +0000 (04:33 +0000)
committergrumbel <grumbel@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Thu, 19 Nov 2009 04:33:45 +0000 (04:33 +0000)
git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6041 837edb03-e0f3-0310-88ca-d4d4e8b29345

18 files changed:
src/gui/menu.cpp
src/gui/menu_item.cpp
src/gui/menu_manager.hpp
src/object/floating_text.cpp
src/object/level_time.cpp
src/object/text_object.cpp
src/supertux/info_box_line.cpp
src/supertux/levelintro.cpp
src/supertux/main.cpp
src/supertux/mainloop.cpp
src/supertux/player_status.cpp
src/supertux/resources.cpp
src/supertux/resources.hpp
src/supertux/statistics.cpp
src/supertux/title_screen.cpp
src/trigger/climbable.cpp
src/trigger/secretarea_trigger.cpp
src/worldmap/worldmap.cpp

index 66754c9..5761e19 100644 (file)
@@ -453,15 +453,15 @@ Menu::draw_item(DrawingContext& context, int index)
   float x_pos       = pos_x;
   float y_pos       = pos_y + 24*index - menu_height/2 + 12;
   int shadow_size = 2;
-  int text_width  = int(normal_font->get_text_width(pitem.text));
-  int input_width = int(normal_font->get_text_width(pitem.input) + 10);
+  int text_width  = int(Resources::normal_font->get_text_width(pitem.text));
+  int input_width = int(Resources::normal_font->get_text_width(pitem.input) + 10);
   int list_width = 0;
 
   float left  = pos_x - menu_width/2 + 16;
   float right = pos_x + menu_width/2 - 16;
 
   if(pitem.list.size() > 0) {
-    list_width = (int) normal_font->get_text_width(pitem.list[pitem.selected]);
+    list_width = (int) Resources::normal_font->get_text_width(pitem.list[pitem.selected]);
   }
 
   if (arrange_left)
@@ -492,8 +492,8 @@ Menu::draw_item(DrawingContext& context, int index)
   {
     case MN_INACTIVE:
     {
-      context.draw_text(normal_font, pitem.text,
-                        Vector(pos_x, y_pos - int(normal_font->get_height()/2)),
+      context.draw_text(Resources::normal_font, pitem.text,
+                        Vector(pos_x, y_pos - int(Resources::normal_font->get_height()/2)),
                         ALIGN_CENTER, LAYER_GUI, inactive_color);
       break;
     }
@@ -514,8 +514,8 @@ Menu::draw_item(DrawingContext& context, int index)
     }
     case MN_LABEL:
     {
-      context.draw_text(big_font, pitem.text,
-                        Vector(pos_x, y_pos - int(big_font->get_height()/2)),
+      context.draw_text(Resources::big_font, pitem.text,
+                        Vector(pos_x, y_pos - int(Resources::big_font->get_height()/2)),
                         ALIGN_CENTER, LAYER_GUI, label_color);
       break;
     }
@@ -526,23 +526,23 @@ Menu::draw_item(DrawingContext& context, int index)
       if(pitem.kind == MN_TEXTFIELD || pitem.kind == MN_NUMFIELD)
       {
         if(active_item == index)
-          context.draw_text(normal_font,
+          context.draw_text(Resources::normal_font,
                             pitem.get_input_with_symbol(true),
-                            Vector(right, y_pos - int(normal_font->get_height()/2)),
+                            Vector(right, y_pos - int(Resources::normal_font->get_height()/2)),
                             ALIGN_RIGHT, LAYER_GUI, field_color);
         else
-          context.draw_text(normal_font,
+          context.draw_text(Resources::normal_font,
                             pitem.get_input_with_symbol(false),
-                            Vector(right, y_pos - int(normal_font->get_height()/2)),
+                            Vector(right, y_pos - int(Resources::normal_font->get_height()/2)),
                             ALIGN_RIGHT, LAYER_GUI, field_color);
       }
       else
-        context.draw_text(normal_font, pitem.input,
-                          Vector(right, y_pos - int(normal_font->get_height()/2)),
+        context.draw_text(Resources::normal_font, pitem.input,
+                          Vector(right, y_pos - int(Resources::normal_font->get_height()/2)),
                           ALIGN_RIGHT, LAYER_GUI, field_color);
 
-      context.draw_text(normal_font, pitem.text,
-                        Vector(left, y_pos - int(normal_font->get_height()/2)),
+      context.draw_text(Resources::normal_font, pitem.text,
+                        Vector(left, y_pos - int(Resources::normal_font->get_height()/2)),
                         ALIGN_LEFT, LAYER_GUI, text_color);
       break;
     }
@@ -550,8 +550,8 @@ Menu::draw_item(DrawingContext& context, int index)
     {
       float roff = arrow_left->get_width();
       // Draw left side
-      context.draw_text(normal_font, pitem.text,
-                        Vector(left, y_pos - int(normal_font->get_height()/2)),
+      context.draw_text(Resources::normal_font, pitem.text,
+                        Vector(left, y_pos - int(Resources::normal_font->get_height()/2)),
                         ALIGN_LEFT, LAYER_GUI, text_color);
 
       // Draw right side
@@ -561,15 +561,15 @@ Menu::draw_item(DrawingContext& context, int index)
       context.draw_surface(arrow_right.get(),
                            Vector(right - roff, y_pos - 8),
                            LAYER_GUI);
-      context.draw_text(normal_font, pitem.list[pitem.selected],
-                        Vector(right - roff, y_pos - int(normal_font->get_height()/2)),
+      context.draw_text(Resources::normal_font, pitem.list[pitem.selected],
+                        Vector(right - roff, y_pos - int(Resources::normal_font->get_height()/2)),
                         ALIGN_RIGHT, LAYER_GUI, text_color);
       break;
     }
     case MN_BACK:
     {
-      context.draw_text(normal_font, pitem.text,
-                        Vector(pos_x, y_pos - int(normal_font->get_height()/2)),
+      context.draw_text(Resources::Resources::normal_font, pitem.text,
+                        Vector(pos_x, y_pos - int(Resources::normal_font->get_height()/2)),
                         ALIGN_CENTER, LAYER_GUI, text_color);
       context.draw_surface(back.get(),
                            Vector(x_pos + text_width/2  + 16, y_pos - 8),
@@ -579,8 +579,8 @@ Menu::draw_item(DrawingContext& context, int index)
 
     case MN_TOGGLE:
     {
-      context.draw_text(normal_font, pitem.text,
-                        Vector(pos_x - menu_width/2 + 16, y_pos - (normal_font->get_height()/2)),
+      context.draw_text(Resources::normal_font, pitem.text,
+                        Vector(pos_x - menu_width/2 + 16, y_pos - (Resources::normal_font->get_height()/2)),
                         ALIGN_LEFT, LAYER_GUI, text_color);
 
       if(pitem.toggled)
@@ -594,14 +594,14 @@ Menu::draw_item(DrawingContext& context, int index)
       break;
     }
     case MN_ACTION:
-      context.draw_text(normal_font, pitem.text,
-                        Vector(pos_x, y_pos - int(normal_font->get_height()/2)),
+      context.draw_text(Resources::normal_font, pitem.text,
+                        Vector(pos_x, y_pos - int(Resources::normal_font->get_height()/2)),
                         ALIGN_CENTER, LAYER_GUI, text_color);
       break;
 
     case MN_GOTO:
-      context.draw_text(normal_font, pitem.text,
-                        Vector(pos_x, y_pos - int(normal_font->get_height()/2)),
+      context.draw_text(Resources::normal_font, pitem.text,
+                        Vector(pos_x, y_pos - int(Resources::normal_font->get_height()/2)),
                         ALIGN_CENTER, LAYER_GUI, text_color);
       break;
   }
@@ -615,12 +615,12 @@ Menu::get_width() const
   float menu_width = 0;
   for(unsigned int i = 0; i < items.size(); ++i)
   {
-    Font* font = normal_font;
+    Font* font = Resources::Resources::normal_font;
     if(items[i]->kind == MN_LABEL)
-      font = big_font;
+      font = Resources::big_font;
 
     float w = font->get_text_width(items[i]->text) +
-      big_font->get_text_width(items[i]->input) + 16;
+      Resources::big_font->get_text_width(items[i]->input) + 16;
     if(items[i]->kind == MN_TOGGLE)
       w += 32;
 
@@ -683,8 +683,8 @@ Menu::draw(DrawingContext& context)
 
   if (!items[active_item]->help.empty())
   {
-    int text_width  = (int) normal_font->get_text_width(items[active_item]->help);
-    int text_height = (int) normal_font->get_text_height(items[active_item]->help);
+    int text_width  = (int) Resources::normal_font->get_text_width(items[active_item]->help);
+    int text_height = (int) Resources::normal_font->get_text_height(items[active_item]->help);
       
     Rect text_rect(pos_x - text_width/2 - 8, 
                    SCREEN_HEIGHT - 48 - text_height/2 - 4,
@@ -702,7 +702,7 @@ Menu::draw(DrawingContext& context)
                              16.0f,
                              LAYER_GUI-10);
 
-    context.draw_text(normal_font, items[active_item]->help,
+    context.draw_text(Resources::normal_font, items[active_item]->help,
                       Vector(pos_x, SCREEN_HEIGHT - 48 - text_height/2),
                       ALIGN_CENTER, LAYER_GUI);
   }
index fd599d7..f25a4d7 100644 (file)
@@ -55,11 +55,11 @@ void
 MenuItem::set_help(const std::string& help_text)
 {
   std::string overflow;
-  help = normal_font->wrap_to_width(help_text, 600, &overflow);
+  help = Resources::normal_font->wrap_to_width(help_text, 600, &overflow);
   while (!overflow.empty())
   {
     help += "\n";
-    help += normal_font->wrap_to_width(overflow, 600, &overflow);
+    help += Resources::normal_font->wrap_to_width(overflow, 600, &overflow);
   }
 }
 
index be4a875..de384eb 100644 (file)
@@ -22,7 +22,7 @@
 
 class Menu;
 
-class MenuManager // FIXME: temporary name 
+class MenuManager
 {
 public:
   static std::vector<Menu*> last_menus;
index 217da5c..34a1f08 100644 (file)
@@ -69,7 +69,7 @@ FloatingText::draw(DrawingContext& context)
   context.push_transform();
   context.set_alpha(alpha);
 
-  context.draw_text(normal_font, text, position, ALIGN_LEFT, LAYER_OBJECTS+1, FloatingText::text_color);
+  context.draw_text(Resources::normal_font, text, position, ALIGN_LEFT, LAYER_OBJECTS+1, FloatingText::text_color);
 
   context.pop_transform();
 }
index 26de88d..7c39d89 100644 (file)
@@ -90,9 +90,9 @@ LevelTime::draw(DrawingContext& context)
 
     Surface* time_surf = time_surface.get();
     if (time_surf) {
-      float all_width = time_surf->get_width() + normal_font->get_text_width(time_text);
+      float all_width = time_surf->get_width() + Resources::normal_font->get_text_width(time_text);
       context.draw_surface(time_surf, Vector((SCREEN_WIDTH - all_width)/2, BORDER_Y + 1), LAYER_FOREGROUND1);
-      context.draw_text(normal_font, time_text, Vector((SCREEN_WIDTH - all_width)/2 + time_surf->get_width(), BORDER_Y), ALIGN_LEFT, LAYER_FOREGROUND1, LevelTime::text_color);
+      context.draw_text(Resources::normal_font, time_text, Vector((SCREEN_WIDTH - all_width)/2 + time_surf->get_width(), BORDER_Y), ALIGN_LEFT, LAYER_FOREGROUND1, LevelTime::text_color);
     }
   }
 
index d40bfbf..be2276b 100644 (file)
@@ -32,7 +32,7 @@ TextObject::TextObject(std::string name) :
   pos(0, 0)
 {
   this->name = name;
-  font = normal_font;
+  font = Resources::normal_font;
   centered = false;
 }
 
@@ -62,14 +62,14 @@ void
 TextObject::set_font(const std::string& name)
 {
   if(name == "normal") {
-    font = normal_font;
+    font = Resources::normal_font;
   } else if(name == "big") {
-    font = big_font;
+    font = Resources::big_font;
   } else if(name == "small") {
-    font = small_font;
+    font = Resources::small_font;
   } else {
     log_warning << "Unknown font '" << name << "'." << std::endl;
-    font = normal_font;
+    font = Resources::normal_font;
   }
 }
 
index c414252..19bf347 100644 (file)
@@ -30,19 +30,19 @@ Font* get_font_by_format_char(char format_char) {
   switch(format_char)
   {
     case ' ':
-      return small_font;
+      return Resources::small_font;
       break;
     case '-':
-      return big_font;
+      return Resources::big_font;
       break;
     case '\t':
     case '*':
     case '#':
     case '!':
-      return normal_font;
+      return Resources::normal_font;
     break;
     default:
-      return normal_font;
+      return Resources::normal_font;
       log_warning << "Unknown format_char: '" << format_char << "'" << std::endl;
       break;
   }
@@ -103,7 +103,7 @@ InfoBoxLine::LineType get_linetype_by_format_char(char format_char) {
 
 InfoBoxLine::InfoBoxLine(char format_char, const std::string& text) : 
   lineType(NORMAL),
-  font(normal_font), 
+  font(Resources::normal_font), 
   color(),
   text(text), 
   image(0)
index 16df722..8216995 100644 (file)
@@ -76,20 +76,20 @@ void
 LevelIntro::draw(DrawingContext& context)
 {
   const Statistics& stats = level->stats;
-  int py = static_cast<int>(SCREEN_HEIGHT / 2 - normal_font->get_height() / 2);
+  int py = static_cast<int>(SCREEN_HEIGHT / 2 - Resources::normal_font->get_height() / 2);
 
   context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(0.0f, 0.0f, 0.0f, 1.0f), 0);
 
   {
-    context.draw_center_text(normal_font, level->get_name(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::header_color);
-    py += static_cast<int>(normal_font->get_height());
+    context.draw_center_text(Resources::normal_font, level->get_name(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::header_color);
+    py += static_cast<int>(Resources::normal_font->get_height());
   }
 
   std::string author = level->get_author();
   if ((author != "") && (author != "SuperTux Team")) {
     std::string author_text = std::string(_("contributed by ")) + author;
-    context.draw_center_text(small_font, author_text, Vector(0, py), LAYER_FOREGROUND1, LevelIntro::author_color);
-    py += static_cast<int>(small_font->get_height());
+    context.draw_center_text(Resources::small_font, author_text, Vector(0, py), LAYER_FOREGROUND1, LevelIntro::author_color);
+    py += static_cast<int>(Resources::small_font->get_height());
   }
 
   py += 32;
@@ -102,29 +102,29 @@ LevelIntro::draw(DrawingContext& context)
   py += 32;
 
   {
-    context.draw_center_text(normal_font, std::string("- ") + _("Best Level Statistics") + std::string(" -"), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_hdr_color);
-    py += static_cast<int>(normal_font->get_height());
+    context.draw_center_text(Resources::normal_font, std::string("- ") + _("Best Level Statistics") + std::string(" -"), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_hdr_color);
+    py += static_cast<int>(Resources::normal_font->get_height());
   }
 
   {
     std::stringstream ss;
     ss << _("Coins") << ": " << Statistics::coins_to_string((best_level_statistics && (best_level_statistics->coins >= 0)) ? best_level_statistics->coins : 0, stats.total_coins);
-    context.draw_center_text(normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_color);
-    py += static_cast<int>(normal_font->get_height());
+    context.draw_center_text(Resources::normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_color);
+    py += static_cast<int>(Resources::normal_font->get_height());
   }
   
   {
     std::stringstream ss;
     ss << _("Secrets") << ": " << Statistics::secrets_to_string((best_level_statistics && (best_level_statistics->coins >= 0)) ? best_level_statistics->secrets : 0, stats.total_secrets);
-    context.draw_center_text(normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
-    py += static_cast<int>(normal_font->get_height());
+    context.draw_center_text(Resources::normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
+    py += static_cast<int>(Resources::normal_font->get_height());
   }
 
   {
     std::stringstream ss;
     ss << _("Time") << ": " << Statistics::time_to_string((best_level_statistics && (best_level_statistics->coins >= 0)) ? best_level_statistics->time : 0);
-    context.draw_center_text(normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
-    py += static_cast<int>(normal_font->get_height());
+    context.draw_center_text(Resources::normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
+    py += static_cast<int>(Resources::normal_font->get_height());
   }
 
 }
index 4979871..cfb3d08 100644 (file)
@@ -574,7 +574,7 @@ int supertux_main(int argc, char** argv)
     Scripting::init_squirrel(g_config->enable_script_debugger);
 
     timelog("resources");
-    load_shared();
+    Resources::load_shared();
 
     timelog(0);
 
@@ -625,7 +625,7 @@ int supertux_main(int argc, char** argv)
   delete g_main_loop;
   g_main_loop = NULL;
 
-  unload_shared();
+  Resources::unload_shared();
   quit_audio();
 
   if(g_config)
index 2b6ee99..3fd1590 100644 (file)
@@ -134,8 +134,10 @@ MainLoop::draw_fps(DrawingContext& context, float fps_fps)
   char str[60];
   snprintf(str, sizeof(str), "%3.1f", fps_fps);
   const char* fpstext = "FPS";
-  context.draw_text(small_font, fpstext, Vector(SCREEN_WIDTH - small_font->get_text_width(fpstext) - small_font->get_text_width(" 99999") - BORDER_X, BORDER_Y + 20), ALIGN_LEFT, LAYER_HUD);
-  context.draw_text(small_font, str, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y + 20), ALIGN_RIGHT, LAYER_HUD);
+  context.draw_text(Resources::small_font, fpstext, 
+                    Vector(SCREEN_WIDTH - Resources::small_font->get_text_width(fpstext) - Resources::small_font->get_text_width(" 99999") - BORDER_X, 
+                           BORDER_Y + 20), ALIGN_LEFT, LAYER_HUD);
+  context.draw_text(Resources::small_font, str, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y + 20), ALIGN_RIGHT, LAYER_HUD);
 }
 
 void
index 281c809..24bde70 100644 (file)
@@ -147,9 +147,10 @@ PlayerStatus::draw(DrawingContext& context)
 
   Surface* coin_surf = coin_surface.get();
   if (coin_surf) {
-    context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - fixed_font->get_text_width(coins_text), BORDER_Y + 1), LAYER_HUD);
+    context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - Resources::fixed_font->get_text_width(coins_text), 
+                                                      BORDER_Y + 1), LAYER_HUD);
   }
-  context.draw_text(fixed_font, coins_text, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y), ALIGN_RIGHT, LAYER_HUD, PlayerStatus::text_color);
+  context.draw_text(Resources::fixed_font, coins_text, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y), ALIGN_RIGHT, LAYER_HUD, PlayerStatus::text_color);
 
   context.pop_transform();
 }
index 9391eaa..9d57379 100644 (file)
@@ -14,9 +14,8 @@
 //
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//#include <config.h>
 
-//#include "supertux/resources.hpp"
+#include "supertux/resources.hpp"
 
 #include "gui/mousecursor.hpp"
 #include "sprite/sprite_manager.hpp"
 #include "supertux/tile_manager.hpp"
 #include "video/font.hpp"
 
-MouseCursor* mouse_cursor = NULL;
+MouseCursor* Resources::mouse_cursor = NULL;
 
-Font* fixed_font = NULL;
-Font* normal_font = NULL;
-Font* small_font = NULL;
-Font* big_font = NULL;
+Font* Resources::fixed_font = NULL;
+Font* Resources::normal_font = NULL;
+Font* Resources::small_font = NULL;
+Font* Resources::big_font = NULL;
 
 /* Load graphics/sounds shared between all levels: */
-void load_shared()
+void
+Resources::load_shared()
 {
   /* Load the mouse-cursor */
   mouse_cursor = new MouseCursor("images/engine/menu/mousecursor.png");
@@ -51,7 +51,8 @@ void load_shared()
 }
 
 /* Free shared data: */
-void unload_shared()
+void
+Resources::unload_shared()
 {
   /* Free global images: */
   delete normal_font;
index d61fa3e..06124c7 100644 (file)
 class Font;
 class MouseCursor;
 
-extern MouseCursor* mouse_cursor;
+class Resources
+{
+public:
+  static MouseCursor* mouse_cursor;
 
-extern Font* fixed_font;
-extern Font* normal_font;
-extern Font* small_font;
-extern Font* big_font;
+  static Font* fixed_font;
+  static Font* normal_font;
+  static Font* small_font;
+  static Font* big_font;
 
-void load_shared();
-void unload_shared();
+public:
+  static void load_shared();
+  static void unload_shared();
+};
 
 #endif
 
index 3cea415..b3aa2e0 100644 (file)
@@ -129,7 +129,9 @@ Statistics::draw_worldmap_info(DrawingContext& context)
   // skip draw if stats were declared invalid
   if (!valid) return;
 
-  context.draw_text(small_font, std::string("- ") + _("Best Level Statistics") + " -", Vector((WMAP_INFO_LEFT_X + WMAP_INFO_RIGHT_X) / 2, WMAP_INFO_TOP_Y1), ALIGN_CENTER, LAYER_GUI,Statistics::header_color);
+  context.draw_text(Resources::small_font, std::string("- ") + _("Best Level Statistics") + " -", 
+                    Vector((WMAP_INFO_LEFT_X + WMAP_INFO_RIGHT_X) / 2, WMAP_INFO_TOP_Y1), 
+                    ALIGN_CENTER, LAYER_GUI,Statistics::header_color);
 
   std::string caption_buf;
   std::string stat_buf;
@@ -158,9 +160,9 @@ Statistics::draw_worldmap_info(DrawingContext& context)
         break;
     }
 
-    context.draw_text(small_font, caption_buf, Vector(WMAP_INFO_LEFT_X, posy), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
-    context.draw_text(small_font, stat_buf, Vector(WMAP_INFO_RIGHT_X, posy), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
-    posy += small_font->get_height() + 2;
+    context.draw_text(Resources::small_font, caption_buf, Vector(WMAP_INFO_LEFT_X, posy), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
+    context.draw_text(Resources::small_font, stat_buf, Vector(WMAP_INFO_RIGHT_X, posy), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
+    posy += Resources::small_font->get_height() + 2;
   }
 
 }
@@ -202,25 +204,25 @@ Statistics::draw_endseq_panel(DrawingContext& context, Statistics* best_stats, S
   context.draw_surface(backdrop, Vector(bd_x, bd_y), LAYER_GUI);
   context.pop_transform();
 
-  context.draw_text(normal_font, _("You"), Vector(col2_x, row1_y), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
-  context.draw_text(normal_font, _("Best"), Vector(col3_x, row1_y), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
+  context.draw_text(Resources::normal_font, _("You"), Vector(col2_x, row1_y), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
+  context.draw_text(Resources::normal_font, _("Best"), Vector(col3_x, row1_y), ALIGN_LEFT, LAYER_GUI, Statistics::header_color);
 
-  context.draw_text(normal_font, _("Coins"), Vector(col2_x-16, row3_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
+  context.draw_text(Resources::normal_font, _("Coins"), Vector(col2_x-16, row3_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
   int coins_best = (best_stats && (best_stats->coins > coins)) ? best_stats->coins : coins;
   int total_coins_best = (best_stats && (best_stats->total_coins > total_coins)) ? best_stats->total_coins : total_coins;
-  context.draw_text(normal_font, coins_to_string(coins, total_coins), Vector(col2_x, row3_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
-  context.draw_text(normal_font, coins_to_string(coins_best, total_coins_best), Vector(col3_x, row3_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+  context.draw_text(Resources::normal_font, coins_to_string(coins, total_coins), Vector(col2_x, row3_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+  context.draw_text(Resources::normal_font, coins_to_string(coins_best, total_coins_best), Vector(col3_x, row3_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
 
-  context.draw_text(normal_font, _("Secrets"), Vector(col2_x-16, row4_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
+  context.draw_text(Resources::normal_font, _("Secrets"), Vector(col2_x-16, row4_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
   int secrets_best = (best_stats && (best_stats->secrets > secrets)) ? best_stats->secrets : secrets;
   int total_secrets_best = (best_stats && (best_stats->total_secrets > total_secrets)) ? best_stats->total_secrets : total_secrets;
-  context.draw_text(normal_font, secrets_to_string(secrets, total_secrets), Vector(col2_x, row4_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
-  context.draw_text(normal_font, secrets_to_string(secrets_best, total_secrets_best), Vector(col3_x, row4_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+  context.draw_text(Resources::normal_font, secrets_to_string(secrets, total_secrets), Vector(col2_x, row4_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+  context.draw_text(Resources::normal_font, secrets_to_string(secrets_best, total_secrets_best), Vector(col3_x, row4_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
 
-  context.draw_text(normal_font, _("Time"), Vector(col2_x-16, row2_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
+  context.draw_text(Resources::normal_font, _("Time"), Vector(col2_x-16, row2_y), ALIGN_RIGHT, LAYER_GUI, Statistics::header_color);
   float time_best = (best_stats && (best_stats->time < time)) ? best_stats->time : time;
-  context.draw_text(normal_font, time_to_string(time), Vector(col2_x, row2_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
-  context.draw_text(normal_font, time_to_string(time_best), Vector(col3_x, row2_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+  context.draw_text(Resources::normal_font, time_to_string(time), Vector(col2_x, row2_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
+  context.draw_text(Resources::normal_font, time_to_string(time_best), Vector(col3_x, row2_y), ALIGN_LEFT, LAYER_GUI, Statistics::text_color);
 }
 
 void
index 4576672..1773288 100644 (file)
@@ -381,15 +381,15 @@ TitleScreen::draw(DrawingContext& context)
   // FIXME: Add something to scale the frame to the resolution of the screen
   context.draw_surface(frame.get(), Vector(0,0),LAYER_FOREGROUND1);
 
-  context.draw_text(small_font, "SuperTux " PACKAGE_VERSION "\n",
+  context.draw_text(Resources::small_font, "SuperTux " PACKAGE_VERSION "\n",
                     Vector(5, SCREEN_HEIGHT - 50), ALIGN_LEFT, LAYER_FOREGROUND1);
-  context.draw_text(small_font,
+  context.draw_text(Resources::small_font,
                     _(
                       "Copyright (c) 2007 SuperTux Devel Team\n"
                       "This game comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to\n"
                       "redistribute it under certain conditions; see the file COPYING for details.\n"
                       ),
-                    Vector(5, SCREEN_HEIGHT - 50 + small_font->get_height() + 5),
+                    Vector(5, SCREEN_HEIGHT - 50 + Resources::small_font->get_height() + 5),
                     ALIGN_LEFT, LAYER_FOREGROUND1);
 }
 
index 6fc957f..fc0cd67 100644 (file)
@@ -74,8 +74,8 @@ Climbable::draw(DrawingContext& context)
   if (climbed_by) {
     context.push_transform();
     context.set_translation(Vector(0, 0));
-    Vector pos = Vector(0, SCREEN_HEIGHT/2 - normal_font->get_height()/2);
-    context.draw_center_text(normal_font, _("Up we go..."), pos, LAYER_GUI, Climbable::text_color);
+    Vector pos = Vector(0, SCREEN_HEIGHT/2 - Resources::normal_font->get_height()/2);
+    context.draw_center_text(Resources::normal_font, _("Up we go..."), pos, LAYER_GUI, Climbable::text_color);
     context.pop_transform();
   }
 }
index d333eab..182e78f 100644 (file)
@@ -63,8 +63,8 @@ SecretAreaTrigger::draw(DrawingContext& context)
   if (message_timer.started()) {
     context.push_transform();
     context.set_translation(Vector(0, 0));
-    Vector pos = Vector(0, SCREEN_HEIGHT/2 - normal_font->get_height()/2);
-    context.draw_center_text(normal_font, _("You found a secret area!"), pos, LAYER_GUI, SecretAreaTrigger::text_color);
+    Vector pos = Vector(0, SCREEN_HEIGHT/2 - Resources::normal_font->get_height()/2);
+    context.draw_center_text(Resources::normal_font, _("You found a secret area!"), pos, LAYER_GUI, SecretAreaTrigger::text_color);
     context.pop_transform();
   }
   if (message_timer.check()) {
index c8fbfd2..0a0c50f 100644 (file)
@@ -878,9 +878,9 @@ WorldMap::draw_status(DrawingContext& context)
         if(level->title == "")
           get_level_title(*level);
 
-        context.draw_text(normal_font, level->title,
+        context.draw_text(Resources::normal_font, level->title,
                           Vector(SCREEN_WIDTH/2,
-                                 SCREEN_HEIGHT - normal_font->get_height() - 30),
+                                 SCREEN_HEIGHT - Resources::normal_font->get_height() - 30),
                           ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::level_title_color);
 
         // if level is solved, draw level picture behind stats
@@ -908,9 +908,9 @@ WorldMap::draw_status(DrawingContext& context)
       if (special_tile->pos == tux->get_tile_pos()) {
         /* Display an in-map message in the map, if any as been selected */
         if(!special_tile->map_message.empty() && !special_tile->passive_message)
-          context.draw_text(normal_font, special_tile->map_message,
+          context.draw_text(Resources::normal_font, special_tile->map_message,
                             Vector(SCREEN_WIDTH/2,
-                                   SCREEN_HEIGHT - normal_font->get_height() - 60),
+                                   SCREEN_HEIGHT - Resources::normal_font->get_height() - 60),
                             ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::message_color);
         break;
       }
@@ -919,16 +919,16 @@ WorldMap::draw_status(DrawingContext& context)
     // display teleporter messages
     Teleporter* teleporter = at_teleporter(tux->get_tile_pos());
     if (teleporter && (teleporter->message != "")) {
-      Vector pos = Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - normal_font->get_height() - 30);
-      context.draw_text(normal_font, teleporter->message, pos, ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::teleporter_message_color);
+      Vector pos = Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - Resources::normal_font->get_height() - 30);
+      context.draw_text(Resources::normal_font, teleporter->message, pos, ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::teleporter_message_color);
     }
 
   }
 
   /* Display a passive message in the map, if needed */
   if(passive_message_timer.started())
-    context.draw_text(normal_font, passive_message,
-                      Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - normal_font->get_height() - 60),
+    context.draw_text(Resources::normal_font, passive_message,
+                      Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - Resources::normal_font->get_height() - 60),
                       ALIGN_CENTER, LAYER_FOREGROUND1, WorldMap::message_color);
 
   context.pop_transform();