summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d.rb2
-rw-r--r--lib/ruby2d/music.rb16
-rw-r--r--lib/ruby2d/sound.rb14
3 files changed, 23 insertions, 9 deletions
diff --git a/lib/ruby2d.rb b/lib/ruby2d.rb
index 125ad82..4be4f39 100644
--- a/lib/ruby2d.rb
+++ b/lib/ruby2d.rb
@@ -12,6 +12,8 @@ require 'ruby2d/triangle'
require 'ruby2d/image'
require 'ruby2d/sprite'
require 'ruby2d/text'
+require 'ruby2d/sound'
+require 'ruby2d/music'
require 'ruby2d/ruby2d' # load native extension
include Ruby2D::DSL
diff --git a/lib/ruby2d/music.rb b/lib/ruby2d/music.rb
new file mode 100644
index 0000000..6d9475e
--- /dev/null
+++ b/lib/ruby2d/music.rb
@@ -0,0 +1,16 @@
+# music.rb
+
+module Ruby2D
+ class Music
+
+ attr_accessor :data, :loop
+ attr_reader :path
+
+ def initialize(path)
+ # TODO: Check if file exists
+ @path = path
+ @loop = false
+ end
+
+ end
+end
diff --git a/lib/ruby2d/sound.rb b/lib/ruby2d/sound.rb
index edbbef9..4691f6d 100644
--- a/lib/ruby2d/sound.rb
+++ b/lib/ruby2d/sound.rb
@@ -3,16 +3,12 @@
module Ruby2D
class Sound
- 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
+ attr_accessor :data
+ attr_reader :path
- def play
- @window.play_audio(self)
+ def initialize(path)
+ # TODO: Check if file exists
+ @path = path
end
end