summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/image.rb4
-rw-r--r--lib/ruby2d/music.rb4
-rw-r--r--lib/ruby2d/sound.rb4
-rw-r--r--lib/ruby2d/sprite.rb4
-rw-r--r--lib/ruby2d/text.rb4
5 files changed, 15 insertions, 5 deletions
diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb
index 1341f89..67ce1b1 100644
--- a/lib/ruby2d/image.rb
+++ b/lib/ruby2d/image.rb
@@ -20,7 +20,9 @@ module Ruby2D
@rotate = opts[:rotate] || 0
self.color = opts[:color] || 'white'
self.opacity = opts[:opacity] if opts[:opacity]
- ext_init(@path)
+ unless ext_init(@path)
+ raise Error, "Image `#{@path}` cannot be created"
+ end
add
end
diff --git a/lib/ruby2d/music.rb b/lib/ruby2d/music.rb
index ef8deb5..46aab0a 100644
--- a/lib/ruby2d/music.rb
+++ b/lib/ruby2d/music.rb
@@ -12,7 +12,9 @@ module Ruby2D
end
@path = path
@loop = false
- ext_init(path)
+ unless ext_init(@path)
+ raise Error, "Music `#{@path}` cannot be created"
+ end
end
# Play the music
diff --git a/lib/ruby2d/sound.rb b/lib/ruby2d/sound.rb
index 2c78525..2dae996 100644
--- a/lib/ruby2d/sound.rb
+++ b/lib/ruby2d/sound.rb
@@ -11,7 +11,9 @@ module Ruby2D
raise Error, "Cannot find audio file `#{path}`"
end
@path = path
- ext_init(path)
+ unless ext_init(@path)
+ raise Error, "Sound `#{@path}` cannot be created"
+ end
end
# Play the sound
diff --git a/lib/ruby2d/sprite.rb b/lib/ruby2d/sprite.rb
index 94a6ea2..8405e5f 100644
--- a/lib/ruby2d/sprite.rb
+++ b/lib/ruby2d/sprite.rb
@@ -45,7 +45,9 @@ module Ruby2D
@img_width = nil; @img_height = nil
# Initialize the sprite
- ext_init(@path)
+ unless ext_init(@path)
+ raise Error, "Sprite image `#{@path}` cannot be created"
+ end
# The clipping rectangle
@clip_x = opts[:clip_x] || 0
diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb
index a526672..d62bc0b 100644
--- a/lib/ruby2d/text.rb
+++ b/lib/ruby2d/text.rb
@@ -20,7 +20,9 @@ module Ruby2D
unless File.exist? @font
raise Error, "Cannot find font file `#{@font}`"
end
- ext_init
+ unless ext_init
+ raise Error, "Text `#{@text}` cannot be created"
+ end
add
end