From: Alexis Laferrière Date: Thu, 23 Mar 2017 16:59:40 +0000 (-0400) Subject: gamnit: intro color services to `Sprite` X-Git-Url: http://nitlanguage.org gamnit: intro color services to `Sprite` Signed-off-by: Alexis Laferrière --- diff --git a/lib/gamnit/flat.nit b/lib/gamnit/flat.nit index 6471c8f..6eb8fab 100644 --- a/lib/gamnit/flat.nit +++ b/lib/gamnit/flat.nit @@ -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]