diff options
| author | Tom Black <[email protected]> | 2017-02-17 01:02:01 -0500 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2017-02-17 01:02:01 -0500 |
| commit | 664effae7876ac641694ec2247139bdd2373fb6d (patch) | |
| tree | a88f67d2e18a279d9aa0c5662a3691924152afe7 /lib | |
| parent | 8c91874c7ec750426aaf3a08d295f46148cb7d82 (diff) | |
| download | ruby2d-664effae7876ac641694ec2247139bdd2373fb6d.tar.gz ruby2d-664effae7876ac641694ec2247139bdd2373fb6d.zip | |
Add `init` method for native extension initialization
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ruby2d/image.rb | 1 | ||||
| -rw-r--r-- | lib/ruby2d/music.rb | 1 | ||||
| -rw-r--r-- | lib/ruby2d/sound.rb | 1 | ||||
| -rw-r--r-- | lib/ruby2d/sprite.rb | 1 | ||||
| -rw-r--r-- | lib/ruby2d/text.rb | 1 |
5 files changed, 5 insertions, 0 deletions
diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb index 40e3878..dd18ac1 100644 --- a/lib/ruby2d/image.rb +++ b/lib/ruby2d/image.rb @@ -18,6 +18,7 @@ module Ruby2D @type_id = 3 @x, @y, @path = x, y, path @color = Color.new([1, 1, 1, 1]) + init(path) add end diff --git a/lib/ruby2d/music.rb b/lib/ruby2d/music.rb index 6d9475e..410c82f 100644 --- a/lib/ruby2d/music.rb +++ b/lib/ruby2d/music.rb @@ -8,6 +8,7 @@ module Ruby2D def initialize(path) # TODO: Check if file exists + init(path) @path = path @loop = false end diff --git a/lib/ruby2d/sound.rb b/lib/ruby2d/sound.rb index 4691f6d..1049eee 100644 --- a/lib/ruby2d/sound.rb +++ b/lib/ruby2d/sound.rb @@ -8,6 +8,7 @@ module Ruby2D def initialize(path) # TODO: Check if file exists + init(path) @path = path end diff --git a/lib/ruby2d/sprite.rb b/lib/ruby2d/sprite.rb index 91a555e..d5695a1 100644 --- a/lib/ruby2d/sprite.rb +++ b/lib/ruby2d/sprite.rb @@ -20,6 +20,7 @@ module Ruby2D @current_frame = 0 @current_frame_time = 0 + init(path) if Module.const_defined? :DSL Application.add(self) end diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb index 341384e..8466af6 100644 --- a/lib/ruby2d/text.rb +++ b/lib/ruby2d/text.rb @@ -18,6 +18,7 @@ module Ruby2D @x, @y, @size = x, y, size @text = text @color = Color.new(c) + init add end |
