#ifndef __BACKGROUND_H__
#define __BACKGROUND_H__
-#include "texture.h"
+#include "screen/texture.h"
+#include "screen/drawing_context.h"
#include "game_object.h"
-#include "drawable.h"
-
-enum {
- BACKGROUND_GRADIENT,
- BACKGROUND_IMAGE
-};
+#include "lispreader.h"
+#include "serializable.h"
class DisplayManager;
-class Background : public GameObject, public Drawable
+class Background : public GameObject, public Serializable
{
public:
- Background(DisplayManager& displaymanager);
+ Background();
+ Background(LispReader& reader);
virtual ~Background();
- void set_image(Surface* image, float bkgd_speed);
+ virtual void write(LispWriter& writer);
- void set_gradient(Color top, Color bottom);
+ void set_image(const std::string& name, float bkgd_speed);
- virtual std::string type() const
- { return "Background"; }
+ void set_gradient(Color top, Color bottom);
virtual void action(float elapsed_time);
- virtual void draw(ViewPort& viewport, int layer);
+ virtual void draw(DrawingContext& context);
private:
- int bgtype;
+ enum Type {
+ INVALID, GRADIENT, IMAGE
+ };
+
+ Type type;
+ std::string imagefile;
float speed;
Surface* image;
Color gradient_top, gradient_bottom;