diff --git a/desktop/resources/black.png b/desktop/resources/black.png new file mode 100644 index 00000000..62f3616a Binary files /dev/null and b/desktop/resources/black.png differ diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 89429857..156a8075 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -149,14 +149,35 @@ (defn transition-background [entities new-background [x y]] (run-action entities (begin [this screen entities] + (-> entities + (assoc-in [:transition] + (assoc (texture "black.png") + :scale-x 20 + :scale-y 20 + :baseline 9500 + :opacity 0.1)))) + + (continue [this screen entities] + (update-in entities [:transition :opacity] + 0.075)) + + (done? [this screen entities] + (>= (get-in entities [:transition :opacity]) 1.0)) + + (terminate [this screen entities] + entities)) + (run-action entities + (begin [this screen entities] + (-> entities (assoc-in [:background] (get-in entities [:backgrounds new-background])) (assoc-in [:ego :x] x) (assoc-in [:ego :y] y))) - (continue [this screen entities] entities) + (continue [this screen entities] + (update-in entities [:transition :opacity] - 0.075)) - (done? [this screen entities] true) + (done? [this screen entities] + (<= (get-in entities [:transition :opacity]) 0.0)) (terminate [this screen entities] - entities))) + (dissoc entities :transition)))) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index f224898c..72b3c55e 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -10,9 +10,10 @@ [advent.utils :as utils] [advent.screens.dialogue :refer [talking-screen]] [clojure.core.async :refer [put! ! chan go thread take! alts!!]]) - (:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter] + (:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30] [com.badlogic.gdx.graphics.g2d TextureRegion] - [java.lang Object])) + [java.lang Object] + [com.badlogic.gdx Gdx])) (def +screen-width+ 320) (def +screen-height+ 240) @@ -206,6 +207,8 @@ :on-render (fn [screen [entities]] (clear!) + (.glEnable (.getGL20 Gdx/graphics) GL20/GL_BLEND) + #_(.glEnable (.getGL30 Gdx/graphics) GL30/GL_BLEND) (let [entities (update-cursor screen entities) entities (update-from-script screen entities) entities (update-in entities [:background :entities] (fn [entities] (map #(animate % screen) entities)))