more perf enhancements, getting ready for multi save slots.

This commit is contained in:
Bryce Covert
2015-09-16 13:29:39 -07:00
parent 3de4943f67
commit 260d411336
11 changed files with 35 additions and 29 deletions

View File

@@ -45,7 +45,7 @@
:assets-paths ["/Users/brycecovert/dev/advent/desktop/resources"]
:native-libraries-paths ["libs"]
:target-version "15"
:target-version "15" ; 18+
:aot-exclude-ns ["clojure.parallel" "clojure.core.reducers"
"cider.nrepl" "cider-nrepl.plugin"
"cider.nrepl.middleware.util.java.parser"

View File

@@ -3,15 +3,7 @@
:dependencies [[com.badlogicgames.gdx/gdx "1.5.3"]
[com.badlogicgames.gdx/gdx-backend-lwjgl "1.5.3"]
[com.badlogicgames.gdx/gdx-box2d "1.5.3"]
[com.badlogicgames.gdx/gdx-tools "1.5.3"]
[com.badlogicgames.gdx/gdx-box2d-platform "1.5.3"
:classifier "natives-desktop"]
[com.badlogicgames.gdx/gdx-bullet "1.5.3"]
[com.badlogicgames.gdx/gdx-bullet-platform "1.5.3"
:classifier "natives-desktop"]
[com.badlogicgames.gdx/gdx-platform "1.5.3"
:classifier "natives-desktop"]
[com.badlogicgames.gdx/gdx-platform "1.5.3" :classifier "natives-desktop"]
[org.clojure/clojure "1.6.0"]
[org.clojure/tools.nrepl "0.2.7"]
[play-clj "0.4.5-BRYCE"]
@@ -23,6 +15,7 @@
:aliases {"pack" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "asset-work/" "resources/packed/"]}
:profiles {
:dev {
:dependencies [[com.badlogicgames.gdx/gdx-tools "1.5.3"]]
:warn-on-reflection true}
}
:aot [advent.core.desktop-launcher]

View File

@@ -337,7 +337,8 @@
:ego "What's this?")
(actions/give entities :kiss)
(actions/do-dialogue entities :ego "A kiss for an inventory item?"
:ego "Sounds like the game designer was running out of good ideas."))
:ego "Sounds like the game designer was running out of good ideas.")
(utils/snapshot-state @entities "The Cat Whisperer"))
(actions/talk entities :ego "I guess I'm too far away.")))
:default (actions/get-script entities (actions/talk entities :ego "Kitty seems disinterested in it."))})
cat-stand)

View File

