From 93ad83db7b72e7251a6047e945ee2bab42734861 Mon Sep 17 00:00:00 2001 From: oakes Date: Fri, 8 Aug 2014 15:48:52 -0400 Subject: [PATCH] Support next version of libGDX --- project.clj | 10 ++++++---- src/play_clj/core.clj | 2 +- src/play_clj/core_graphics.clj | 6 +++--- src/play_clj/entities.clj | 16 ++++++++-------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/project.clj b/project.clj index beb3c12..adefa3c 100644 --- a/project.clj +++ b/project.clj @@ -1,12 +1,14 @@ -(defproject play-clj "0.3.9" +(defproject play-clj "0.3.9-SNAPSHOT" :description "A libGDX wrapper for easy cross-platform game development" :url "https://github.com/oakes/play-clj" :license {:name "Public Domain" :url "http://unlicense.org/UNLICENSE"} - :dependencies [[com.badlogicgames.gdx/gdx "1.2.0"] - [com.badlogicgames.gdx/gdx-box2d "1.2.0"] - [com.badlogicgames.gdx/gdx-bullet "1.2.0"] + :dependencies [[com.badlogicgames.gdx/gdx "1.2.1-SNAPSHOT"] + [com.badlogicgames.gdx/gdx-box2d "1.2.1-SNAPSHOT"] + [com.badlogicgames.gdx/gdx-bullet "1.2.1-SNAPSHOT"] [org.clojure/clojure "1.6.0"]] + :repositories [["sonatype" + "https://oss.sonatype.org/content/repositories/snapshots/"]] :source-paths ["src"] :java-source-paths ["src-java"] :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]) diff --git a/src/play_clj/core.clj b/src/play_clj/core.clj index c3cd3c4..7db5695 100644 --- a/src/play_clj/core.clj +++ b/src/play_clj/core.clj @@ -15,7 +15,7 @@ [com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera PerspectiveCamera Pixmap Pixmap$Format PixmapIO Texture VertexAttributes$Usage] - [com.badlogic.gdx.graphics.g2d ParticleEffect SpriteBatch] + [com.badlogic.gdx.graphics.g2d ParticleEffect Batch] [com.badlogic.gdx.graphics.g3d ModelBatch] [com.badlogic.gdx.graphics.glutils ShapeRenderer] [com.badlogic.gdx.input GestureDetector diff --git a/src/play_clj/core_graphics.clj b/src/play_clj/core_graphics.clj index 0bc99f0..bb141e7 100644 --- a/src/play_clj/core_graphics.clj +++ b/src/play_clj/core_graphics.clj @@ -465,7 +465,7 @@ with the tiled map file at `path` and `unit` scale. (defmethod draw! BatchTiledMapRenderer [{:keys [^BatchTiledMapRenderer renderer] :as screen} entities] - (let [^SpriteBatch batch (.getSpriteBatch renderer)] + (let [^Batch batch (.getSpriteBatch renderer)] (.begin batch) (doseq [entity entities] (e/draw-entity! entity screen batch)) @@ -474,7 +474,7 @@ with the tiled map file at `path` and `unit` scale. (defmethod draw! Stage [{:keys [^Stage renderer] :as screen} entities] - (let [^SpriteBatch batch (.getSpriteBatch renderer)] + (let [^Batch batch (.getBatch renderer)] (.begin batch) (doseq [entity entities] (e/draw-entity! entity screen batch)) @@ -595,7 +595,7 @@ to overlap correctly with the entities. (when-not (get-in screen [:layers ln]) (update-fn! assoc-in [[:layers ln] (split-layer screen ln)]))) (when camera (.setView renderer camera)) - (let [^SpriteBatch batch (.getSpriteBatch renderer)] + (let [^Batch batch (.getSpriteBatch renderer)] (.begin batch) (doseq [entity (->> (map #(get-in screen [:layers %]) layer-names) (apply concat entities) diff --git a/src/play_clj/entities.clj b/src/play_clj/entities.clj index 3abd247..ca5d39f 100644 --- a/src/play_clj/entities.clj +++ b/src/play_clj/entities.clj @@ -1,7 +1,7 @@ (ns play-clj.entities (:import [com.badlogic.gdx Gdx Graphics] [com.badlogic.gdx.graphics Camera] - [com.badlogic.gdx.graphics.g2d NinePatch ParticleEffect SpriteBatch + [com.badlogic.gdx.graphics.g2d NinePatch ParticleEffect Batch TextureRegion] [com.badlogic.gdx.graphics.g3d Environment ModelBatch ModelInstance] [com.badlogic.gdx.graphics.glutils ShapeRenderer] @@ -34,9 +34,9 @@ origin-x (float (or origin-x (/ width 2))) origin-y (float (or origin-y (/ height 2))) angle (float (or angle 0))] - (.draw ^SpriteBatch batch object x y origin-x origin-y width height + (.draw ^Batch batch object x y origin-x origin-y width height scale-x scale-y angle)) - (.draw ^SpriteBatch batch object x y width height))))) + (.draw ^Batch batch object x y width height))))) (defrecord NinePatchEntity [object] Entity (draw-entity! [{:keys [^NinePatch object x y width height]} _ batch] @@ -44,7 +44,7 @@ y (float (or y 0)) width (float (or width (.getTotalWidth object))) height (float (or height (.getTotalHeight object)))] - (.draw object ^SpriteBatch batch x y width height)))) + (.draw object ^Batch batch x y width height)))) (defrecord ParticleEffectEntity [object] Entity (draw-entity! [{:keys [^ParticleEffect object x y delta-time]} _ batch] @@ -53,7 +53,7 @@ ^Graphics g (Gdx/graphics) delta-time (float (or delta-time (.getDeltaTime g)))] (.setPosition object x y) - (.draw object ^SpriteBatch batch delta-time)))) + (.draw object ^Batch batch delta-time)))) (defrecord ActorEntity [object] Entity (draw-entity! [{:keys [^Actor object x y width height @@ -73,7 +73,7 @@ (.setOriginX object origin-x) (.setOriginY object origin-y) (.setRotation object angle))) - (.draw object ^SpriteBatch batch 1))) + (.draw object ^Batch batch 1))) (defrecord ModelEntity [object] Entity (draw-entity! [{:keys [^ModelInstance object x y z]} @@ -93,7 +93,7 @@ {:keys [^Camera camera]} batch] (when batch - (.end ^SpriteBatch batch)) + (.end ^Batch batch)) (when camera (.setProjectionMatrix object (. camera combined))) (.begin object type) @@ -110,7 +110,7 @@ (draw!) (.end object) (when batch - (.begin ^SpriteBatch batch)))) + (.begin ^Batch batch)))) (defrecord BundleEntity [entities] Entity (draw-entity! [{:keys [entities] :as entity} screen batch]