working on ending, fullscreen issues.

This commit is contained in:
Bryce Covert
2015-09-02 15:59:51 -07:00
parent 1be059e43e
commit 695dd9587e
7 changed files with 81 additions and 16 deletions

View File

@@ -57,5 +57,4 @@ AUDIO
+ step backwards creep + step backwards creep
+ snore + snore
+ shoot slinger's + shoot slinger's
+ new music for night + new music for night

View File

@@ -1 +1 @@
{:sound-volume 82.0, :music-volume 86.0} {:sound-volume 69.0, :music-volume 86.0}

View File

@@ -23,7 +23,8 @@
(defgame advent (defgame advent
:on-create :on-create
(fn [this] (fn [this]
(set-screen! this title/title-screen))) (Thread/sleep 1000)
(on-gl (set-screen! this title/title-screen))))
(defn reload [] (defn reload []

View File

@@ -22,15 +22,19 @@
peddler-sheet (texture! (texture "outside-castle/peddler-talk.png" ) :split 18 36) peddler-sheet (texture! (texture "outside-castle/peddler-talk.png" ) :split 18 36)
peddler-stand (utils/flip (animation 0.2 (for [i (flatten [(repeat 8 0) 6 (repeat 8 0) 6 (repeat 5 0) 4 5 4 5 4 5])] peddler-stand (utils/flip (animation 0.2 (for [i (flatten [(repeat 8 0) 6 (repeat 8 0) 6 (repeat 5 0) 4 5 4 5 4 5])]
(aget peddler-sheet 0 i)))) (aget peddler-sheet 0 i))))
warden-sheet (texture! (texture "inside-jail/warden.png") :split 43 58) warden-stand (utils/make-anim "ending-castle/warden-2.png" [21 41] 0.21 (flatten [(repeat 7 0) 1]))
warden-stand (animation 0.1 (for [i (flatten [(repeat 30 0) 2 (repeat 20 0) 2])]
(aget warden-sheet 0 i)))
game-player-stand (utils/make-anim "ending-castle/game-player.png" [14 39] 0.2 (flatten [(repeat 5 0) 1] )) game-player-stand (utils/make-anim "ending-castle/game-player.png" [14 39] 0.2 (flatten [(repeat 5 0) 1] ))
ladder-guard-stand-1 (animation 0.1 [(texture "inside-cafeteria/ladder-guard-2.png")]) ladder-guard-stand-1 (animation 0.1 [(texture "inside-cafeteria/ladder-guard-2.png")])
ladder-guard-stand-2 (utils/flip (animation 0.1 [(texture "inside-cafeteria/ladder-guard-2.png")])) ladder-guard-stand-2 (utils/flip (animation 0.1 [(texture "inside-cafeteria/ladder-guard-2.png")]))
grandma-stand (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1]) grandma-stand (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
cat-stand (utils/make-anim "cat-tree/cat-stand.png" [22 10] 0.15 (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0])) cat-stand (utils/make-anim "cat-tree/cat-stand.png" [22 10] 0.15 (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0]))
duke-stand (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 (flatten [(repeat 4 0) 1]))
duke-talk (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 [0 2 0 2 1 2])
duke-reach (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 [3 4 5 6])
duke-reach-talk (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 [6 7])
duke-knight (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 [8 9 10 9 8])
scaler (utils/scaler-fn-with-baseline 20 0.01 1.20)] scaler (utils/scaler-fn-with-baseline 20 0.01 1.20)]
(rooms/make :music :dream (rooms/make :music :dream
:interactions {} :interactions {}
@@ -42,14 +46,53 @@
:anim-start 0 :anim-start 0
:scaled true :scaled true
) )
#_#_:warden (assoc (animation->texture screen warden-stand) :warden (assoc (animation->texture screen warden-stand)
:x 49 :y 72 :baseline (- 240 72) :x 40 :y 50 :baseline (- 240 50)
:anim warden-stand :anim warden-stand
:anim-start 0 :anim-start 0
:scaled true :scale-x 1.1
:scale-x 0.5 :scale-y 1.1
:scale-y 0.5
) )
:gandarf (common/make-wizard screen {:x 205 :y 130 :baseline 199})
:gandarf-cloud (doto (assoc (particle-effect "wizard/gandarf-cloud") :x 215 :y 130
:baseline 200)
(particle-effect! :set-position 215 130))
:duke (assoc (animation->texture screen duke-stand)
:x 117 :y 50 :baseline (- 240 50)
:anim duke-stand
:anim-start 0
:talk-color (color 0.3 0.4 0.9 1.0)
:talk duke-talk
:stand duke-stand
:reach duke-reach
:reach-talk duke-reach-talk
:knight duke-knight
:script (actions/get-script entities
(actions/do-stop entities :ego :face :left)
(actions/do-dialogue entities
:duke "Ladies and gentlemen."
:duke "As the Duke of Remington, I'm pleased to inform you..."
:duke "The goblin by the name of Bloodclot has been destroyed!"
:duke "Our town is saved."
:duke "Thanks to this young boy, Tick."
:duke "It is my rightful duty as Duke of Remington to knight you."
:duke "You've proven yourself worthy."
:duke "Your sword, please.")
(actions/walk-straight-to entities :ego [150 49])
(actions/play-animation entities :ego :reach-start :stop? false)
(actions/play-animation entities :duke :reach :stop? false)
(actions/play-animation entities :ego :reach-stop :stop? false)
(actions/talk entities :duke "Kneel." :anim :reach-talk :stop? false)
(actions/play-animation entities :ego :start-squat-2 :stop? false)
(actions/play-animation entities :duke :knight :stop? false)
(actions/update-entity entities :duke (fn [d] (assoc d :baseline (- 240 48))))
(actions/play-animation entities :duke :knight :stop? false)
(actions/talk entities :duke "In honor of your bravery..." :anim :reach-talk :stop? false)
(actions/talk entities :duke "I declare you Sir Tick of Remington." :anim :reach-talk)
(actions/play-animation entities :ego :end-squat :stop? true)
(actions/do-dialogue entities
:ego "That's great and everything..."
:ego "But where's Georgia McGorgeous?")))
:ladder-guard-1 (assoc (animation->texture screen ladder-guard-stand-1) :ladder-guard-1 (assoc (animation->texture screen ladder-guard-stand-1)
:x 75 :y 69 :baseline (- 240 69) :x 75 :y 69 :baseline (- 240 69)
:anim ladder-guard-stand-1 :anim ladder-guard-stand-1
@@ -87,4 +130,4 @@
:scaled true)} :scaled true)}
:collision "ending-castle/ending-castle2-assets/collision.png" :collision "ending-castle/ending-castle2-assets/collision.png"
:scale-fn scaler :scale-fn scaler
:start-pos [140 55]))) :start-pos [165 49])))

