<commit_before>(ns play-clj.entities
  (:import [com.badlogic.gdx Gdx Graphics]
           [com.badlogic.gdx.graphics Camera]
           [com.badlogic.gdx.graphics.g2d Batch NinePatch ParticleEffect
            TextureRegion]
           [com.badlogic.gdx.graphics.g3d Environment ModelBatch ModelInstance]
           [com.badlogic.gdx.graphics.glutils ShapeRenderer]
           [com.badlogic.gdx.math Matrix4]
           [com.badlogic.gdx.scenes.scene2d Actor]))

(defprotocol Entity
  (draw! [this screen batch] "Draws the entity"))

(extend-protocol Entity
  clojure.lang.PersistentArrayMap
  (draw! [this screen batch])
  clojure.lang.PersistentHashMap
  (draw! [this screen batch])
  nil
  (draw! [this screen batch]))

(defrecord TextureEntity [object] Entity
  (draw! [{:keys [^TextureRegion object x y width height
                  scale-x scale-y angle origin-x origin-y]}
          _
          batch]
    (let [x (float (or x 0))
          y (float (or y 0))
          width (float (or width (.getRegionWidth object)))
          height (float (or height (.getRegionHeight object)))]
      (if (or scale-x scale-y angle)<commit_msg>hack for making centering work.<commit_after>(ns play-clj.entities
  (:import [com.badlogic.gdx Gdx Graphics]
           [com.badlogic.gdx.graphics Camera]
           [com.badlogic.gdx.graphics.g2d Batch NinePatch ParticleEffect
            TextureRegion]
           [com.badlogic.gdx.graphics.g3d Environment ModelBatch ModelInstance]
           [com.badlogic.gdx.graphics.glutils ShapeRenderer]
           [com.badlogic.gdx.math Matrix4]
           [com.badlogic.gdx.scenes.scene2d Actor]))

(defprotocol Entity
  (draw! [this screen batch] "Draws the entity"))

(extend-protocol Entity
  clojure.lang.PersistentArrayMap
  (draw! [this screen batch])
  clojure.lang.PersistentHashMap
  (draw! [this screen batch])
  nil
  (draw! [this screen batch]))

(defrecord TextureEntity [object] Entity
  (draw! [{:keys [^TextureRegion object x y width height
                         scale-x scale-y angle origin-x origin-y]}
                 _
                 batch]
    (let [x (- (float (or x 0)) (* (float (or origin-x 0.0)) (float (or scale-x 1.0))))
          y (float (or y 0))
          width (float (or width (.getRegionWidth object)))
          height (float (or height (.getRegionHeight object)))]
      (if (or scale-x scale-y angle)
{'fraction_non_alphanumeric': 0.11386554621848739, 'fraction_numerical': 0.0067226890756302525, 'mean_word_length': 2.585843373493976, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4408496', 'n_tokens_mistral': 769, 'n_tokens_neox': 731, 'n_words': 201}