From 28728bba2761c25c9b1ede9bd75c4b365119c107 Mon Sep 17 00:00:00 2001 From: Remington Covert Date: Wed, 17 Sep 2014 12:26:38 -0700 Subject: [PATCH] nice transitions. --- desktop/resources/black.png | Bin 0 -> 1178 bytes desktop/src-common/advent/actions.clj | 27 +++++++++++++++++--- desktop/src-common/advent/screens/scene.clj | 7 +++-- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 desktop/resources/black.png diff --git a/desktop/resources/black.png b/desktop/resources/black.png new file mode 100644 index 0000000000000000000000000000000000000000..62f3616a0ce1dfdb7386676c390e7f1393ba2ec3 GIT binary patch literal 1178 zcmV;L1ZDe)P)4Tx05}naRo`#hR1`jmZ&IWdKOk5~hl<6oRa0BJ8yc;~21%2p?MfD<>DVeH z9(p*dx19w`~g7O0}n_%Aq@s%d)fBDv`JHkDym6Hd+5XuAtvnwRpGmK zVkc9?T=n|PIo~X-eVh__(Z?q}P9Z-Dj?gOW6|D%o20XmjW-qs4UjrD(li^iv8@eK9k+ZFm zVRFymFOPAzG5-%Pn|1W;U4vNroTa&AxDScmEA~{ri9gr1^c?U@uwSpaNnw8l_>cP1 zd;)kMQS_;jeRSUEM_*s96y65j1$)tOrwdK{YIQMt92l|D^(E_=$Rjw{b!QT@q!)ni zR`|5oW9X5n$Wv+HVc@|^eX5yXnsHX8PF3UX~a6)MwxDE0HaPjyrlI!;jX{6Kvuh*8ej?;85ekN$?5uuCiS zBTvvVG+XTxAO{m@bvM#Jr)z6J><&E22D|vq?Y?Vkbo_DijopiF$2PET#mZ8eu=y$(ArYkv7@Ex`GL?QCc!_*KFrd&;n1r7 zqW-CFs9&fT)ZaU5gc&=gBz-DaCw(vdOp0__x+47~U6sC(E(JNe@4cTT*n6*E zVH4eoU1-&7pEV~_PRe`a7v+@vy!^5}8?Y3)UmlaER0000nNkl 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)))