diff options
| author | Tom Black <[email protected]> | 2018-12-02 01:34:29 -0800 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2018-12-12 00:04:19 -0800 |
| commit | 0f52b2115a5f910ae4d3350f7400bb11622ea899 (patch) | |
| tree | 843cfd6db52bb812116ebee1e7655a2ba0feed93 /lib | |
| parent | 80a2c9b1e14b5ed6a68107db407568e63547ac8d (diff) | |
| download | ruby2d-0f52b2115a5f910ae4d3350f7400bb11622ea899.tar.gz ruby2d-0f52b2115a5f910ae4d3350f7400bb11622ea899.zip | |
Remove current web backend
Preparing for WebAssembly
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ruby2d/image.rb | 11 | ||||
| -rw-r--r-- | lib/ruby2d/music.rb | 8 | ||||
| -rw-r--r-- | lib/ruby2d/sound.rb | 8 | ||||
| -rw-r--r-- | lib/ruby2d/sprite.rb | 8 | ||||
| -rw-r--r-- | lib/ruby2d/text.rb | 8 | ||||
| -rw-r--r-- | lib/ruby2d/window.rb | 6 |
6 files changed, 13 insertions, 36 deletions
diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb index 793c25a..0516f4f 100644 --- a/lib/ruby2d/image.rb +++ b/lib/ruby2d/image.rb @@ -8,14 +8,10 @@ module Ruby2D attr_accessor :x, :y, :width, :height, :rotate, :data def initialize(path, opts = {}) - @path = path - - unless RUBY_ENGINE == 'opal' - unless File.exist? @path - raise Error, "Cannot find image file `#{@path}`" - end + unless File.exist? path + raise Error, "Cannot find image file `#{path}`" end - + @path = path @x = opts[:x] || 0 @y = opts[:y] || 0 @z = opts[:z] || 0 @@ -23,7 +19,6 @@ module Ruby2D @height = opts[:height] || nil @rotate = opts[:rotate] || 0 self.color = opts[:color] || 'white' - ext_init(@path) add end diff --git a/lib/ruby2d/music.rb b/lib/ruby2d/music.rb index bc4ec5a..ef8deb5 100644 --- a/lib/ruby2d/music.rb +++ b/lib/ruby2d/music.rb @@ -7,13 +7,9 @@ module Ruby2D attr_accessor :loop, :data def initialize(path) - - unless RUBY_ENGINE == 'opal' - unless File.exist? path - raise Error, "Cannot find audio file `#{path}`" - end + unless File.exist? path + raise Error, "Cannot find audio file `#{path}`" end - @path = path @loop = false ext_init(path) diff --git a/lib/ruby2d/sound.rb b/lib/ruby2d/sound.rb index 0a0b40d..2c78525 100644 --- a/lib/ruby2d/sound.rb +++ b/lib/ruby2d/sound.rb @@ -7,13 +7,9 @@ module Ruby2D attr_accessor :data def initialize(path) - - unless RUBY_ENGINE == 'opal' - unless File.exist? path - raise Error, "Cannot find audio file `#{path}`" - end + unless File.exist? path + raise Error, "Cannot find audio file `#{path}`" end - @path = path ext_init(path) end diff --git a/lib/ruby2d/sprite.rb b/lib/ruby2d/sprite.rb index cc9e31f..bd91cd1 100644 --- a/lib/ruby2d/sprite.rb +++ b/lib/ruby2d/sprite.rb @@ -8,12 +8,8 @@ module Ruby2D attr_accessor :rotate, :loop, :clip_x, :clip_y, :clip_width, :clip_height, :data def initialize(path, opts = {}) - - # Check if sprite file exists, unless running on the web - unless RUBY_ENGINE == 'opal' - unless File.exist? path - raise Error, "Cannot find sprite image file `#{path}`" - end + unless File.exist? path + raise Error, "Cannot find sprite image file `#{path}`" end # Sprite image file path diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb index 93ea062..796cdb6 100644 --- a/lib/ruby2d/text.rb +++ b/lib/ruby2d/text.rb @@ -15,13 +15,9 @@ module Ruby2D @size = opts[:size] || 20 @rotate = opts[:rotate] || 0 @font = opts[:font] || Font.default - - unless RUBY_ENGINE == 'opal' - unless File.exist? @font - raise Error, "Cannot find font file `#{@font}`" - end + unless File.exist? @font + raise Error, "Cannot find font file `#{@font}`" end - self.color = opts[:color] || 'white' ext_init add diff --git a/lib/ruby2d/window.rb b/lib/ruby2d/window.rb index fa12fd0..e08d13c 100644 --- a/lib/ruby2d/window.rb +++ b/lib/ruby2d/window.rb @@ -320,10 +320,8 @@ module Ruby2D # Add controller mappings from file def add_controller_mappings - unless RUBY_ENGINE == 'opal' - if File.exist? @controller_mappings - ext_add_controller_mappings(@controller_mappings) - end + if File.exist? @controller_mappings + ext_add_controller_mappings(@controller_mappings) end end |
