This commit is contained in:
Bryce
2023-05-17 15:10:16 -07:00
parent 8ee743e371
commit 18d95f7e20
90 changed files with 2264 additions and 615 deletions

View File

@@ -135,16 +135,20 @@
(defn current-music-volume
(^double [] (current-music-volume 1.0))
(^double [^double factor]
(-> (Math/pow (unchecked-multiply (:music-volume @settings) 0.01) 2)
(unchecked-multiply 0.25)
(unchecked-multiply (double factor)))))
(min (max (-> (Math/pow (unchecked-multiply (:music-volume @settings) 0.01) 2)
(unchecked-multiply 0.25)
(unchecked-multiply (double factor)))
0.0)
1.0)))
(defn current-sound-volume
(^double [] (current-sound-volume 1.0))
(^double [^double factor]
(-> (Math/pow (unchecked-multiply (:sound-volume @settings) 0.01) 2)
(unchecked-multiply 0.5)
(unchecked-multiply (double factor)))))
(min (max (-> (Math/pow (unchecked-multiply (:sound-volume @settings) 0.01) 2)
(unchecked-multiply 0.5)
(unchecked-multiply (double factor)))
0.0)
1.0)))
(defn cursor [filename which]
(let [scale 4
@@ -156,7 +160,8 @@
[hot-x hot-y] (+cursor-hotspots+ which [0 0])
hot-x (int hot-x)
hot-y (int hot-y)]
(Pixmap/setFilter Pixmap$Filter/NearestNeighbour)
(pixmap! resized :set-filter Pixmap$Filter/NearestNeighbour)
(pixmap! base-cursor :set-filter Pixmap$Filter/NearestNeighbour)
(pixmap! resized :draw-pixmap base-cursor (* index 18) 0 16 16
0 0 target-width target-height)
@@ -248,11 +253,12 @@
(defn publish-screenshot-fn []
(do
(log/info "Taking Desktop screenshot...")
(Pixmap/setFilter Pixmap$Filter/BiLinear)
(let [viewport (-> @ (resolve 'advent.screens.scene/scene) :screen deref :viewport)
[x y w h g-l g-r] [(.getScreenX ^FitViewport viewport) (.getScreenY ^FitViewport viewport) (.getScreenWidth ^FitViewport viewport) (.getScreenHeight ^FitViewport viewport)]
pm (ScreenUtils/getFrameBufferPixmap x y w h)
resized (Pixmap. 160 120 Pixmap$Format/RGB888)]
(pixmap! pm :set-filter Pixmap$Filter/BiLinear)
(pixmap! resized :set-filter Pixmap$Filter/BiLinear)
(.drawPixmap resized pm 0 0 (.getWidth pm) (.getHeight pm) 0 0 160 120)
(.dispose pm)
(fn [] resized))))
@@ -460,7 +466,8 @@
(defn play-music [snd]
(music! snd :play))
(music! snd :play)
(println "is playing:" (music! snd :is-playing)))
(defn stop-music [snd]
(music! snd :stop))