progress on getting ios version working well.
This commit is contained in:
@@ -8,3 +8,4 @@ move entrance to antique
|
||||
inventory selected item needs to be rendered on top
|
||||
|
||||
|
||||
CLOJURE 1.8 direct linking
|
||||
|
||||
@@ -181,7 +181,8 @@
|
||||
(and (get-in entities [:state :active?])
|
||||
(or (not (get-in entities [:state :hud-active?]))
|
||||
(get-in entities [:fg-actions :script-running?]))
|
||||
(= 0.0 (get-in entities [:fade :opacity])))
|
||||
(= 0.0 (get-in entities [:fade :opacity]))
|
||||
(not (get-in entities [:cam :pinching])))
|
||||
(left-click screen entities options)
|
||||
|
||||
:else
|
||||
@@ -1013,7 +1014,8 @@
|
||||
e)))
|
||||
|
||||
(defn mouse-moved [screen entities {:keys [input-x input-y] :as options}]
|
||||
(utils/update-override screen (assoc-in entities [:cursor :last-pos] [input-x input-y]) options))
|
||||
(when-not (get-in entities [:cam :pinching])
|
||||
(utils/update-override screen (assoc-in entities [:cursor :last-pos] [input-x input-y]) options)))
|
||||
|
||||
(defn grab-layers [entities]
|
||||
(update-in entities [:room]
|
||||
@@ -1070,7 +1072,7 @@
|
||||
(let [{cam :camera :as screen} (utils/setup-viewport screen 320 240)
|
||||
screen (assoc screen :total-time 0)]
|
||||
(set! (. cam zoom) utils/min-zoom)
|
||||
(let [shader (ShaderProgram. ^String v-shader ^String pix-shader)
|
||||
(let [shader (ShaderProgram. ^String (v-shader) ^String (pix-shader))
|
||||
_ (log/info "shader log:" (.getLog shader))
|
||||
state (get-state @utils/selected-save)
|
||||
start-pos [(:x state) (:y state)]
|
||||
@@ -1225,33 +1227,30 @@
|
||||
(update-in [:cam] dissoc :start-zoom :pinching) )))
|
||||
|
||||
:on-pinch
|
||||
(fn [screen entities {:keys [initial-pointer-1 initial-pointer-2]}]
|
||||
(when (and (not (get-in entities [:cam :pinching]))
|
||||
(get-in entities [:state :active?]))
|
||||
(let [[pointer-1-x pointer-1-y] (utils/unproject screen nil [(.x initial-pointer-1) (.y initial-pointer-1)])
|
||||
[pointer-2-x pointer-2-y] (utils/unproject screen nil [(.x initial-pointer-2) (.y initial-pointer-2)])]
|
||||
(-> entities
|
||||
(remove-cam-tweens)
|
||||
(assoc-in [:cursor :last-pos] [0 0])
|
||||
(assoc-in [:cam :ideal-x] (* 0.5 (+ pointer-1-x pointer-2-x)))
|
||||
(assoc-in [:cam :ideal-y] (* 0.5 (+ pointer-1-y pointer-2-y)))
|
||||
(assoc-in [:cam :pinching] true)))))
|
||||
|
||||
:on-zoom
|
||||
(fn [{:keys [^OrthographicCamera camera ^FitViewport viewport ^Stage renderer] :as screen} entities {:keys [initial-distance distance]}]
|
||||
(fn [screen entities {:keys [initial-pointer-1 initial-pointer-2 pointer-1 pointer-2]}]
|
||||
(log/info "pinching...")
|
||||
(when (get-in entities [:state :active?])
|
||||
(let [start-zoom (get-in entities [:cam :start-zoom])
|
||||
zoom (get-in entities [:cam :zoom])
|
||||
entities (as-> entities entities
|
||||
(if (not start-zoom)
|
||||
(assoc-in entities [:cam :start-zoom] zoom)
|
||||
entities)
|
||||
(remove-cam-tweens entities)
|
||||
(assoc-in entities [:cam :zoom] (max utils/max-zoom (min utils/min-zoom (* (or start-zoom zoom) (/ initial-distance distance)))))
|
||||
(assoc-in entities [:cam :x] (utils/bound-to-camera (get-in entities [:cam :ideal-x]) 320 (get-in entities [:cam :zoom])) )
|
||||
(assoc-in entities [:cam :y] (utils/bound-to-camera (get-in entities [:cam :ideal-y]) 240 (get-in entities [:cam :zoom])) ))]
|
||||
entities
|
||||
)))
|
||||
initial-distance (.dst initial-pointer-1 initial-pointer-2)
|
||||
distance (.dst pointer-1 pointer-2)
|
||||
[pointer-1-x pointer-1-y] (utils/unproject screen nil [(.x initial-pointer-1) (.y initial-pointer-1)])
|
||||
[pointer-2-x pointer-2-y] (utils/unproject screen nil [(.x initial-pointer-2) (.y initial-pointer-2)])]
|
||||
(as-> entities entities
|
||||
(remove-cam-tweens entities)
|
||||
|
||||
(if (not start-zoom)
|
||||
(assoc-in entities [:cam :start-zoom] zoom)
|
||||
entities)
|
||||
(assoc-in entities [:cursor :last-pos] [0 0])
|
||||
(assoc-in entities [:cam :ideal-x] (* 0.5 (+ pointer-1-x pointer-2-x)))
|
||||
(assoc-in entities [:cam :ideal-y] (* 0.5 (+ pointer-1-y pointer-2-y)))
|
||||
(assoc-in entities [:cam :pinching] true)
|
||||
|
||||
(assoc-in entities [:cam :x] (utils/bound-to-camera (get-in entities [:cam :ideal-x]) 320 (get-in entities [:cam :zoom])) )
|
||||
(assoc-in entities [:cam :y] (utils/bound-to-camera (get-in entities [:cam :ideal-y]) 240 (get-in entities [:cam :zoom])) )
|
||||
(assoc-in entities [:cam :zoom] (max utils/max-zoom (min utils/min-zoom (* (or start-zoom zoom) (/ initial-distance distance)))))))))
|
||||
|
||||
|
||||
#_#_:on-scrolled
|
||||
(fn [{:keys [^OrthographicCamera camera ^FitViewport viewport ^Stage renderer] :as screen} entities options]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
(ns advent.screens.shader)
|
||||
(ns advent.screens.shader
|
||||
(:require [advent.utils :as utils]))
|
||||
|
||||
(def v-shader "attribute vec4 a_position;
|
||||
|
||||
(def v-shader (constantly "attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
attribute vec2 a_texCoord0;
|
||||
|
||||
@@ -13,10 +15,56 @@ void main() {
|
||||
v_color = a_color;
|
||||
v_texCoords = a_texCoord0;
|
||||
gl_Position = u_projTrans * a_position;
|
||||
}")
|
||||
}"))
|
||||
|
||||
|
||||
(def pix-shader "
|
||||
(def mobile-pix-shader
|
||||
"
|
||||
#ifdef GL_ES
|
||||
#define LOWP lowp
|
||||
#define HIGHP highp
|
||||
precision mediump float;
|
||||
#else
|
||||
#define LOWP
|
||||
#define HIGHP
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying HIGHP vec2 v_texCoords;
|
||||
uniform HIGHP float multiply_amount;
|
||||
uniform HIGHP float hue_amount;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
vec4 toGrayscale(in vec4 color)
|
||||
{
|
||||
float average = (color.r + color.g + color.b) / 3.0;
|
||||
return vec4(average, average, average, color.a);
|
||||
}
|
||||
|
||||
vec4 colorize(in vec4 grayscale, in vec4 color)
|
||||
{
|
||||
return (grayscale * color);
|
||||
}
|
||||
|
||||
|
||||
void main ()
|
||||
{
|
||||
vec4 scaledColor = texture2D(u_texture, v_texCoords);
|
||||
|
||||
vec4 grayscale = toGrayscale(scaledColor);
|
||||
vec4 colorizedOutput = mix(scaledColor, colorize(grayscale, v_color.rgba), hue_amount);
|
||||
|
||||
vec4 multiplied = mix(colorizedOutput.rgba, v_color.rgba * scaledColor.rgba, multiply_amount);
|
||||
|
||||
gl_FragColor = vec4(multiplied.rgb, scaledColor.a * v_color.a);
|
||||
|
||||
}
|
||||
"
|
||||
)
|
||||
|
||||
(def desktop-pix-shader
|
||||
"
|
||||
#ifdef GL_ES
|
||||
#define LOWP lowp
|
||||
#define HIGHP highp
|
||||
@@ -64,6 +112,7 @@ void main ()
|
||||
c3 *= frac.x * (1.0 - frac.y);
|
||||
c4 *= (1.0 - frac.x) * (1.0 - frac.y);
|
||||
vec4 scaledColor = (c1 + c2 + c3 + c4);
|
||||
vec4 scaledColor = texture2D(u_texture, v_texCoords);
|
||||
|
||||
vec4 grayscale = toGrayscale(scaledColor);
|
||||
vec4 colorizedOutput = mix(scaledColor, colorize(grayscale, v_color.rgba), hue_amount);
|
||||
@@ -74,3 +123,11 @@ void main ()
|
||||
|
||||
}
|
||||
")
|
||||
|
||||
|
||||
(defn pix-shader []
|
||||
(if utils/mobile?
|
||||
mobile-pix-shader
|
||||
desktop-pix-shader
|
||||
|
||||
))
|
||||
|
||||
@@ -388,13 +388,18 @@
|
||||
|
||||
(defn make-music [r]
|
||||
(try
|
||||
(doto (music r) (music! :set-looping true))
|
||||
(if mobile?
|
||||
(doto (music (str r ".mp3")) (music! :set-looping true))
|
||||
(doto (music r) (music! :set-looping true)))
|
||||
|
||||
(catch Exception _
|
||||
(doto (music (str r ".mp3")) (music! :set-looping true)))))
|
||||
|
||||
(defn load-sound [f]
|
||||
(try
|
||||
(sound f)
|
||||
(if mobile?
|
||||
(sound (str f ".mp3"))
|
||||
(sound f))
|
||||
(catch Exception e
|
||||
(log/info e)
|
||||
(sound (str f ".mp3")))))
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>83</string>
|
||||
<string>93</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
[org.clojars.notid/tools.logging "0.3.2-SNAPSHOT"]
|
||||
[log4j/log4j "1.2.16"]
|
||||
[org.clojure/clojure "1.8.0"]
|
||||
[com.mobidevelop.robovm/robovm-cocoatouch "2.2.0"]
|
||||
[com.mobidevelop.robovm/robovm-objc "2.2.0"]
|
||||
[com.mobidevelop.robovm/robovm-rt "2.2.0"]
|
||||
[com.mobidevelop.robovm/robovm-compiler "2.2.0"]
|
||||
[com.mobidevelop.robovm/robovm-dist-compiler "2.2.0"]
|
||||
[com.mobidevelop.robovm/robovm-cocoatouch "2.3.0"]
|
||||
[com.mobidevelop.robovm/robovm-objc "2.3.0"]
|
||||
[com.mobidevelop.robovm/robovm-rt "2.3.0"]
|
||||
[com.mobidevelop.robovm/robovm-compiler "2.3.0"]
|
||||
[com.mobidevelop.robovm/robovm-dist-compiler "2.3.0"]
|
||||
[play-clj "0.4.6-BRYCE"]]
|
||||
:source-paths ["src/clojure" "../desktop/src-common"]
|
||||
:java-source-paths ["src/java"]
|
||||
:plugins [[lein-fruit "0.2.4-SNAPSHOT"]]
|
||||
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
|
||||
:ios {:robovm-opts ["-config" "robovm.xml"]
|
||||
:robovm-path "/Users/brycecovert/.robovm-sdks/robovm-2.2.1-SNAPSHOT/"
|
||||
:robovm-path "/Users/brycecovert/.robovm-sdks/robovm-2.2.1-SNAPSHOT"
|
||||
:version 2.1}
|
||||
:aot :all
|
||||
:main advent.core.IOSLauncher)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<config>
|
||||
<executableName>tickstales</executableName>
|
||||
<mainClass>${app.mainclass}</mainClass>
|
||||
<mainClass>advent.core.IOSLauncher</mainClass>
|
||||
<os>ios</os>
|
||||
<arch>arm64</arch>
|
||||
<target>ios</target>
|
||||
|
||||
Reference in New Issue
Block a user