a first implementation of doors to switch between sectors
[supertux.git] / src / sprite.cpp
index bb31251..68315f1 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)
 {
@@ -29,14 +30,14 @@ Sprite::Sprite(lisp_object_t* cur)
 
   LispReader reader(cur);
 
-  if(!reader.read_string("name",   &name))
+  if(!reader.read_string("name", name))
     st_abort("Sprite wihtout name", "");
-  reader.read_int("x-hotspot", &x_hotspot);
-  reader.read_int("y-hotspot", &y_hotspot);
-  reader.read_float("fps",     &fps);
+  reader.read_int("x-hotspot", x_hotspot);
+  reader.read_int("y-hotspot", y_hotspot);
+  reader.read_float("fps",     fps);
 
   std::vector<std::string> images;
-  if(!reader.read_string_vector("images", &images))
+  if(!reader.read_string_vector("images", images))
     st_abort("Sprite contains no images: ", name.c_str());
 
   for(std::vector<std::string>::size_type i = 0; i < images.size(); ++i)
@@ -73,15 +74,21 @@ Sprite::update(float /*delta*/)
 }
 
 void
-Sprite::draw(float x, float y)
+Sprite::draw(DrawingContext& context, const Vector& pos, int layer,
+    uint32_t drawing_effect)
 {
   time = SDL_GetTicks();
   unsigned int frame = get_current_frame();
 
   if (frame < surfaces.size())
-    surfaces[frame]->draw(x - x_hotspot, y - y_hotspot);
+  {
+    Surface* surface = surfaces[frame];
+    
+    context.draw_surface(surface, pos - Vector(x_hotspot, y_hotspot), layer, drawing_effect);
+  }
 }
 
+#if 0
 void
 Sprite::draw_part(float sx, float sy, float x, float y, float w, float h)
 {
@@ -91,6 +98,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()