summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorTom Black <[email protected]>2017-02-17 00:09:57 -0500
committerTom Black <[email protected]>2017-02-17 00:09:57 -0500
commitfd919d5b52b26a88c3aee3d91756c1bcc6e9d1e3 (patch)
tree86d393e03dc26b78be9c2641bee74f82be3f439d /lib
parent46f566d161b07c0e319cae628a564b034b3ecf0a (diff)
downloadruby2d-fd919d5b52b26a88c3aee3d91756c1bcc6e9d1e3.tar.gz
ruby2d-fd919d5b52b26a88c3aee3d91756c1bcc6e9d1e3.zip
Simplify color handling for text class
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/text.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb
index 3cb901b..68e8ba3 100644
--- a/lib/ruby2d/text.rb
+++ b/lib/ruby2d/text.rb
@@ -4,6 +4,7 @@ module Ruby2D
class Text
attr_accessor :x, :y, :size, :text, :data
+ attr_reader :color
def initialize(x=0, y=0, size=20, text="Hello World!", font="Arial", c="white")
@@ -15,8 +16,8 @@ module Ruby2D
@type_id = 5
@x, @y, @size = x, y, size
- @text, @color = text, c
- update_color(c)
+ @text = text
+ @color = Color.new(c)
if Module.const_defined? :DSL
Application.add(self)
@@ -24,8 +25,7 @@ module Ruby2D
end
def color=(c)
- @color = c
- update_color(c)
+ @color = Color.new(c)
end
def text=(t)
@@ -55,9 +55,5 @@ module Ruby2D
end
end
- def update_color(c)
- @c = Color.new(c)
- end
-
end
end