View File

@@ -1065,6 +1065,7 @@ void main()
(assoc-in entities [:cursor :down-target] (or (:id interacting-entity ) (:id interaction) nil)))))) (assoc-in entities [:cursor :down-target] (or (:id interacting-entity ) (:id interaction) nil))))))
:on-touch-up (fn [{:keys [input-x input-y viewport] :as screen} [entities]] :on-touch-up (fn [{:keys [input-x input-y viewport] :as screen} [entities]]
(when (utils/contains-point? (.getScreenX viewport) (.getScreenY viewport) (when (utils/contains-point? (.getScreenX viewport) (.getScreenY viewport)
(.getScreenWidth viewport) (.getScreenHeight viewport) (.getScreenWidth viewport) (.getScreenHeight viewport)
input-x input-y) input-x input-y)

View File

@@ -46,6 +46,8 @@
:right :right
:left)) :left))
(def do-once (atom false))
(defn fly-ego [screen entities] (defn fly-ego [screen entities]
(let [speed 0.07 (let [speed 0.07
pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed))) pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed)))
@@ -74,8 +76,7 @@
(defscreen title-screen (defscreen title-screen
:on-show :on-show
(fn [screen entities] (fn [screen entities]
(utils/setup-viewport screen 1280 960)
(utils/setup-viewport screen 1280 960)
(utils/load-settings!) (utils/load-settings!)
(let [font (utils/get-font "ego/font.fnt") (let [font (utils/get-font "ego/font.fnt")
start-playing (assoc (label (quest-label) (style :label font (color 1.0 0.3 0.3 1.0))) :x 0 :y 280 :height 32 :origin-x 0 :origin-y 0) start-playing (assoc (label (quest-label) (style :label font (color 1.0 0.3 0.3 1.0))) :x 0 :y 280 :height 32 :origin-x 0 :origin-y 0)
@@ -157,6 +158,15 @@
:on-render :on-render
(fn [screen [entities]] (fn [screen [entities]]
#_(try
(when (not @do-once)
(Thread/sleep 1000)
(println "test")
(utils/setup-viewport screen 1280 960)
(reset! do-once true))
(catch Exception e
(println e)))
(clear!) (clear!)
(let [entities (utils/apply-tweens screen entities (:tweens entities)) (let [entities (utils/apply-tweens screen entities (:tweens entities))
@@ -188,6 +198,7 @@
entities) entities)
:on-touch-up (fn [screen [entities]] :on-touch-up (fn [screen [entities]]
(when-not (get-in entities [:tweens :fade-out]) (when-not (get-in entities [:tweens :fade-out])
(let [[x y] (utils/unproject screen)] (let [[x y] (utils/unproject screen)]
(cond (cond
@@ -228,9 +239,15 @@
(label! (:fullscreen entities) set-text "Fullscreen"))) (label! (:fullscreen entities) set-text "Fullscreen")))
:else :else
nil)))) nil))))
:on-resize (fn [{:keys [viewport width height]} [entities]] :on-resize (fn [screen [entities]]
(.update viewport width height)
(utils/setup-viewport screen 1280 960)
#_(on-gl
(gl! :gl-viewport 0 0 1440 900)
(println "HERE")
(.update viewport width height true))
nil)) nil))

View File

@@ -27,12 +27,16 @@
(do (do
(set! (.width cfg) (doto (.width (LwjglApplicationConfiguration/getDesktopDisplayMode)) println)) (set! (.width cfg) (doto (.width (LwjglApplicationConfiguration/getDesktopDisplayMode)) println))
(set! (.height cfg) (doto (.height (LwjglApplicationConfiguration/getDesktopDisplayMode)) println)) (set! (.height cfg) (doto (.height (LwjglApplicationConfiguration/getDesktopDisplayMode)) println))
#_(set! (.resizable cfg) false)
(set! (.useHDPI cfg) true)
(set! (.fullscreen cfg) true)) (set! (.fullscreen cfg) true))
(do (do
(set! (.width cfg) 1280) (set! (.width cfg) 1280)
(set! (.height cfg) 960))) (set! (.height cfg) 960)))
(set! (.foregroundFPS cfg) 60) (set! (.foregroundFPS cfg) 60)
(set! (.backgroundFPS cfg) 60) (set! (.backgroundFPS cfg) 60)
(System/setProperty "org.lwjgl.opengl.Display.enableHighDPI" "true")
#_(System/setProperty "org.lwjgl.opengl.Window.undecorated", "true")
(LwjglApplication. advent cfg)) (LwjglApplication. advent cfg))