trimmed mobile.

This commit is contained in:
Bryce Covert
2017-05-19 16:15:37 -07:00
parent 84144efef9
commit f7c1cea01a
29 changed files with 253 additions and 350 deletions

View File

@@ -1,5 +1,5 @@
(ns advent.utils
(:refer-clojure :exclude [load])
(:require [play-clj.core :refer :all]
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
@@ -12,7 +12,7 @@
[clojure.string :as str]
[advent.saves :as saves]
[advent.steam :as steam]
[clojure.core.async :refer [put! <! <!! >! chan go go-loop thread take! alts!! poll! dropping-buffer]])
[clojure.core.async :refer [put! <! <!! >! chan go go-loop thread take! alts!! dropping-buffer]])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Format Pixmap$Blending Pixmap$Filter Texture Texture$TextureFilter]
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
[com.badlogic.gdx.utils.viewport FitViewport]
@@ -427,7 +427,8 @@
(doto (music (str r ".mp3")) (music! :set-looping true)))))
(defn load-sound [f]
(try
nil
#_(try
(iosify
(sound (str f ".mp3"))
(sound f)
@@ -674,23 +675,29 @@
(play-sound! screen entities snd volume-fn pan type 1.0))
([screen entities snd volume-fn pan type pitch]
(if (if (keyword? snd)
(or (-> entities :room :sounds snd)
(-> entities :sounds snd))
snd)
(let [vol (volume-fn entities)
snd (if (keyword? snd)
(or (-> entities :room :sounds snd)
(-> entities :sounds snd))
snd)
sound-id (if (= :once type)
(sound! snd :play (scale-vol-from-fade entities (current-sound-volume vol)) (or pitch 1.0) pan )
(sound! snd :loop 0.0 (or pitch 1.0) pan )) ]
(update-in entities [:current-sounds :value]
conj {:id sound-id
:sound snd
:sound snd
:volume-fn volume-fn
:type type
:ends-at (if (= type :once)
(+ (:total-time screen) 1.0 #_(sound! snd :duration))
nil)}))))
nil)}))
entities)))
(defn stop-all-sounds! [entities]
(doseq [snd (get-in entities [:current-sounds :value])]