fixing android issues.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="advent.core"
|
||||
package="tickstales.core"
|
||||
android:versionCode="{{version-code}}"
|
||||
android:versionName="{{version-name}}" >
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
android:hardwareAccelerated="true"
|
||||
android:largeHeap="true"
|
||||
android:label="Tick's Tales">
|
||||
<activity android:name=".SplashActivity"
|
||||
<activity android:name="advent.core.SplashActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden" >
|
||||
@@ -24,7 +24,7 @@
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".MainActivity"
|
||||
<activity android:name="advent.core.MainActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden" >
|
||||
<intent-filter>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
(def version (str "2.0." (clojure.string/trim-newline (slurp "../desktop/last-release")) "-snapshot"))
|
||||
(defproject advent version
|
||||
(defproject tickstales version
|
||||
:description "FIXME: write description"
|
||||
:manifest {"Implementation-Version" version}
|
||||
|
||||
:dependencies [[com.badlogicgames.gdx/gdx "1.9.3" :use-resources true]
|
||||
[com.badlogicgames.gdx/gdx-backend-lwjgl "1.9.3"]
|
||||
[com.badlogicgames.gdx/gdx-box2d "1.9.3"]
|
||||
[com.badlogicgames.gdx/gdx-tools "1.9.3"]
|
||||
:dependencies [[com.badlogicgames.gdx/gdx "1.9.4" :use-resources true]
|
||||
[com.badlogicgames.gdx/gdx-backend-lwjgl "1.9.4"]
|
||||
[com.badlogicgames.gdx/gdx-box2d "1.9.4"]
|
||||
[com.badlogicgames.gdx/gdx-tools "1.9.4"]
|
||||
|
||||
|
||||
[com.badlogicgames.gdx/gdx-backend-android "1.9.3"]
|
||||
[com.badlogicgames.gdx/gdx-backend-android "1.9.4"]
|
||||
[neko/neko "4.0.0-alpha5"]
|
||||
|
||||
[com.android.billingclient/billing "dp-1" :extension "aar"]
|
||||
@@ -29,9 +29,10 @@
|
||||
|
||||
:profiles {:dev {:dependencies [[android/tools.nrepl "0.2.0-bigstack"]
|
||||
[compliment "0.1.3"]]
|
||||
:jvm-opts ["-Dplatform=android"]
|
||||
:android {:aot :all-with-unused
|
||||
|
||||
:rename-manifest-package "advent.core.debug"
|
||||
:rename-manifest-package "tickstales.core.debug"
|
||||
:manifest-options {:app-name "ticks tales (debug)"}
|
||||
:aot-exclude-ns ["clojure.core.memoize" "core.async"]}}
|
||||
:release {:android
|
||||
|
||||
@@ -6,7 +6,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.android.billingclient.api.*;
|
||||
import com.android.billingclient.api.BillingClient.BillingResponse;
|
||||
import com.android.billingclient.api.BillingClient.SkuType;
|
||||
@@ -48,10 +51,17 @@ public class MainActivity extends AndroidApplication {
|
||||
|
||||
Game game = (Game) RT.var("advent.core", "advent").deref();
|
||||
System.out.println("pre-init");
|
||||
initialize(game);
|
||||
System.out.println("before bill??");
|
||||
((AssetManager) RT.var("advent.core", "am").deref()).clear();
|
||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||
cfg.useWakelock = true;
|
||||
|
||||
initialize(game, cfg);
|
||||
|
||||
AssetManager am = (AssetManager) RT.var("advent.core", "am").deref();
|
||||
System.out.println(am.getDiagnostics());
|
||||
Texture.setAssetManager(am);
|
||||
am.finishLoading();
|
||||
mBillingClient = new BillingClient.Builder(this).setListener((PurchasesUpdatedListener) RT.var("advent.android", "listener").deref()).build();
|
||||
System.out.println("billing??");
|
||||
mBillingClient.startConnection(new BillingClientStateListener() {
|
||||
@Override
|
||||
public void onBillingSetupFinished(@BillingResponse int billingResponseCode) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import neko.App;
|
||||
|
||||
import advent.core.R;
|
||||
import tickstales.core.R;
|
||||
|
||||
public class SplashActivity extends Activity {
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
6
|
||||
9
|
||||
|
||||
@@ -207,7 +207,7 @@ additive: false
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
dot.png
|
||||
dot
|
||||
|
||||
|
||||
clouds
|
||||
@@ -385,7 +385,7 @@ additive: false
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
cloud2.png
|
||||
cloud2
|
||||
|
||||
|
||||
clouds
|
||||
@@ -563,4 +563,4 @@ additive: false
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
cloud1.png
|
||||
cloud1
|
||||
|
||||
@@ -100,10 +100,15 @@
|
||||
(put! (get-in starting-entities# [:fg-actions :script-chan])
|
||||
(fn [starting-entities#]
|
||||
(let [~entities (atom starting-entities#)]
|
||||
(thread (binding [*fg-bg-key* :fg-actions]
|
||||
~@forms
|
||||
(change-script-state ~entities false)
|
||||
(utils/save @~entities "autosave" "Autosave"))))))))
|
||||
(thread (try (binding [*fg-bg-key* :fg-actions]
|
||||
~@forms
|
||||
(change-script-state ~entities false)
|
||||
(utils/save @~entities "autosave" "Autosave"))
|
||||
(catch clojure.lang.ExceptionInfo e#
|
||||
(println "caught exception" e#))
|
||||
(catch Exception e#
|
||||
(println "Caught exception")
|
||||
(.printStackTrace e#)))))))))
|
||||
|
||||
(defn force-end [entities current-action key]
|
||||
(do (when current-action
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
[play-clj.ui :refer :all]
|
||||
[play-clj.utils :refer :all]
|
||||
[play-clj.g2d :refer :all]
|
||||
[advent.iap :as iap]
|
||||
[advent.ios :as ios])
|
||||
[advent.iap :as iap])
|
||||
(:import [com.badlogic.gdx.graphics Color]
|
||||
[com.badlogic.gdx Application Gdx]))
|
||||
|
||||
|
||||
@@ -420,8 +420,8 @@
|
||||
[860 650] [950 700] [1030 800] [1280 960] [1300 1000]
|
||||
[-50 1000] [-50 -50]]) true)
|
||||
:z 3)
|
||||
:particle-clouds (assoc (particle-effect "particles/particle-clouds" :reset :start) :x 640 :y 480 :z 1)
|
||||
:ego-jet (assoc (particle-effect "particles/jet" :reset :start) :x 450 :y 650 :z 4)
|
||||
:particle-clouds (assoc (doto (utils/load-particle-effect "particles/particle-clouds") (particle-effect! :reset) (particle-effect! :start)) :x 640 :y 480 :z 1)
|
||||
:ego-jet (assoc (doto (utils/load-particle-effect "particles/jet") (particle-effect! :reset) (particle-effect! :start)) :x 450 :y 650 :z 4)
|
||||
|
||||
:main-menu (->> (main-menu screen)
|
||||
(utils/add-actor-to-stage screen))
|
||||
@@ -439,9 +439,9 @@
|
||||
(utils/play-music (:music %)) %)
|
||||
:ease tween/ease-in-quadratic)}}
|
||||
]
|
||||
(println "after load" (.getDiagnostics @(resolve 'advent.core/am)))
|
||||
(merge entities (:main-menu entities))))))
|
||||
|
||||
|
||||
:on-render
|
||||
(fn [{:keys [^FitViewport viewport] :as screen} entities options]
|
||||
#_(steam/update)
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
[advent.steam :as steam]
|
||||
[clojure.core.async :refer [put! <! <!! >! chan go go-loop thread take! alts!! dropping-buffer]])
|
||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Format Pixmap$Blending Pixmap$Filter Texture Texture$TextureFilter]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion Animation ParticleEffect]
|
||||
[play_clj.entities ParticleEffectEntity]
|
||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||
[com.badlogic.gdx.utils ScreenUtils]
|
||||
[com.badlogic.gdx.assets.loaders ParticleEffectLoader$ParticleEffectParameter]
|
||||
[com.badlogic.gdx.graphics PixmapIO$PNG]
|
||||
[com.badlogic.gdx.scenes.scene2d Actor Stage]
|
||||
[com.badlogic.gdx.math CatmullRomSpline]
|
||||
@@ -465,10 +467,10 @@
|
||||
(defn make-music [r]
|
||||
(log/info "making music from" r)
|
||||
(try
|
||||
(if mobile?
|
||||
(doto (music (str r ".mp3")) (music! :set-looping true))
|
||||
(doto (music r) (music! :set-looping true)))
|
||||
|
||||
(platformify (doto (music (str r ".mp3")) (music! :set-looping true))
|
||||
(do (println "android")
|
||||
(doto (music r) (music! :set-looping true)))
|
||||
(doto (music r) (music! :set-looping true)))
|
||||
(catch Exception x
|
||||
(log/warn "music making error" x)
|
||||
|
||||
@@ -796,7 +798,10 @@
|
||||
|
||||
(doseq [resource (id (:resources screen))]
|
||||
(println "releasing " resource)
|
||||
(asset-manager! *asset-manager* :unload resource))
|
||||
(try
|
||||
(asset-manager! *asset-manager* :unload resource)
|
||||
(catch Exception e
|
||||
(println "Error releasing resource " e))))
|
||||
|
||||
(app! :log "info"(str "Released resources " (.getDiagnostics *asset-manager*)))
|
||||
(update! screen :resources (assoc (:resources screen {}) id []))))
|
||||
@@ -806,3 +811,16 @@
|
||||
(animation speed (map #(get-texture (str file "-" (inc %) ".png")) frames)))
|
||||
([atlas file [w h] speed frames]
|
||||
(animation speed (map #(atlas->texture atlas file %) frames))))
|
||||
|
||||
(defn load-particle-effect [path]
|
||||
(let [p (ParticleEffectLoader$ParticleEffectParameter. )
|
||||
am @(resolve 'advent.core/am)]
|
||||
(set! (.atlasFile p) "packed/particles/pack.atlas")
|
||||
(set! (.atlasPrefix p) "")
|
||||
(.load am path ParticleEffect p)
|
||||
(.finishLoading am)
|
||||
(let [x (ParticleEffectEntity. (.get am path ParticleEffect))]
|
||||
(println (.get am "packed/particles/pack.png" Texture))
|
||||
(println (.getTexture (.getSprite (.get (.getEmitters (.get am path ParticleEffect)) 0))))
|
||||
x)
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user