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

@@ -13,12 +13,12 @@
square: false, square: false,
stripWhitespaceX: false, stripWhitespaceX: false,
stripWhitespaceY: false, stripWhitespaceY: false,
alphaThreshold: 0, alphaThreshold: -1,
filterMin: Nearest, filterMin: Nearest,
filterMag: Nearest, filterMag: Nearest,
wrapX: ClampToEdge, wrapX: ClampToEdge,
wrapY: ClampToEdge, wrapY: ClampToEdge,
format: RGBA8888, format: RGBA4444,
alias: true, alias: true,
outputFormat: png, outputFormat: png,
jpegQuality: 0.9, jpegQuality: 0.9,

View File

@@ -1,6 +1,6 @@
(def version (str "2.0." (clojure.string/trim-newline (slurp "last-release")))) (def version (str "2.0." (clojure.string/trim-newline (slurp "last-release")) "-snapshot"))
(defproject advent version (defproject advent "2.0.5-SNAPSHOT"
:description "FIXME: write description" :description "FIXME: write description"
:manifest {"Implementation-Version" ~version} :manifest {"Implementation-Version" ~version}
@@ -8,19 +8,23 @@
:dependencies [[com.badlogicgames.gdx/gdx "1.9.3"] :dependencies [[com.badlogicgames.gdx/gdx "1.9.3"]
[com.badlogicgames.gdx/gdx-backend-lwjgl "1.9.3"] [com.badlogicgames.gdx/gdx-backend-lwjgl "1.9.3"]
[com.badlogicgames.gdx/gdx-platform "1.9.3" :classifier "natives-desktop"] [com.badlogicgames.gdx/gdx-platform "1.9.3" :classifier "natives-desktop"]
[org.clojure/clojure "1.8.0"] [org.skummet/clojure "1.6.0"]
[org.clojars.notid/tools.logging "0.3.2-SNAPSHOT"]
[play-clj "0.4.6-BRYCE"] [play-clj "0.4.6-BRYCE"]
[log4j/log4j "1.2.16"] [log4j/log4j "1.2.16"]
[org.clojure/data.priority-map "0.0.5"] [org.clojure/data.priority-map "0.0.5"]
[org.clojure/core.async "0.2.385"] [org.clojure/core.async "0.2.385"]
[org.clojure/tools.logging "0.3.1"] [org.clojure/core.async "0.1.346.0-17112a-alpha" :exclusions [org.clojure/clojure]]
[org.im4java/im4java "1.4.0"]] [org.im4java/im4java "1.4.0"]]
:plugins [[org.skummet/lein-skummet "0.2.2"]]
:exclusions [[org.clojure/clojure]]
:source-paths ["src" "src-common"] :source-paths ["src" "src-common"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"] :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:omit-source true :omit-source true
:aliases {"pack" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "asset-work/" "resources/packed/"] :aliases {"pack" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "asset-work/" "resources/packed/"]
"pack-pop" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "pack-pop" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker"
"/Users/brycecovert/Documents/POPPixelLogo_Pack/POPPixelLogo2_PNG/processed" "resources/packed-pop-logo/"] "/Users/brycecovert/Downloads/processed" "resources/packed-pop-logo/"]
"pack-font" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "resources/font-pack/" "resources/font-pack/packed/"] "pack-font" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "resources/font-pack/" "resources/font-pack/packed/"]
"script" ["run" "-m" "advent.analyze/dump-speech"]} "script" ["run" "-m" "advent.analyze/dump-speech"]}
:profiles { :profiles {
@@ -47,7 +51,7 @@
:app-store { :app-store {
:source-paths ["src" "src-common" "src-dev"] :source-paths ["src" "src-common" "src-dev"]
:jvm-opts ["-Dapp-store=true" "-Dui_scale=1.0" "-Dno-steam=true" "-Dis-desktop=true"] :jvm-opts ["-Dapp-store=true" "-Dui_scale=1.0" "-Dno-steam=true" "-Dis-desktop=true"]
:dependencies [[org.clojure/data.csv "0.1.3"]]
:warn-on-reflection true} :warn-on-reflection true}
:steam {:dependencies [[com.code-disaster.steamworks4j/steamworks4j "1.2.2"]] :steam {:dependencies [[com.code-disaster.steamworks4j/steamworks4j "1.2.2"]]
@@ -64,6 +68,6 @@
:warn-on-reflection true} :warn-on-reflection true}
} }
:aot [play-clj.entities advent.version advent.max-progress-bar advent.core.desktop-launcher] :aot :all
:main advent.core.desktop-launcher) :main advent.core.desktop-launcher)

View File

@@ -1,7 +1,7 @@
pack.png pack.png
size: 4096,4096 size: 4096,4096
format: RGBA8888 format: RGBA4444
filter: Nearest,Nearest filter: Nearest,Nearest
repeat: none repeat: none
POPPixelLogo_02_1 POPPixelLogo_02_1
@@ -11,13 +11,6 @@ POPPixelLogo_02_1
orig: 320, 240 orig: 320, 240
offset: 0, 0 offset: 0, 0
index: -1 index: -1
POPPixelLogo_02_198
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_5 POPPixelLogo_02_5
rotate: false rotate: false
xy: 2, 3632 xy: 2, 3632
@@ -25,42 +18,7 @@ POPPixelLogo_02_5
orig: 320, 240 orig: 320, 240
offset: 0, 0 offset: 0, 0
index: -1 index: -1
POPPixelLogo_02_188 POPPixelLogo_02_3
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_193
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_192
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_195
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_194
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_196
rotate: false rotate: false
xy: 2, 3632 xy: 2, 3632
size: 320, 240 size: 320, 240
@@ -74,7 +32,28 @@ POPPixelLogo_02_191
orig: 320, 240 orig: 320, 240
offset: 0, 0 offset: 0, 0
index: -1 index: -1
POPPixelLogo_02_2 POPPixelLogo_02_195
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_193
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_188
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_192
rotate: false rotate: false
xy: 2, 3632 xy: 2, 3632
size: 320, 240 size: 320, 240
@@ -88,6 +67,34 @@ POPPixelLogo_02_199
orig: 320, 240 orig: 320, 240
offset: 0, 0 offset: 0, 0
index: -1 index: -1
POPPixelLogo_02_200
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_196
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_194
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_2
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_189 POPPixelLogo_02_189
rotate: false rotate: false
xy: 2, 3632 xy: 2, 3632
@@ -95,7 +102,7 @@ POPPixelLogo_02_189
orig: 320, 240 orig: 320, 240
offset: 0, 0 offset: 0, 0
index: -1 index: -1
POPPixelLogo_02_3 POPPixelLogo_02_4
rotate: false rotate: false
xy: 2, 3632 xy: 2, 3632
size: 320, 240 size: 320, 240
@@ -109,14 +116,7 @@ POPPixelLogo_02_197
orig: 320, 240 orig: 320, 240
offset: 0, 0 offset: 0, 0
index: -1 index: -1
POPPixelLogo_02_200 POPPixelLogo_02_198
rotate: false
xy: 2, 3632
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
POPPixelLogo_02_4
rotate: false rotate: false
xy: 2, 3632 xy: 2, 3632
size: 320, 240 size: 320, 240