@@ -240,6 +240,7 @@
:fairy-godfather "Choose the broom or shovel, and cast it into the pit of fate."
:ego "But..."
:fairy-godfather "No buts.")
(utils/snapshot-state @entities "Our tale's beginning")
(actions/update-state entities #(assoc % :seen-intro? true)))
(defn swing [entities]

View File

@@ -80,7 +80,8 @@
:warriors "Congratulations young master. Thou art worthy in might."
:warriors "Take thy servant's medal of strength.")
(actions/give entities :medal)
(actions/glad entities))
(actions/glad entities)
(utils/snapshot-state @entities "Pro (arm) Wrestler"))
(do
(play-battle entities :lose)
(actions/do-dialogue entities

View File

@@ -575,7 +575,8 @@
(actions/give entities :trophy)
(actions/remove-entity entities :trophy)
(actions/glad entities)
(actions/talk entities :ego "Thanks!"))
(actions/talk entities :ego "Thanks!")
(utils/snapshot-state @entities "The Wise Guy"))
(actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking."))
(brian-get-to-work entities))
:trophy (actions/get-script entities

View File

@@ -191,10 +191,12 @@
(actions/talk entities :ego "I probably shouldn't leave without my belongings.")
(do (actions/transition-background entities :outside-jail [50 46] :face :right)
(if (get-in @entities [:state :dropped-ball?])
(actions/do-dialogue entities :ego "Yes I made it!"
:ego "But what now?"
:ego "I have till sunrise before Bloodclot comes and destroys the town."
:ego "Maybe Gandarf can help me!")
(do
(actions/do-dialogue entities :ego "Yes I made it!"
:ego "But what now?"
:ego "I have till sunrise before Bloodclot comes and destroys the town."
:ego "Maybe Gandarf can help me!")
(utils/snapshot-state @entities "Prisoner On The Loose"))
(do
(actions/do-dialogue entities :ego "Yes I made it!"
:guard "Hmm?"

View File

@@ -269,7 +269,8 @@
:bloodclot-head "Starting with his precious Georgia McGorgeous.")
(bloodclot-disappear entities)
(common/go-to-jail entities 5.0)
(actions/do-dialogue entities :ego "Hey!" :ego "What's going on? I was just about to teach Bloodclot a lesson!"))))
(actions/do-dialogue entities :ego "Hey!" :ego "What's going on? I was just about to teach Bloodclot a lesson!")
(utils/snapshot-state @entities "In The Slammer"))))
:magic-slingshot (actions/get-script entities
(actions/do-dialogue entities
:ego "Hey Bloodclot!"

View File

@@ -55,21 +55,29 @@
atlas (texture-atlas "packed/pack.atlas")]
(texture (texture-atlas! atlas :find-region atlas-name))))
(defn save [entities]
(defn snapshot-state [entities name]
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
(.putString "save-1" (pr-str (entities :state)))
(.putString name (pr-str (entities :state)))
.flush))
(defn save [entities]
(snapshot-state entities "Autosave"))
(defn has-save? []
(-> (.getPreferences (Gdx/app) "ticks-tales-saves")
(.contains "save-1")))
(.contains "Autosave")))
(defn load []
(defn load-snapshot [name]
(-> (.getPreferences (Gdx/app) "ticks-tales-saves")
(.getString "save-1")
(.getString name)
edn/read-string
(assoc :active? true)))
(defn load []
(load-snapshot "Autosave"))
(defn save-settings [entities]
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
(.putString "settings" (pr-str @settings))

View File

@@ -1,12 +1,12 @@
(ns advent.core.desktop-launcher
(:require [advent.core :refer :all]
[clojure.tools.nrepl.server])
#_[clojure.tools.nrepl.server])
(:import [com.badlogic.gdx.backends.lwjgl LwjglApplication LwjglApplicationConfiguration]
[org.lwjgl.input Keyboard]
[com.badlogic.gdx Gdx])
(:gen-class))
(defmacro start-nrepl-expr [port]
#_(defmacro start-nrepl-expr [port]
`(let [{port# :port} (clojure.tools.nrepl.server/start-server :port ~port)]
(doseq [port-file# ["target/repl-port" ".nrepl-port"]]
(-> port-file#
@@ -19,7 +19,7 @@
(defn -main
[& [port]]
(try
#_(try
(when port (start-nrepl-expr (Integer/parseInt port)))
(catch Exception e))
(let [cfg (LwjglApplicationConfiguration.)]

View File

@@ -2,8 +2,6 @@
:description "FIXME: write description"
:dependencies [[com.badlogicgames.gdx/gdx "1.5.3"]
[com.badlogicgames.gdx/gdx-backend-robovm "1.5.3"]
[com.badlogicgames.gdx/gdx-box2d "1.5.3"]
[com.badlogicgames.gdx/gdx-bullet "1.5.3"]
[org.clojure/data.priority-map "0.0.5"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[org.clojure/clojure "1.6.0"]
@@ -16,7 +14,7 @@
:plugins [[lein-fruit "0.2.4-SNAPSHOT"]]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:ios {:robovm-opts ["-forcelinkclasses" "advent.**:clojure.**:com.badlogic.**:play_clj.**"
"-libs" "libs/libObjectAL.a:libs/libgdx.a:libs/libgdx-box2d.a:libs/libgdx-bullet.a"
"-libs" "libs/libObjectAL.a:libs/libgdx.a"
"-frameworks" "UIKit:OpenGLES:QuartzCore:CoreGraphics:OpenAL:AudioToolbox:AVFoundation"
"-resources" "../desktop/resources/**"
]