From a583129cd8aab9ee275bc54254a0bd5fc7fe09a7 Mon Sep 17 00:00:00 2001 From: Tom Black Date: Thu, 16 Feb 2017 23:58:23 -0500 Subject: Add color to image class --- lib/ruby2d/image.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb index dad263b..0546db5 100644 --- a/lib/ruby2d/image.rb +++ b/lib/ruby2d/image.rb @@ -4,7 +4,7 @@ module Ruby2D class Image attr_accessor :x, :y, :width, :height, :data - attr_reader :path + attr_reader :path, :color def initialize(x, y, path) @@ -14,12 +14,17 @@ module Ruby2D @type_id = 3 @x, @y, @path = x, y, path + @color = Color.new([1, 1, 1, 1]) if Module.const_defined? :DSL Application.add(self) end end + def color=(c) + @color = Color.new(c) + end + def remove if Module.const_defined? :DSL Application.remove(self) -- cgit v1.2.3