Small improvement to PhysfsSubsystem debug output
[supertux.git] / src / supertux / info_box.cpp
index 323bbfc..a5c6220 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "supertux/info_box.hpp"
 
-#include "supertux/main.hpp"
+#include "supertux/globals.hpp"
 #include "supertux/info_box_line.hpp"
 #include "util/log.hpp"
 #include "video/drawing_context.hpp"
@@ -35,14 +35,14 @@ InfoBox::InfoBox(const std::string& text) :
   try
   {
     // get the arrow sprites
-    arrow_scrollup   = new Surface("images/engine/menu/scroll-up.png");
-    arrow_scrolldown = new Surface("images/engine/menu/scroll-down.png");
+    arrow_scrollup   = Surface::create("images/engine/menu/scroll-up.png");
+    arrow_scrolldown = Surface::create("images/engine/menu/scroll-down.png");
   }
   catch (std::exception& e)
   {
     log_warning << "Could not load scrolling images: " << e.what() << std::endl;
-    arrow_scrollup = 0;
-    arrow_scrolldown = 0;
+    arrow_scrollup.reset();
+    arrow_scrolldown.reset();
   }
 }
 
@@ -51,9 +51,6 @@ InfoBox::~InfoBox()
   for(std::vector<InfoBoxLine*>::iterator i = lines.begin();
       i != lines.end(); i++)
     delete *i;
-
-  delete arrow_scrollup;
-  delete arrow_scrolldown;
 }
 
 void
@@ -75,18 +72,18 @@ InfoBox::draw(DrawingContext& context)
       break;
     }
 
-    lines[i]->draw(context, Rect(x1, y, x1+width, y), LAYER_GUI);
+    lines[i]->draw(context, Rectf(x1, y, x1+width, y), LAYER_GUI);
     y += lines[i]->get_height();
   }
 
   {
     // draw the scrolling arrows
-    if (arrow_scrollup && firstline > 0)
+    if (arrow_scrollup.get() && firstline > 0)
       context.draw_surface(arrow_scrollup,
                            Vector( x1 + width  - arrow_scrollup->get_width(),  // top-right corner of box
                                    y1), LAYER_GUI);
 
-    if (arrow_scrolldown && linesLeft && firstline < lines.size()-1)
+    if (arrow_scrolldown.get() && linesLeft && firstline < lines.size()-1)
       context.draw_surface(arrow_scrolldown,
                            Vector( x1 + width  - arrow_scrolldown->get_width(),  // bottom-light corner of box
                                    y1 + height - arrow_scrolldown->get_height()),