View File

@@ -1,7 +1,7 @@
pack.png pack.png
size: 2048,2048 size: 2048,2048
format: RGBA8888 format: RGBA4444
filter: Nearest,Nearest filter: Nearest,Nearest
repeat: none repeat: none
behindhouse/abc behindhouse/abc
@@ -179,21 +179,14 @@ cat-tree/dot
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
wizard/dot inside-antique/dot
rotate: false rotate: false
xy: 704, 916 xy: 704, 916
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ego/dot inside-jail/dot
rotate: false
xy: 704, 916
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
title/dot
rotate: false rotate: false
xy: 704, 916 xy: 704, 916
size: 1, 1 size: 1, 1
@@ -207,7 +200,14 @@ outsidehouse/dot
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
inside-antique/dot inside-house/dot
rotate: false
xy: 704, 916
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
title/dot
rotate: false rotate: false
xy: 704, 916 xy: 704, 916
size: 1, 1 size: 1, 1
@@ -221,14 +221,14 @@ dream/dot
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
inside-house/dot ego/dot
rotate: false rotate: false
xy: 704, 916 xy: 704, 916
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
inside-jail/dot wizard/dot
rotate: false rotate: false
xy: 704, 916 xy: 704, 916
size: 1, 1 size: 1, 1
@@ -1288,7 +1288,7 @@ wizard/talk
pack2.png pack2.png
size: 2048,2048 size: 2048,2048
format: RGBA8888 format: RGBA4444
filter: Nearest,Nearest filter: Nearest,Nearest
repeat: none repeat: none
behindhouse/brush behindhouse/brush
@@ -2134,7 +2134,7 @@ title/logo
pack3.png pack3.png
size: 2048,2048 size: 2048,2048
format: RGBA8888 format: RGBA4444
filter: Nearest,Nearest filter: Nearest,Nearest
repeat: none repeat: none
behindhouse/fgleft behindhouse/fgleft

View File

@@ -3,7 +3,7 @@
[play-clj.ui :refer :all] [play-clj.ui :refer :all]
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all] [play-clj.g2d :refer :all]
[clojure.pprint]
[clojure.string :as s] [clojure.string :as s]
[clojure.zip :as zip] [clojure.zip :as zip]
[clojure.set :as set] [clojure.set :as set]

View File

@@ -14,7 +14,7 @@
[advent.screens.safe :as safe] [advent.screens.safe :as safe]
[advent.screens.fade :as fade] [advent.screens.fade :as fade]
[advent.steam :as steam] [advent.steam :as steam]
[clojure.pprint]
[advent.pathfind]) [advent.pathfind])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter] (:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
[com.badlogic.gdx.graphics.g2d TextureRegion] [com.badlogic.gdx.graphics.g2d TextureRegion]
@@ -22,19 +22,26 @@
[java.io FileOutputStream File PrintStream]) [java.io FileOutputStream File PrintStream])
) )
(defn g []
(log/info "ABC"))
(defn a []
(g))
(defonce am (asset-manager)) (defonce am (asset-manager))
(set-asset-manager! am) (set-asset-manager! am)
(defn create-game [advent]
(log/log-capture! *ns* :warn :error)
(log/info "Starting game on version v" (advent.version/version))
(utils/listen-for-screenshots)
(set-screen! advent splash/splash-screen))
(defgame advent (defgame advent
:on-create :on-create
(fn [this] (fn [this]
(log/log-capture! *ns* :warn :error) (create-game advent)))
(log/info "Starting game on version v" (advent.version/version))
(utils/listen-for-screenshots)
(steam/init)
(set-screen! @(resolve 'advent.core/advent) splash/splash-screen)))
(defn reload [] (defn reload []
(on-gl (set-screen! advent title/title-screen))) (on-gl (set-screen! advent title/title-screen)))

View File

@@ -1,5 +1,7 @@
(ns advent.pathfind (ns advent.pathfind
(:require [play-clj.core :refer :all]) (:require [play-clj.core :refer :all]
[play-clj.utils :refer :all]
[clojure.tools.logging :as log])
(:import (java.lang Math))) (:import (java.lang Math)))
(def scale 2) (def scale 2)
@@ -120,18 +122,21 @@
(println path))) (println path)))
(defn map-from-resource [filename] (defn map-from-resource [filename]
(log/info "Loading collision from" filename)
(let [pm (pixmap filename) (let [pm (pixmap filename)
black (color 0 0 0 255) black (color 0 0 0 255)
painful (color 255 0 0 255) painful (color 255 0 0 255)
result (transient []) result (transient [])
scale (long scale) scale (long scale)
height (long (pixmap! pm :get-height))] height (long (pixmap! pm :get-height))
(doseq [^long x (range (/ (pixmap! pm :get-width) scale)) _ (doseq [^long x (range (/ (pixmap! pm :get-width) scale))
^long y (range (/ height scale)) ^long y (range (/ height scale))
:let [ :let [current-color (color (pixmap! pm :get-pixel (unchecked-multiply scale x) (unchecked-subtract height (unchecked-multiply scale y))))]]
current-color (color (pixmap! pm :get-pixel (unchecked-multiply scale x) (unchecked-subtract height (unchecked-multiply scale y))))]] (conj! result (cond
(conj! result (cond (color! current-color :equals black) 0
(color! current-color :equals black) 0 (color! current-color :equals painful) 2
(color! current-color :equals painful) 2 :else 1)))
:else 1))) result (partition (/ (pixmap! pm :get-height) scale) (persistent! result) )]
(partition (/ (pixmap! pm :get-height) scale) (persistent! result) ))) (.unload *asset-manager* filename)
(log/info "Finished loading collision from" filename)
result))

