more updates.

This commit is contained in:
Bryce Covert
2016-08-15 07:56:39 -07:00
parent d1106b5903
commit 2a0d6bcb28
25 changed files with 579 additions and 298 deletions

View File

@@ -176,6 +176,18 @@ void main ()
")
;
(defn ensure-on-screen [l]
(let [margin-width (* 0.05 320)
minimum-x margin-width
maximum-x (- 320 margin-width)
label-width (label! l :get-width)
label-right (+ (:x l) (/ label-width 2))
_ (println label-right)
l (cond (> label-right maximum-x) (assoc l :x (- maximum-x label-width))
(< (:x l) minimum-x) (assoc l :x minimum-x)
:else l)]
l))
(defn get-script-selector [entities]
(or (get-selected-inventory-item) :main))
@@ -909,7 +921,8 @@ void main ()
depressed?)))
(update-in entities [:cursor ] assoc
:last [new-current depressed?]
:time-changed total-time)))))
:time-changed total-time
:offset (utils/+cursor-hotspots+ (or (:cursor new-current) new-current) [0 0]))))))
(defn get-looped-animation-point ^double [^Animation animation ^double total-time]
@@ -1234,12 +1247,13 @@ void main ()
:music-override {:object nil
:value nil}
:label (utils/add-actor-to-stage screen
(assoc (label "Sheep" style :set-alignment Align/left)
(assoc (label "Sheep" style :set-alignment Align/center)
:x 0 :y 0 :baseline 10000))
:cursor {:id "cursor"
:last nil
:override :hourglass
:last-pos [0 0]
:offset [0 0 ]
:down-target nil}
:all-items (assoc items/items :object nil)
@@ -1278,7 +1292,7 @@ void main ()
nil)
:on-render
(fn [{:keys [^OrthographicCamera camera ^FitViewport viewport ^Stage renderer] :as screen} {{:keys [last-pos]} :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)
(.apply viewport)
@@ -1320,9 +1334,13 @@ void main ()
last-pos-x (double last-pos-x)
last-pos-y (double last-pos-y)
entities (update-in entities [:label] assoc
:x (unchecked-add last-pos-x 20.0)
:y (unchecked-subtract last-pos-y 12 ))
entities (-> entities
(update-in [:label] assoc
:x (unchecked-subtract last-pos-x
cursor-offset-x)
:y (unchecked-add (unchecked-subtract last-pos-y 24 )
cursor-offset-y))
(update-in [:label] ensure-on-screen))
entities (if (and (@utils/settings :camera-man? true)