Add sound

This commit is contained in:
oakes
2014-01-24 00:26:36 -05:00
parent 65fa306959
commit 076c0142cd
2 changed files with 18 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
(:require [play-clj.utils :as u])
(:import [com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
InputMultiplexer InputProcessor Net Screen]
[com.badlogic.gdx.audio Sound]
[com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera
PerspectiveCamera]
[com.badlogic.gdx.graphics.g2d SpriteBatch TextureRegion]

View File

@@ -120,3 +120,20 @@
[^InputProcessor p]
(let [^InputMultiplexer multi (input! :get-input-processor)]
(.removeProcessor multi p)))
(defn sound*
"The function version of `sound`"
[^String path]
(audio! :new-sound (files! :internal path)))
(defmacro sound
"Returns a [Sound](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/audio/Sound.html)
(sound \"playerhurt.wav\")"
[path & options]
`(u/calls! ^Sound (sound* ~path) ~@options))
(defmacro sound!
"Calls a single method on a `sound`"
[object k & options]
`(u/call! ^Sound ~object ~k ~@options))