(ns sekai.io.pixi
  (:require ["pixi.js" :as PIXI]))

(defn make-canvas! [width height]
  (PIXI/Application. #js {:width width :height height
                          :backgroundColor 0x444444}))

(defn clear-canvas! []
  (let [cur-canvas (.querySelector js/document.body ".game-view")]
    (when cur-canvas
      (.removeChild js/document.body cur-canvas))))

(defn make-sprite! [url]
  (-> PIXI .-Sprite (.from url)))