View File

@@ -3,7 +3,7 @@
[play-clj.ui :refer :all] [play-clj.ui :refer :all]
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all] [play-clj.g2d :refer :all]
[clojure.pprint]
[advent.pathfind] [advent.pathfind]
[advent.tween :as tween] [advent.tween :as tween]
[advent.zone :as zone] [advent.zone :as zone]

View File

@@ -3,13 +3,11 @@
[play-clj.ui :refer :all] [play-clj.ui :refer :all]
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all] [play-clj.g2d :refer :all]
[clojure.pprint]
[clojure.set :as set] [clojure.set :as set]
[advent.pathfind] [advent.pathfind]
[advent.tween :as tween] [advent.tween :as tween]
[advent.utils :as utils] [advent.utils :as utils]
[clojure.core.async :refer [put! <! <!! >! >!! chan go thread take! alts!!]] [clojure.core.async :refer [put! <! <!! >! >!! chan go thread take! alts!!]])
#_[advent.screens.scene :as scene])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter] (:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
[com.badlogic.gdx.graphics.g2d TextureRegion] [com.badlogic.gdx.graphics.g2d TextureRegion]
[com.badlogic.gdx.utils.viewport FitViewport] [com.badlogic.gdx.utils.viewport FitViewport]

View File

@@ -3,7 +3,7 @@
[play-clj.ui :refer :all] [play-clj.ui :refer :all]
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all] [play-clj.g2d :refer :all]
[clojure.pprint]
[advent.pathfind] [advent.pathfind]
[advent.zone :as zone] [advent.zone :as zone]
[advent.utils :as utils]) [advent.utils :as utils])

View File

@@ -4,7 +4,7 @@
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all] [play-clj.g2d :refer :all]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[clojure.pprint]
[advent.pathfind] [advent.pathfind]
[advent.actions :as actions] [advent.actions :as actions]
[advent.zone :as zone] [advent.zone :as zone]

View File

@@ -61,6 +61,7 @@
{:id id})) {:id id}))
entities (into {} (for [[id entity] entities] entities (into {} (for [[id entity] entities]
[id (make-entity id entity)]))] [id (make-entity id entity)]))]
(println "MAKING")
(merge params {:collision (advent.pathfind/map-from-resource collision) (merge params {:collision (advent.pathfind/map-from-resource collision)
:interactions interactions-as-list :interactions interactions-as-list
:entities entities}))) :entities entities})))

View File

