Snowman: Created body-only animation and added it to the squished collision handler.
[supertux.git] / src / object / gradient.cpp
index 2a785f6..9d1efea 100644 (file)
 #include "supertux/object_factory.hpp"
 #include "util/reader.hpp"
 
+#include <stdexcept>
+
 Gradient::Gradient() :
-  layer(LAYER_BACKGROUND0)
+  layer(LAYER_BACKGROUND0),
+  gradient_top(),
+  gradient_bottom()
 {
 }
 
 Gradient::Gradient(const Reader& reader) :
-  layer(LAYER_BACKGROUND0)
+  layer(LAYER_BACKGROUND0),
+  gradient_top(),
+  gradient_bottom()
 {
-  reader.get("layer", layer);
+  layer = reader_get_layer (reader, /* default = */ LAYER_BACKGROUND0);
   std::vector<float> bkgd_top_color, bkgd_bottom_color;
   if(!reader.get("top_color", bkgd_top_color) ||
      !reader.get("bottom_color", bkgd_bottom_color))
@@ -68,6 +74,4 @@ Gradient::draw(DrawingContext& context)
   context.pop_transform();
 }
 
-IMPLEMENT_FACTORY(Gradient, "gradient");
-
 /* EOF */