Support next version of libGDX
This commit is contained in:
10
project.clj
10
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"])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user