idk
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
(ns buddho.core.describe
|
||||
(:require [clojure.string :as string]
|
||||
[buddho.core.state.memory :refer [state]]
|
||||
[buddho.core.state.protocols :refer [value reference]]
|
||||
[buddho.core.state.protocols :refer [value value-safe]]
|
||||
[buddho.core.dhamma.aspects :as asp]
|
||||
[buddho.core.state.property :as prop]))
|
||||
|
||||
@@ -42,12 +42,12 @@
|
||||
|
||||
(defn descr-dhamma-fn [idea]
|
||||
;;; TODO things this is an aspect of
|
||||
(let [idea (s/value idea)
|
||||
(let [idea (value-safe idea)
|
||||
aspects (asp/aspects-of idea)
|
||||
format-singleton #(if (prop/has-property? % [:dhamma :singleton]) "{S} " "{T} ")
|
||||
format-dh
|
||||
(fn [dh] (str "<" (format-singleton dh)
|
||||
(:name (s/value dh)) " "
|
||||
(:name (value dh)) " "
|
||||
dh ">"))
|
||||
asp-strs (map (fn [[prop dhs]]
|
||||
(str prop
|
||||
@@ -58,11 +58,11 @@
|
||||
aspects)]
|
||||
(str
|
||||
"Name:\t\t" (:name idea) "\n"
|
||||
(s/dh-desc (:name idea)) "\n"
|
||||
(dh-desc (:name idea)) "\n"
|
||||
"Aspects:\t" (string/join "\n\t\t\t" asp-strs) "\n"
|
||||
"Data:\t\t" (:data idea) "\n"
|
||||
"Meta:\t\t" (:meta idea) "\n"
|
||||
"Transient?:\t" (:transient idea)
|
||||
)))
|
||||
|
||||
(s/describe-property! [:dhamma] "Idea is a dhamma." descr-dhamma-fn)
|
||||
(describe-property! [:dhamma] "Idea is a dhamma." descr-dhamma-fn)
|
||||
|
@@ -32,3 +32,5 @@ mind that keys are functions.")
|
||||
(defn copy [idea] (assoc (value idea) :_reference nil))
|
||||
|
||||
(defn apply-fn [fn idea] (fn-liberal idea fn))
|
||||
|
||||
(def value-safe (fnil value {}))
|
||||
|
@@ -1,3 +1,5 @@
|
||||
(ns sekai.core.init)
|
||||
|
||||
(defn init [])
|
||||
(defn init []
|
||||
(print "chuu")
|
||||
)
|
||||
|
@@ -1,16 +1,7 @@
|
||||
(ns sekai.pixi
|
||||
(ns sekai.graphics.pixi.canvas
|
||||
(:require ["pixi.js" :as PIXI]
|
||||
[buddho.core.state.protocols :refer [value reference]]
|
||||
[buddho.core.describe :as desc]
|
||||
[buddho.core.property :as prop]
|
||||
[buddho.core.state.idea :as idea]))
|
||||
|
||||
(defn describe-properties! []
|
||||
(desc/describe-property! [:canvas] "PixiJS Canvas object.")
|
||||
(desc/describe-property! [:canvas :main] "Main PixiJS canvas")
|
||||
(desc/describe-property! [:pixi] "PixiJS object.")
|
||||
(desc/describe-property! [:pixi :container] "PixiJS container object.")
|
||||
(desc/describe-property! [:world] "PixiJS world container."))
|
||||
[buddho.core.state.idea :as idea]
|
||||
[buddho.core.state.property :as prop]))
|
||||
|
||||
(defn make-canvas! [width height]
|
||||
(let [canvas (PIXI/Application. #js {:width width :height height
|
||||
@@ -37,15 +28,3 @@
|
||||
(.removeChild js/document.body cur-canvas))
|
||||
(when canvas-idea
|
||||
(idea/forget-idea! canvas-idea))))
|
||||
|
||||
(defn make-sprite! [url]
|
||||
(-> PIXI .-Sprite (.from url)))
|
||||
|
||||
(defn world []
|
||||
(-> (prop/with-property [:world])
|
||||
first
|
||||
value
|
||||
:object))
|
||||
|
||||
(defn add-sprite! [sprite]
|
||||
(.addChild ^js/PIXI.Container (world) sprite))
|
9
src/cljs/sekai/graphics/pixi/setup.cljs
Normal file
9
src/cljs/sekai/graphics/pixi/setup.cljs
Normal file
@@ -0,0 +1,9 @@
|
||||
(ns sekai.graphics.pixi.setup
|
||||
(:require [buddho.core.describe :as desc]))
|
||||
|
||||
(defn setup! []
|
||||
(desc/describe-property! [:canvas] "PixiJS Canvas object.")
|
||||
(desc/describe-property! [:canvas :main] "Main PixiJS canvas")
|
||||
(desc/describe-property! [:pixi] "PixiJS object.")
|
||||
(desc/describe-property! [:pixi :container] "PixiJS container object.")
|
||||
(desc/describe-property! [:world] "PixiJS world container."))
|
9
src/cljs/sekai/graphics/pixi/sprite.cljs
Normal file
9
src/cljs/sekai/graphics/pixi/sprite.cljs
Normal file
@@ -0,0 +1,9 @@
|
||||
(ns sekai.graphics.pixi.sprite
|
||||
(:require ["pixi.js" :as PIXI]
|
||||
[sekai.graphics.state.containers :as cont]))
|
||||
|
||||
(defn make-sprite! [url]
|
||||
(-> PIXI .-Sprite (.from url)))
|
||||
|
||||
(defn add-sprite! [sprite]
|
||||
(.addChild ^js/PIXI.Container (cont/world) sprite))
|
9
src/cljs/sekai/graphics/state/containers.cljs
Normal file
9
src/cljs/sekai/graphics/state/containers.cljs
Normal file
@@ -0,0 +1,9 @@
|
||||
(ns sekai.graphics.state.containers
|
||||
(:require [buddho.core.state.property :as prop]
|
||||
[buddho.core.state.protocols :refer [value]]))
|
||||
|
||||
(defn world []
|
||||
(-> (prop/with-property [:world])
|
||||
first
|
||||
value
|
||||
:object))
|
Reference in New Issue
Block a user