Class: Ruby2D::Sound
- Inherits:
-
Object
- Object
- Ruby2D::Sound
- Defined in:
- lib/ruby2d/sound.rb
Instance Method Summary collapse
-
#initialize(window, path) ⇒ Sound
constructor
A new instance of Sound.
- #play ⇒ Object
Constructor Details
#initialize(window, path) ⇒ Sound
Returns a new instance of Sound.
6 7 8 9 10 11 12 |
# File 'lib/ruby2d/sound.rb', line 6 def initialize(window, path) unless File.exists? path raise Error, "Cannot find sound file!" end window.create_audio(self, path) @window, @path = window, path end |
Instance Method Details
#play ⇒ Object
14 15 16 |
# File 'lib/ruby2d/sound.rb', line 14 def play @window.play_audio(self) end |