@@ -266,8 +266,8 @@
puke (particle-effect "particles/puke")] puke (particle-effect "particles/puke")]
(rooms/make :music {:day :town-2 :night :night} (rooms/make :music {:day :town-2 :night :night}
:name "Tree" :name "Tree"
:sounds {:cat (utils/load-sound "cat-tree/cat.ogg") :sounds {#_#_:cat (utils/load-sound "cat-tree/cat.ogg")
:kiss (utils/load-sound "cat-tree/kiss.ogg")} #_#_:kiss (utils/load-sound "cat-tree/kiss.ogg")}
:ladder ladder-entity :ladder ladder-entity
:blank (rooms/make-entity :blank :blank (rooms/make-entity :blank
{:object nil :x 0 :y 0 :width 320 :height 240 :baseline 240 {:object nil :x 0 :y 0 :width 320 :height 240 :baseline 240

View File

@@ -225,9 +225,9 @@
:shopkeep "My son would be stricken with grief to find it missing."))))] :shopkeep "My son would be stricken with grief to find it missing."))))]
(rooms/make :music :inside-antique (rooms/make :music :inside-antique
:name "Antique shop" :name "Antique shop"
:sounds {:fire-1 (utils/load-sound "inside-antique/fire-1.ogg") :sounds {#_#_:fire-1 (utils/load-sound "inside-antique/fire-1.ogg")
:fire-2 (utils/load-sound "inside-antique/fire-2.ogg") #_#_:fire-2 (utils/load-sound "inside-antique/fire-2.ogg")
:fire-3 (utils/load-sound "inside-antique/fire-3.ogg") #_#_:fire-3 (utils/load-sound "inside-antique/fire-3.ogg")
} }
:return-portrait (rooms/make-entity :return-portrait {:box [103 70 206 116] :return-portrait (rooms/make-entity :return-portrait {:box [103 70 206 116]
:label "Desk" :label "Desk"

View File

@@ -659,7 +659,7 @@
:talk game-player-talk-up} :talk game-player-talk-up}
:get-to-work game-player-get-to-work :get-to-work game-player-get-to-work
:pause-from-work game-player-pause-from-work :pause-from-work game-player-pause-from-work
:flex-sound (utils/load-sound "inside-castle/flex.ogg") #_#_:flex-sound (utils/load-sound "inside-castle/flex.ogg")
:anim-sound-frames {game-player-stand-up {11 [:blink 0.3 1.1] } :anim-sound-frames {game-player-stand-up {11 [:blink 0.3 1.1] }
game-player-talk-up {11 [:blink 0.3 1.1] game-player-talk-up {11 [:blink 0.3 1.1]
22 [:blink 0.3 1.1] 22 [:blink 0.3 1.1]

View File

@@ -232,8 +232,8 @@
(rooms/make :music :inside-antique (rooms/make :music :inside-antique
:name "In jail" :name "In jail"
:sounds { :sounds {
:squeek (utils/load-sound "inside-jail/squeak.ogg") #_#_:squeek (utils/load-sound "inside-jail/squeak.ogg")
:crowbar-sound (utils/load-sound "ego/crowbar.ogg") #_#_:crowbar-sound (utils/load-sound "ego/crowbar.ogg")
} }
:interactions { :interactions {
:lock {:box [172 102 190 124] :lock {:box [172 102 190 124]

View File

@@ -626,7 +626,7 @@
(rooms/make :music {:day :town-2 :night :night} (rooms/make :music {:day :town-2 :night :night}
:name "Outside house" :name "Outside house"
:update-fn jump-around :update-fn jump-around
:cauldron-sound {:object nil :sound (utils/load-sound "outsidehouse/cauldron.ogg")} #_#_:cauldron-sound {:object nil :sound (utils/load-sound "outsidehouse/cauldron.ogg")}
:interactions :interactions
{:door {:box [250 100 281 160] {:door {:box [250 100 281 160]
:only-script :only-script
@@ -774,8 +774,8 @@
(actions/talk entities :ego "That's just cruel.")) (actions/talk entities :ego "That's just cruel."))
nil) nil)
:eat-sound (utils/load-sound "outsidehouse/sheep-eat.ogg") #_#_:eat-sound (utils/load-sound "outsidehouse/sheep-eat.ogg")
:bleet-sound (utils/load-sound "outsidehouse/sheep-bleet.ogg") #_#_:bleet-sound (utils/load-sound "outsidehouse/sheep-bleet.ogg")
:anim-sound-frames {sheep-stand {11 [:eat-sound 0.3] :anim-sound-frames {sheep-stand {11 [:eat-sound 0.3]
35 [:bleet-sound 0.5]}} 35 [:bleet-sound 0.5]}}
:left {:walk (utils/flip sheep-walk) :left {:walk (utils/flip sheep-walk)
@@ -794,7 +794,7 @@
:door (assoc (animation->texture screen door) :door (assoc (animation->texture screen door)
:x 252 :y 88 :baseline 122 :x 252 :y 88 :baseline 122
:open door :open door
:door-sound (utils/load-sound "door.ogg") #_#_:door-sound (utils/load-sound "door.ogg")
:anim-sound-frames {door {1 [:door-sound 0.1]}} :anim-sound-frames {door {1 [:door-sound 0.1]}}
) )
:lamb (assoc (utils/get-texture "outsidehouse/lamb.png") :lamb (assoc (utils/get-texture "outsidehouse/lamb.png")

View File

@@ -196,10 +196,10 @@
grow-explode (particle-effect "particles/grow-explode")] grow-explode (particle-effect "particles/grow-explode")]
(rooms/make :music :fight (rooms/make :music :fight
:name "Duel" :name "Duel"
:sounds {:shock (utils/load-sound "space/shock.ogg") :sounds {#_#_:shock (utils/load-sound "space/shock.ogg")
:shock-short (utils/load-sound "space/shock-short.ogg") #_#_:shock-short (utilw/load-sound "space/shock-short.ogg")
:jump (utils/load-sound "space/jump.ogg") #_#_:jump (utils/load-sound "space/jump.ogg")
:swing-sword (utils/load-sound "space/swingsword.ogg")} #_#_:swing-sword (utils/load-sound "space/swingsword.ogg")}
:interactions :interactions
{} {}
:layers [(assoc (utils/get-texture "space/background.png") :x 0 :y 0 :baseline 0)] :layers [(assoc (utils/get-texture "space/background.png") :x 0 :y 0 :baseline 0)]
@@ -235,9 +235,9 @@
:bloodclot (assoc (animation->texture screen blergh-stand-anim) :bloodclot (assoc (animation->texture screen blergh-stand-anim)
:x 180 :y 50 :baseline 190 :x 180 :y 50 :baseline 190
:stand blergh-stand-anim :stand blergh-stand-anim
:inhale-sound (utils/load-sound "space/bloodclot-inhale.ogg") #_#_:inhale-sound (utils/load-sound "space/bloodclot-inhale.ogg")
:exhale-sound (utils/load-sound "space/bloodclot-exhale.ogg") #_#_ :exhale-sound (utils/load-sound "space/bloodclot-exhale.ogg")
:explode-sound (utils/load-sound "space/bloodclot-explode.ogg") #_#_ :explode-sound (utils/load-sound "space/bloodclot-explode.ogg")
:anim-sound-frames {blergh-stand-anim {0 [:inhale-sound grunt-vol] :anim-sound-frames {blergh-stand-anim {0 [:inhale-sound grunt-vol]
1 [:exhale-sound grunt-vol]} 1 [:exhale-sound grunt-vol]}
bloodclot-explode {35 [:grow-sound (constantly 0.5)] bloodclot-explode {35 [:grow-sound (constantly 0.5)]

View File

@@ -3,7 +3,7 @@
[play-clj.ui :refer :all] [play-clj.ui :refer :all]
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all] [play-clj.g2d :refer :all]
[clojure.pprint]
[advent.pathfind] [advent.pathfind]
[advent.zone :as zone] [advent.zone :as zone]
[advent.utils :as utils]) [advent.utils :as utils])

View File

@@ -7,7 +7,7 @@
[play-clj.entities :as entities] [play-clj.entities :as entities]
[play-clj.g2d :refer :all] [play-clj.g2d :refer :all]
[clojure.zip :as zip] [clojure.zip :as zip]
[clojure.pprint]
[clojure.java.io :as io] [clojure.java.io :as io]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[advent.pathfind] [advent.pathfind]
@@ -41,7 +41,7 @@
[advent.screens.dialogue :refer [talking-screen toast-screen tooltip-screen]] [advent.screens.dialogue :refer [talking-screen toast-screen tooltip-screen]]
[advent.screens.inventory :refer [inventory-screen]] [advent.screens.inventory :refer [inventory-screen]]
[clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!! poll! dropping-buffer]]) [clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!! dropping-buffer]])
(:import [com.badlogic.gdx.graphics Pixmap$Format Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30] (:import [com.badlogic.gdx.graphics Pixmap$Format Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
[com.badlogic.gdx.graphics.g2d TextureRegion Animation Batch] [com.badlogic.gdx.graphics.g2d TextureRegion Animation Batch]
[com.badlogic.gdx.math Vector3 Matrix4] [com.badlogic.gdx.math Vector3 Matrix4]
@@ -53,8 +53,7 @@
[java.lang Object] [java.lang Object]
[com.badlogic.gdx Gdx] [com.badlogic.gdx Gdx]
[com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera [com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera
PerspectiveCamera Pixmap Pixmap$Format PixmapIO Texture PerspectiveCamera Pixmap Pixmap$Format PixmapIO Texture ]
VertexAttributes$Usage]
[com.badlogic.gdx.scenes.scene2d Actor Stage])) [com.badlogic.gdx.scenes.scene2d Actor Stage]))
#_(set! *unchecked-math* :warn-on-boxed) #_(set! *unchecked-math* :warn-on-boxed)
@@ -655,28 +654,28 @@
:origin-x 9 :origin-x 9
:origin-y 0 :origin-y 0
:scaled true :scaled true
:drop-sound (utils/load-sound "ego/drop.ogg") #_#_:drop-sound (utils/load-sound "ego/drop.ogg")
:milk-sound (utils/load-sound "outsidehouse/milk.ogg") #_#_:milk-sound (utils/load-sound "outsidehouse/milk.ogg")
:step-sound-1 (utils/load-sound "ego/step-1.ogg") #_#_:step-sound-1 (utils/load-sound "ego/step-1.ogg")
:step-sound-2 (utils/load-sound "ego/step-2.ogg") #_#_:step-sound-2 (utils/load-sound "ego/step-2.ogg")
:step-sound-3 (utils/load-sound "ego/step-3.ogg") #_#_:step-sound-3 (utils/load-sound "ego/step-3.ogg")
:step-sound-4 (utils/load-sound "ego/step-4.ogg") #_#_:step-sound-4 (utils/load-sound "ego/step-4.ogg")
:shoot-sound (utils/load-sound "ego/slingshot.ogg") #_#_:shoot-sound (utils/load-sound "ego/slingshot.ogg")
:glad-sound (utils/load-sound "ego/glad.ogg") #_#_:glad-sound (utils/load-sound "ego/glad.ogg")
:get-sick-sound (utils/load-sound "ego/get-sick.ogg") #_#_:get-sick-sound (utils/load-sound "ego/get-sick.ogg")
:scratch-sound (utils/load-sound "ego/scratch.ogg") #_#_:scratch-sound (utils/load-sound "ego/scratch.ogg")
:scared-step-sound (utils/load-sound "ego/scared-step.ogg") #_#_:scared-step-sound (utils/load-sound "ego/scared-step.ogg")
:inside-step-sound-1 (utils/load-sound "ego/inside-step-1.ogg") #_#_:inside-step-sound-1 (utils/load-sound "ego/inside-step-1.ogg")
:inside-step-sound-2 (utils/load-sound "ego/inside-step-2.ogg") #_#_:inside-step-sound-2 (utils/load-sound "ego/inside-step-2.ogg")
:inside-step-sound-3 (utils/load-sound "ego/inside-step-3.ogg") #_#_:inside-step-sound-3 (utils/load-sound "ego/inside-step-3.ogg")
:inside-step-sound-4 (utils/load-sound "ego/inside-step-4.ogg") #_#_:inside-step-sound-4 (utils/load-sound "ego/inside-step-4.ogg")
:crowbar-sound (utils/load-sound "ego/crowbar.ogg") #_#_:crowbar-sound (utils/load-sound "ego/crowbar.ogg")
:sigh-sound (utils/load-sound "ego/sigh.ogg") #_#_:sigh-sound (utils/load-sound "ego/sigh.ogg")
:axe-sound (utils/load-sound "ego/axe.ogg") #_#_:axe-sound (utils/load-sound "ego/axe.ogg")
:breakglass-sound (utils/load-sound "ego/breakglass.ogg") #_#_:breakglass-sound (utils/load-sound "ego/breakglass.ogg")
:idea-sound (utils/load-sound "ego/idea.ogg") #_#_:idea-sound (utils/load-sound "ego/idea.ogg")
:scale-x start-scale :scale-x start-scale
:scale-y start-scale :scale-y start-scale
:talk-color (color 0.6 1.0 1.0 1.0) :talk-color (color 0.6 1.0 1.0 1.0)
@@ -774,7 +773,7 @@
(let [{{:keys [script-running? script-chan]} key} entities] (let [{{:keys [script-running? script-chan]} key} entities]
(if script-running? (if script-running?
entities entities
(let [next-script (poll! script-chan)] (let [next-script (<! script-chan)]
(if next-script (if next-script
(do (do
(next-script entities) (next-script entities)
@@ -796,7 +795,7 @@
(update-in terminated [key] assoc :current nil :started? false) (update-in terminated [key] assoc :current nil :started? false)
key)) key))
(assoc-in entities [key :started?] true))) (assoc-in entities [key :started?] true)))
(let [current (poll! channel)] (let [current (<! channel)]
(-> entities (-> entities
(assoc-in [key :started?] false) (assoc-in [key :started?] false)
@@ -1089,6 +1088,7 @@
has-start-pos? (:x state) has-start-pos? (:x state)
_ (update! screen :shader shader) _ (update! screen :shader shader)
log-assets (fn [r] r)
rooms {:inside-house (rooms.inside-house/make screen) rooms {:inside-house (rooms.inside-house/make screen)
:inside-stash (rooms.inside-stash/make screen) :inside-stash (rooms.inside-stash/make screen)
:outside-house (rooms.outside-house/make screen) :outside-house (rooms.outside-house/make screen)
@@ -1123,14 +1123,14 @@
:inside-antique (utils/make-music "music/inside-antique.ogg") :inside-antique (utils/make-music "music/inside-antique.ogg")
:town-1 (utils/make-music "music/town-music-1.ogg") :town-1 (utils/make-music "music/town-music-1.ogg")
:town-2 (utils/make-music "music/town-music-2.ogg") :town-2 (utils/make-music "music/town-music-2.ogg")
:love (utils/make-music "music/love.ogg") #_#_:love (utils/make-music "music/love.ogg")
:inside-fangald (utils/make-music "music/inside-fangald.ogg") #_#_:inside-fangald (utils/make-music "music/inside-fangald.ogg")
:fight (utils/make-music "music/megaboss.mp3") #_#_:fight (utils/make-music "music/megaboss.mp3")
:pull-sword (utils/make-music "music/pull-sword.ogg") #_#_:pull-sword (utils/make-music "music/pull-sword.ogg")
:night (utils/make-music "music/night.ogg") #_#_:night (utils/make-music "music/night.ogg")
:dream (utils/make-music "dream/music.ogg") #_#_:dream (utils/make-music "dream/music.ogg")
:secret-hideout (utils/make-music "music/secret-hideout.ogg") #_#_:secret-hideout (utils/make-music "music/secret-hideout.ogg")
:wind (utils/make-music "music/wind.ogg")} #_#_:wind (utils/make-music "music/wind.ogg")}
:state state :state state
:time-profiles {:object nil :time-profiles {:object nil
:default utils/default-night-merge :default utils/default-night-merge
@@ -1139,10 +1139,10 @@
:closing? {:object nil :closing? {:object nil
:value false} :value false}
:sounds {:blink (utils/load-sound "ego/blink2.ogg") :sounds {#_#_:blink (utils/load-sound "ego/blink2.ogg")
:pickup (utils/load-sound "pickup.ogg") #_#_:pickup (utils/load-sound "pickup.ogg")
:disappear (utils/load-sound "inside-house/disappear.ogg") #_#_:disappear (utils/load-sound "inside-house/disappear.ogg")
:grow-sound (utils/load-sound "ego/potion.ogg") #_#_:grow-sound (utils/load-sound "ego/potion.ogg")
:object nil} :object nil}
:fade {:object nil :fade {:object nil
:opacity 0.0} :opacity 0.0}
@@ -1189,6 +1189,8 @@
(if has-start-pos? (if has-start-pos?
start-pos start-pos
(:start-pos room))))))}] (:start-pos room))))))}]
(log/info "assets so far", (.getDiagnostics *asset-manager*) )
(doseq [[k [start time fn]] (get-in entities [:room :timers])] (doseq [[k [start time fn]] (get-in entities [:room :timers])]
(add-timer! screen k start time)) (add-timer! screen k start time))
@@ -1268,7 +1270,7 @@
:on-render :on-render
(fn [{:keys [^OrthographicCamera camera ^FitViewport viewport ^Stage renderer] :as screen} {{:keys [last-pos ] [cursor-offset-x cursor-offset-y] :offset} :cursor :keys [tweens] :as entities} options] (fn [{:keys [^OrthographicCamera camera ^FitViewport viewport ^Stage renderer] :as screen} {{:keys [last-pos ] [cursor-offset-x cursor-offset-y] :offset} :cursor :keys [tweens] :as entities} options]
(steam/update) #_(steam/update)
(.apply viewport) (.apply viewport)
(if (get-in entities [:closing? :value]) (if (get-in entities [:closing? :value])

View File

@@ -87,6 +87,10 @@
{:can-skip false {:can-skip false
:do (fn [screen entities] :do (fn [screen entities]
(utils/stop-music (:pop-music entities)) (utils/stop-music (:pop-music entities))
(log/info "clearing assets" (into [] (.getAssetNames *asset-manager*)) (.getDiagnostics *asset-manager*))
(.clear *asset-manager* )
(log/info "cleared assets" (into [] (.getAssetNames *asset-manager*)) (.getDiagnostics *asset-manager*))
(set-screen! @(resolve 'advent.core/advent) title/title-screen) (set-screen! @(resolve 'advent.core/advent) title/title-screen)
entities) entities)
:duration 0.0}]) :duration 0.0}])
@@ -102,7 +106,7 @@
(graphics! :set-cursor (utils/cursor "cursor.png" :hourglass)) (graphics! :set-cursor (utils/cursor "cursor.png" :hourglass))
(let [screen (assoc screen :total-time 0) (let [screen (assoc screen :total-time 0)
pop-anim (make-anim-seq "POPPixelLogo_02" [320 240] 0.05 (range 200)) #_#_pop-anim (make-anim-seq "POPPixelLogo_02" [320 240] 0.05 (range 200))
entities {:background (assoc (utils/get-texture "black.png") entities {:background (assoc (utils/get-texture "black.png")
:scale-x 80 :scale-x 80
:scale-y 80 :scale-y 80
@@ -110,8 +114,7 @@
:origin-x 0 :origin-x 0
:origin-y 0 :origin-y 0
:z 0) :z 0)
:pop-logo (assoc (animation->texture screen pop-anim) :pop-logo (assoc (utils/get-texture "black.png")
:main-anim pop-anim
:x 0 :y 0 :x 0 :y 0
:origin-x 0 :origin-y 0 :origin-x 0 :origin-y 0
:scale-x 4 :scale-y 4 :scale-x 4 :scale-y 4
@@ -126,11 +129,11 @@
:on-render :on-render
(fn [{:keys [^FitViewport viewport] :as screen} entities options] (fn [{:keys [^FitViewport viewport] :as screen} entities options]
(steam/update) #_(steam/update)
(.apply viewport) (.apply viewport)
(clear!) (clear!)
(let [entities (utils/apply-tweens screen entities (:tweens entities)) (let [entities (utils/apply-tweens screen entities (:tweens entities))
entities (update-in entities [:pop-logo] animate screen) #_#_entities (update-in entities [:pop-logo] animate screen)
entities (if (and (:queued-skip? entities) (get-in entities [:current-step :can-skip])) entities (if (and (:queued-skip? entities) (get-in entities [:current-step :can-skip]))
(assoc entities :queued-skip? false :current-step nil) (assoc entities :queued-skip? false :current-step nil)
entities) entities)

View File

@@ -445,7 +445,7 @@
:on-render :on-render
(fn [{:keys [^FitViewport viewport] :as screen} entities options] (fn [{:keys [^FitViewport viewport] :as screen} entities options]
(steam/update) #_(steam/update)
(.apply viewport) (.apply viewport)
(clear!) (clear!)
(let [entities (utils/apply-tweens screen entities (:tweens entities)) (let [entities (utils/apply-tweens screen entities (:tweens entities))

View File

@@ -1,151 +1,56 @@
(ns advent.steam (ns advent.steam
(:require [play-clj.core :refer :all] (:require [play-clj.core :refer :all])
[clojure.edn :as edn] (:import [com.badlogic.gdx.graphics Pixmap PixmapIO$PNG]
[clojure.tools.logging :as log] [com.badlogic.gdx.files FileHandle]))
)
(:import [java.nio ByteBuffer CharBuffer]
[java.io ByteArrayOutputStream]
[com.badlogic.gdx.graphics Pixmap PixmapIO$PNG]
[com.badlogic.gdx.files FileHandle]
))
(def has-steam? (def has-steam?
(try false
(import '[com.codedisaster.steamworks SteamUserStats SteamUserStatsCallback SteamAPI SteamRemoteStorage]) )
true
(catch Exception e
false)))
(def is-app-store? (System/getProperty "app-store"))
(defmacro steamify [steam-version & [regular-version]]
(if has-steam?
`(if (and has-steam? (not (System/getProperty "no-steam")))
~steam-version
~regular-version)
regular-version))
(defn init []
(steamify
(if (SteamAPI/init)
(log/info "Steam initialized")
(do
(log/info "Steam not initialized")
(def has-steam? false)))))
(defn update []
(steamify
(when (SteamAPI/isSteamRunning)
(SteamAPI/runCallbacks))))
(if has-steam?
(eval
'(do
(defn achievement-fn [f achievement]
(steamify
(let [stats (atom nil)]
(log/info "Getting stats...")
(reset! stats (SteamUserStats. (reify SteamUserStatsCallback
(onUserStatsReceived [_ _ _ _]
(f @stats achievement)
)
(onUserStatsStored [_ _ _])
(onUserAchievementStored [_ _ _ _ _ _]))))
(.requestCurrentStats @stats))))
(def set-achievement (partial achievement-fn
(fn [^SteamUserStats stats ^String achievement]
(log/info "Setting achievement" achievement)
(.setAchievement stats achievement)
(.storeStats stats)
(log/info "Done setting achievement" achievement))))
(def clear-achievement (partial achievement-fn
(fn [^SteamUserStats stats ^String achievement]
(log/info "Clearing achievement" achievement)
(.clearAchievement stats achievement)
(.storeStats stats)
(log/info "Done clearing achievement" achievement)))))
)
(do
(defn set-achievement [achievement])
(defn clear-achievement [achievement])))
(def is-app-store? false)
(def all-achievements ["PARDON" "EX_CON" "PRO_WRESTLER" "SHEEP_HORDER" "SAFE_AND_SOUND" "DESTINY" "WISE_UP" "BLOODCLOT" "KITTY_KISS"]) (def all-achievements ["PARDON" "EX_CON" "PRO_WRESTLER" "SHEEP_HORDER" "SAFE_AND_SOUND" "DESTINY" "WISE_UP" "BLOODCLOT" "KITTY_KISS"])
(defn clear-achievement [])
(defn set-achievement [x])
(defn clear-all-achievements [] (defn clear-all-achievements []
(doall (map clear-achievement all-achievements))) (doall (map clear-achievement all-achievements)))
(defn get-bytes [filename] (defn get-bytes [filename]
(steamify (.readBytes (if is-app-store?
(let [rs (SteamRemoteStorage. nil) (files! :external filename)
len (.getFileSize rs filename) (files! :local filename))))
bb (ByteBuffer/allocateDirect len)
bytes (make-array Byte/TYPE len)]
(.fileRead rs filename bb len)
(.get bb bytes)
bytes)
(.readBytes (if is-app-store?
(files! :external filename)
(files! :local filename)))))
(defn write-bytes [filename bytes] (defn write-bytes [filename bytes]
(steamify (let [f (if is-app-store?
(let [rs (SteamRemoteStorage. nil) (files! :external filename)
bb (ByteBuffer/allocateDirect (* 2 (count bytes)))] (files! :local filename))]
(-> bb (.put bytes) ) (.writeBytes f bytes false)))
(.fileWrite rs filename bb (* 2 (count bytes))))
(let [f (if is-app-store?
(files! :external filename)
(files! :local filename))]
(.writeBytes f bytes false))))
(defn list-edn-files [] (defn list-edn-files []
(steamify (if is-app-store?
(let [rs (SteamRemoteStorage. nil)] (for [save-file (.list (files! :external "saves/") ".edn")]
(for [i (range (.getFileCount rs)) (str "saves/" (.name ^FileHandle save-file)))
:let [n (.getFileNameAndSize rs i (make-array Integer/TYPE 1))] (for [save-file (.list (files! :local "saves/") ".edn")]
:when (.endsWith n ".edn")] (str "saves/" (.name ^FileHandle save-file)))))
n))
(if is-app-store?
(for [save-file (.list (files! :external "saves/") ".edn")]
(str "saves/" (.name ^FileHandle save-file)))
(for [save-file (.list (files! :local "saves/") ".edn")]
(str "saves/" (.name ^FileHandle save-file))))))
(defn save-screenshot [^Pixmap pm ^String filename] (defn save-screenshot [^Pixmap pm ^String filename]
(steamify (let [f (if is-app-store?
(let [rs (SteamRemoteStorage. nil) (files! :external filename)
png (PixmapIO$PNG. (* (.getWidth pm) (.getHeight pm) 1.5)) (files! :local filename))
baos (ByteArrayOutputStream. (* (.getWidth pm) (.getHeight pm) 1.5)) png (PixmapIO$PNG. (* (.getWidth pm) (.getHeight pm) 1.5))]
_ (.write png baos pm)
bytes (.toByteArray baos)
bb (ByteBuffer/allocateDirect (count bytes))]
(.put bb bytes)
(.fileWrite rs filename bb (count bytes)))
(let [f (if is-app-store? (.write png f pm)
(files! :external filename) (.dispose png)))
(files! :local filename))
png (PixmapIO$PNG. (* (.getWidth pm) (.getHeight pm) 1.5))]
(.write png f pm)
(.dispose png))))
(defn delete-file [filename] (defn delete-file [filename]
(steamify (.delete (if is-app-store?
(.fileDelete (SteamRemoteStorage. nil) filename) (files! :external filename)
(.delete (if is-app-store? (files! :local filename))))
(files! :external filename)
(files! :local filename)))))
(defn save-screenshot-file-name [name] (defn save-screenshot-file-name [name]
(steamify (str "saves/screenshot-" (clojure.core/name name) ".png" ))
(str "screenshot-" (clojure.core/name name) ".png" )
(str "saves/screenshot-" (clojure.core/name name) ".png" )))
(defn save-file-name [id] (defn save-file-name [id]
(steamify (str "saves/" id ".edn"))
(str id ".edn")
(str "saves/" id ".edn")))

View File

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

View File

@@ -1,7 +1,7 @@
(ns advent.analyze (ns advent.analyze
(:require [slam.hound.asplode :as a] (:require [slam.hound.asplode :as a]
[clojure.java.io :as io] [clojure.java.io :as io]
[clojure.pprint :as pprint]
[clojure.data.csv :as csv] [clojure.data.csv :as csv]
)) ))

View File

@@ -2,19 +2,22 @@
:description "FIXME: write description" :description "FIXME: write description"
:dependencies [[com.badlogicgames.gdx/gdx "1.9.4"] :dependencies [[com.badlogicgames.gdx/gdx "1.9.4"]
[com.badlogicgames.gdx/gdx-backend-robovm "1.9.4"] [com.badlogicgames.gdx/gdx-backend-robovm "1.9.4"]
[org.clojure/data.priority-map "0.0.5"] #_[org.clojure/core.async "0.2.385"]
[org.clojure/core.async "0.2.385"] [org.clojure/core.async "0.1.346.0-17112a-alpha" :exclusions [org.clojure/clojure]]
[org.clojars.notid/tools.logging "0.3.2-SNAPSHOT"] [org.clojars.notid/tools.logging "0.3.2-SNAPSHOT"]
[log4j/log4j "1.2.16"] [log4j/log4j "1.2.16"]
[org.clojure/clojure "1.8.0"] [org.skummet/clojure "1.7.0-r2"]
[com.mobidevelop.robovm/robovm-cocoatouch "2.3.0"] [com.mobidevelop.robovm/robovm-cocoatouch "2.3.0"]
[com.mobidevelop.robovm/robovm-rt "2.3.0"] [com.mobidevelop.robovm/robovm-rt "2.3.0"]
[play-clj "0.4.6-BRYCE"]] [play-clj "0.4.6-BRYCE" :exclusions [com.badlogicgames.gdx/gdx-box2d com.badlogicgames.gdx/gdx-bullet]]]
:exclusions [[org.clojure/clojure]]
:source-paths ["src/clojure" "../desktop/src-common"] :source-paths ["src/clojure" "../desktop/src-common"]
:java-source-paths ["src/java"] :java-source-paths ["src/java"]
:plugins [[lein-fruit "0.2.4-SNAPSHOT"]] :plugins [[lein-fruit "0.2.4-SNAPSHOT"]
[org.skummet/lein-skummet "0.2.2"]
]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"] :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:jvm-opts ["-Dno-steam=true"] :jvm-opts ["-Dno-steam=true" "-Dclojure.compiler.direct-linking=true" ]
:ios {:robovm-opts ["-config" "robovm.xml"] :ios {:robovm-opts ["-config" "robovm.xml"]
:robovm-path "/Users/brycecovert/.robovm-sdks/robovm-2.2.1-SNAPSHOT" :robovm-path "/Users/brycecovert/.robovm-sdks/robovm-2.2.1-SNAPSHOT"
:version 2.1} :version 2.1}

View File

@@ -25,10 +25,17 @@
</resource> </resource>
</resources> </resources>
<forceLinkClasses> <forceLinkClasses>
<pattern>clojure.tools.logging.**</pattern>
<pattern>advent.**</pattern> <pattern>advent.**</pattern>
<pattern>clojure.**</pattern> <pattern>clojure.core*</pattern>
<pattern>com.badlogic.**</pattern> <pattern>clojure.**</pattern> <!-- change this to optimize -->
<pattern>clojure.core.**</pattern>
<pattern>clojure.tools.**</pattern>
<pattern>clojure.data.**</pattern>
<pattern>clojure.java.io*</pattern>
<pattern>play_clj.**</pattern> <pattern>play_clj.**</pattern>
<pattern>clojure.*</pattern>
<pattern>com.badlogic.**</pattern>
<pattern>java.util.logging.**</pattern> <pattern>java.util.logging.**</pattern>
</forceLinkClasses> </forceLinkClasses>
<libs> <libs>

View File

@@ -7,7 +7,7 @@ import com.badlogic.gdx.*;
import com.badlogic.gdx.backends.iosrobovm.*; import com.badlogic.gdx.backends.iosrobovm.*;
import org.robovm.apple.foundation.*; import org.robovm.apple.foundation.*;
import org.robovm.apple.uikit.*; import org.robovm.apple.uikit.UIApplication;
import org.robovm.apple.glkit.GLKViewDrawableColorFormat; import org.robovm.apple.glkit.GLKViewDrawableColorFormat;
import org.robovm.apple.glkit.GLKViewDrawableDepthFormat; import org.robovm.apple.glkit.GLKViewDrawableDepthFormat;

View File

@@ -1,39 +0,0 @@
package advent.core;
import org.robovm.apple.uikit.*;
import org.robovm.apple.coregraphics.*;
import org.robovm.apple.foundation.*;
import com.badlogic.gdx.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.backends.iosrobovm.*;
public class Saver {
public static Pixmap flipPixmap(Pixmap src) {
final int width = src.getWidth();
final int height = src.getHeight();
Pixmap flipped = new Pixmap(width, height, src.getFormat());
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
flipped.drawPixel(x, y, src.getPixel(x, height - y -1));
}
}
return flipped;
}
public static UIImage takeScreenshot(){
UIImage newImage;
//((IOSApplication) Gdx.app).getUIViewController().getView().setTransform(CGAffineTransform.createScale(1, -1));
UIView view = ((IOSApplication) Gdx.app).getUIViewController().getView();
UIGraphics.beginImageContext(new CGSize(view.getFrame().getWidth(), view.getFrame().getHeight()), true, 0.0);
view.drawViewHierarchy(
new CGRect(0, 0, view.getFrame().getWidth(), view.getFrame().getHeight()), true);
newImage = UIGraphics.getImageFromCurrentImageContext();
UIGraphics.endImageContext();
//((IOSApplication) Gdx.app).getUIViewController().getView().setTransform(CGAffineTransform.createScale(1, 1));
return newImage;
}
}