diff options
| author | Tom Black <[email protected]> | 2016-11-27 23:25:17 -0500 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2016-11-27 23:25:17 -0500 |
| commit | 4df95c39d88d9c79649cc851ca7703f21c896200 (patch) | |
| tree | d9b15d3fbe6ecfd99e1e74513fb8f58abd398c41 /lib | |
| parent | 92fcfa846909bec9a939a3edd729d15fdce4d0ff (diff) | |
| download | ruby2d-4df95c39d88d9c79649cc851ca7703f21c896200.tar.gz ruby2d-4df95c39d88d9c79649cc851ca7703f21c896200.zip | |
Add accessors for Opal
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ruby2d/image.rb | 3 | ||||
| -rw-r--r-- | lib/ruby2d/sprite.rb | 2 | ||||
| -rw-r--r-- | lib/ruby2d/text.rb | 10 | ||||
| -rw-r--r-- | lib/ruby2d/triangle.rb | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb index 2e18b44..dad263b 100644 --- a/lib/ruby2d/image.rb +++ b/lib/ruby2d/image.rb @@ -3,7 +3,8 @@ module Ruby2D class Image - attr_accessor :x, :y + attr_accessor :x, :y, :width, :height, :data + attr_reader :path def initialize(x, y, path) diff --git a/lib/ruby2d/sprite.rb b/lib/ruby2d/sprite.rb index e327f7f..c04614a 100644 --- a/lib/ruby2d/sprite.rb +++ b/lib/ruby2d/sprite.rb @@ -3,7 +3,7 @@ module Ruby2D class Sprite - attr_accessor :x, :y + attr_accessor :x, :y, :data def initialize(x, y, path) diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb index ab4a204..3cb901b 100644 --- a/lib/ruby2d/text.rb +++ b/lib/ruby2d/text.rb @@ -2,12 +2,10 @@ module Ruby2D class Text - - attr_accessor :x, :y, :size, :text - def initialize(x=0, y=0, size=20, msg="Hello World!", font="Arial", c="white") - - if File.exists? font + attr_accessor :x, :y, :size, :text, :data + + def initialize(x=0, y=0, size=20, text="Hello World!", font="Arial", c="white") # if File.exists? font @font = font @@ -17,7 +15,7 @@ module Ruby2D @type_id = 5 @x, @y, @size = x, y, size - @text, @color = msg, c + @text, @color = text, c update_color(c) if Module.const_defined? :DSL diff --git a/lib/ruby2d/triangle.rb b/lib/ruby2d/triangle.rb index 8d4f373..ad13688 100644 --- a/lib/ruby2d/triangle.rb +++ b/lib/ruby2d/triangle.rb @@ -6,7 +6,7 @@ module Ruby2D attr_accessor :x1, :y1, :c1, :x2, :y2, :c2, :x3, :y3, :c3 - attr_reader :color + attr_reader :color, :type_id def initialize(x1=50, y1=0, x2=100, y2=100, x3=0, y3=100, c='white') @type_id = 1 |
