gamnit: intro color services to `Sprite`
authorAlexis Laferrière <alexis.laf@xymus.net>
Thu, 23 Mar 2017 16:59:40 +0000 (12:59 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 23 Mar 2017 23:33:00 +0000 (19:33 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/gamnit/flat.nit

index 6471c8f..6eb8fab 100644 (file)
@@ -110,6 +110,36 @@ class Sprite
                scale_direct = value
        end
 
+       # Red tint applied to `texture` on draw
+       fun red: Float do return tint[0]
+
+       # Red tint applied to `texture` on draw
+       fun red=(value: Float)
+       do
+               if isset _tint and value != red then needs_update
+               tint[0] = value
+       end
+
+       # Green tint applied to `texture` on draw
+       fun green: Float do return tint[1]
+
+       # Green tint applied to `texture` on draw
+       fun green=(value: Float)
+       do
+               if isset _tint and value != green then needs_update
+               tint[1] = value
+       end
+
+       # Blue tint applied to `texture` on draw
+       fun blue: Float do return tint[2]
+
+       # Blue tint applied to `texture` on draw
+       fun blue=(value: Float)
+       do
+               if isset _tint and value != blue then needs_update
+               tint[2] = value
+       end
+
        # Transparency applied to `texture` on draw
        fun alpha: Float do return tint[3]