fix tiles being 1 pixel off their correct position
[supertux.git] / src / sprite.cpp
index f5f1f65..c4d552f 100644 (file)
@@ -22,6 +22,7 @@
 #include "globals.h"
 #include "sprite.h"
 #include "setup.h"
+#include "screen/drawing_context.h"
 
 Sprite::Sprite(lisp_object_t* cur)
 {
@@ -73,22 +74,29 @@ Sprite::update(float /*delta*/)
 }
 
 void
-Sprite::draw(float x, float y, int special_drawing)
+Sprite::draw(DrawingContext& context, const Vector& pos, int layer,
+    int special_drawing)
 {
   time = SDL_GetTicks();
   unsigned int frame = get_current_frame();
 
   if (frame < surfaces.size())
-    {
+  {
+    Surface* surface = surfaces[frame];
+    
+#if 0 // TODO
     if(special_drawing == SD_SEMI_TRANSPARENT)
       surfaces[frame]->draw(x - x_hotspot, y - y_hotspot, 128);
     if(special_drawing == SD_VERTICAL_FLIP)
       surfaces[frame]->draw(x - x_hotspot, y - y_hotspot, 255, true);
     else
       surfaces[frame]->draw(x - x_hotspot, y - y_hotspot);
-    }
+#endif
+    context.draw_surface(surface, pos - Vector(x_hotspot, y_hotspot), layer);
+  }
 }
 
+#if 0
 void
 Sprite::draw_part(float sx, float sy, float x, float y, float w, float h)
 {
@@ -98,6 +106,7 @@ Sprite::draw_part(float sx, float sy, float x, float y, float w, float h)
   if (frame < surfaces.size())
     surfaces[frame]->draw_part(sx, sy, x - x_hotspot, y - y_hotspot, w, h);
 }
+#endif
 
 void
 Sprite::reset()