Apply filters when reloading Surfaces.
authorRicardo Cruz <rick2@aeiou.pt>
Wed, 20 Oct 2004 21:08:51 +0000 (21:08 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Wed, 20 Oct 2004 21:08:51 +0000 (21:08 +0000)
Fixes bug that after changing video mode, player only looked right and enemies left.

SVN-Revision: 2042

lib/video/surface.cpp
lib/video/surface.h

index 1c69e3f..bcb8dc8 100644 (file)
@@ -194,12 +194,21 @@ Surface::reload()
   {
     w = impl->w;
     h = impl->h;
+    for(std::vector<SurfaceData::Filter>::iterator i =
+        data.applied_filters.begin(); i != data.applied_filters.end();
+        i++)
+      impl->apply_filter(i->type, i->color);
   }
 }
 
 void Surface::apply_filter(int filter, Color color)
 {
 impl->apply_filter(filter, color);
+
+SurfaceData::Filter apply_filter;
+apply_filter.type = filter;
+apply_filter.color = color;
+data.applied_filters.push_back(apply_filter);
 }
 
 Surface::~Surface()
index ef311d8..2a27db8 100644 (file)
@@ -72,6 +72,10 @@ namespace SuperTux
       ConstructorType type;
       SDL_Surface* surface;
       std::string file;
+
+      struct Filter { int type; Color color; };
+      std::vector<Filter> applied_filters;
+
       bool use_alpha;
       int x;
       int y;