Allow creation of a Color object feeding with a vector of Uints.
authorRicardo Cruz <rick2@aeiou.pt>
Sat, 21 Aug 2004 11:39:59 +0000 (11:39 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Sat, 21 Aug 2004 11:39:59 +0000 (11:39 +0000)
SVN-Revision: 1820

lib/video/screen.h

index a1797fe..93c0bfa 100644 (file)
@@ -26,6 +26,8 @@
 #endif
 #include <iostream>
 
+#include <vector>
+
 namespace SuperTux
   {
     
@@ -42,6 +44,11 @@ namespace SuperTux
           : red(red_), green(green_), blue(blue_), alpha(alpha_)
       {}
 
+      Color(std::vector <unsigned int> color)
+          : red(0), green(0), blue(0), alpha(255)
+      { if(color.size() >= 3) { red = color[0]; green = color[1]; blue = color[2]; }
+        if(color.size() == 4) alpha = color[3]; }
+
       Color(const Color& o)
           : red(o.red), green(o.green), blue(o.blue), alpha(o.alpha)
       { }