Added FontPtr
[supertux.git] / src / video / drawing_context.cpp
index d94ab64..5814c04 100644 (file)
@@ -73,12 +73,12 @@ DrawingContext::init_renderer()
   delete renderer;
   delete lightmap;
 
-  renderer = new_renderer();
-  lightmap = new_lightmap();
+  renderer = VideoSystem::new_renderer();
+  lightmap = VideoSystem::new_lightmap();
 }
 
 void
-DrawingContext::draw_surface(const Surface* surface, const Vector& position,
+DrawingContext::draw_surface(SurfacePtr surface, const Vector& position,
                              float angle, const Color& color, const Blend& blend,
                              int layer)
 {
@@ -102,20 +102,20 @@ DrawingContext::draw_surface(const Surface* surface, const Vector& position,
   request->color = color;
   request->blend = blend;
 
-  request->request_data = const_cast<Surface*> (surface);
+  request->request_data = surface.get();
 
   requests->push_back(request);
 }
 
 void
-DrawingContext::draw_surface(const Surface* surface, const Vector& position,
+DrawingContext::draw_surface(SurfacePtr surface, const Vector& position,
                              int layer)
 {
   draw_surface(surface, position, 0.0f, Color(1.0f, 1.0f, 1.0f), Blend(), layer);
 }
 
 void
-DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
+DrawingContext::draw_surface_part(SurfacePtr surface, const Vector& source,
                                   const Vector& size, const Vector& dest, int layer)
 {
   assert(surface != 0);
@@ -132,7 +132,7 @@ DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
   SurfacePartRequest* surfacepartrequest = new(obst) SurfacePartRequest();
   surfacepartrequest->size = size;
   surfacepartrequest->source = source;
-  surfacepartrequest->surface = surface;
+  surfacepartrequest->surface = surface.get();
 
   // clip on screen borders
   if(request->pos.x < 0) {
@@ -155,7 +155,7 @@ DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
 }
 
 void
-DrawingContext::draw_text(const Font* font, const std::string& text,
+DrawingContext::draw_text(FontPtr font, const std::string& text,
                           const Vector& position, FontAlignment alignment, int layer, Color color)
 {
   DrawingRequest* request = new(obst) DrawingRequest();
@@ -169,7 +169,7 @@ DrawingContext::draw_text(const Font* font, const std::string& text,
   request->color = color;
 
   TextRequest* textrequest = new(obst) TextRequest();
-  textrequest->font = font;
+  textrequest->font = font.get();
   textrequest->text = text;
   textrequest->alignment = alignment;
   request->request_data = textrequest;
@@ -178,7 +178,7 @@ DrawingContext::draw_text(const Font* font, const std::string& text,
 }
 
 void
-DrawingContext::draw_center_text(const Font* font, const std::string& text,
+DrawingContext::draw_center_text(FontPtr font, const std::string& text,
                                  const Vector& position, int layer, Color color)
 {
   draw_text(font, text, Vector(position.x + SCREEN_WIDTH/2, position.y),
@@ -231,14 +231,14 @@ DrawingContext::draw_filled_rect(const Vector& topleft, const Vector& size,
 }
 
 void
-DrawingContext::draw_filled_rect(const Rect& rect, const Color& color,
+DrawingContext::draw_filled_rect(const Rectf& rect, const Color& color,
                                  int layer)
 {
   draw_filled_rect(rect, color, 0.0f, layer);
 }
 
 void
-DrawingContext::draw_filled_rect(const Rect& rect, const Color& color, float radius, int layer)
+DrawingContext::draw_filled_rect(const Rectf& rect, const Color& color, float radius, int layer)
 {
   DrawingRequest* request = new(obst) DrawingRequest();