Add sound
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
(:require [play-clj.utils :as u])
|
(:require [play-clj.utils :as u])
|
||||||
(:import [com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
|
(:import [com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
|
||||||
InputMultiplexer InputProcessor Net Screen]
|
InputMultiplexer InputProcessor Net Screen]
|
||||||
|
[com.badlogic.gdx.audio Sound]
|
||||||
[com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera
|
[com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera
|
||||||
PerspectiveCamera]
|
PerspectiveCamera]
|
||||||
[com.badlogic.gdx.graphics.g2d SpriteBatch TextureRegion]
|
[com.badlogic.gdx.graphics.g2d SpriteBatch TextureRegion]
|
||||||
|
|||||||
@@ -120,3 +120,20 @@
|
|||||||
[^InputProcessor p]
|
[^InputProcessor p]
|
||||||
(let [^InputMultiplexer multi (input! :get-input-processor)]
|
(let [^InputMultiplexer multi (input! :get-input-processor)]
|
||||||
(.removeProcessor multi p)))
|
(.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))
|
||||||
|
|||||||
Reference in New Issue
Block a user