diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ruby2d/image.rb | 4 | ||||
| -rw-r--r-- | lib/ruby2d/sprite.rb | 2 | ||||
| -rw-r--r-- | lib/ruby2d/text.rb | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb index 9386f6b..5a57953 100644 --- a/lib/ruby2d/image.rb +++ b/lib/ruby2d/image.rb @@ -7,8 +7,8 @@ module Ruby2D attr_reader :path, :color attr_accessor :x, :y, :width, :height, :rotate, :data - def initialize(opts = {}) - @path = opts[:path] + def initialize(path, opts = {}) + @path = path unless RUBY_ENGINE == 'opal' unless File.exists? @path diff --git a/lib/ruby2d/sprite.rb b/lib/ruby2d/sprite.rb index a00617f..35c3c90 100644 --- a/lib/ruby2d/sprite.rb +++ b/lib/ruby2d/sprite.rb @@ -4,7 +4,7 @@ module Ruby2D class Sprite include Renderable - attr_reader :x, :y, :width, :height + attr_reader :x, :y, :width, :height attr_accessor :rotate, :loop, :clip_x, :clip_y, :clip_width, :clip_height, :data def initialize(path, opts = {}) diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb index a8df8b5..5f942cd 100644 --- a/lib/ruby2d/text.rb +++ b/lib/ruby2d/text.rb @@ -7,11 +7,11 @@ module Ruby2D attr_reader :text, :size, :width, :height, :font, :color attr_accessor :x, :y, :rotate, :data - def initialize(opts = {}) + def initialize(text, opts = {}) @x = opts[:x] || 0 @y = opts[:y] || 0 @z = opts[:z] || 0 - @text = (opts[:text] || "Hello Ruby!").to_s + @text = text.to_s @size = opts[:size] || 20 @rotate = opts[:rotate] || 0 @font = opts[:font] || Font.default |
