This commit is contained in:
Akko
2024-09-04 12:36:18 +02:00
parent c5755b700b
commit d08ca1aea0
13 changed files with 54 additions and 37 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,18 @@
#+title: Our World
* Subsystems
** ECS
** Event Loop
** Map system
** Utilities
*** Logging
** Selectors
* Buddho
** Documentation
*** TODO base documentation
* No Intellect
** Tooling
** Documentation
** Physics
*** Space
**** TODO Notion of spatial object
**** TODO Rendering of spatial objects
**** TODO Moving of sp. o.
* Game
** Design
*** TODO base design documentation

View File

@@ -12,5 +12,5 @@
:builds
{:frontend
{:target :browser
:modules {:main {:init-fn sekai.core.init/init}}
:modules {:main {:init-fn game.core.init/init}}
}}}

View File

@@ -1,6 +1,8 @@
(ns buddho.macros.dhamma
(:require [clojure.set :as set]))
(declare defdhamma)
(defmacro defconstructor
"Create a dhamma constructor.
For `dh-name`, constructor function will be bound to `dh-name!`.
@@ -38,16 +40,22 @@
"
[dh-name & {:keys [meta data defaults dh-defaults]
:or {meta {} data {} dh-defaults {}}}]
`(defn ~(symbol (str dh-name "!"))
`(do
(defn ~(symbol (str dh-name "!"))
[& {:keys [~@(concat (keys meta) (keys data)) ~'dh-args]
:or ~defaults}]
(#'buddho.core.dhamma/register-dhamma!
(#'buddho.core.dhamma.state/register-dhamma!
~(keyword dh-name)
(merge
~(merge dh-defaults
{:data (set/map-invert data)}
{:meta {(keyword dh-name) (set/map-invert meta)}})
~'dh-args))))
~'dh-args)))
(defdhamma
~(symbol (str dh-name ".construct")))
))
(defn extraction-bindings [datasym bindings extractor defaults]
`(~datasym
@@ -94,8 +102,10 @@
{:keys [data meta
defaults
dh-defaults
meta-as data-as]
:or {defaults {}}}
meta-as data-as
make-constructor]
:or {defaults {}
make-constructor true}}
& body]
(let [kw (keyword name)
default-data
@@ -107,29 +117,30 @@
(map (fn [[k v]] [v (defaults k)]))
(into {}))]
`(do
(when ~make-constructor
(defconstructor ~name
:data ~data
:meta ~meta
:dh-defaults ~dh-defaults
:defaults ~defaults)
:defaults ~defaults))
(#'buddho.core.state/describe-dhamma!
(#'buddho.core.describe/describe-dhamma!
~kw
~docstring)
(defmethod buddho.core.dhamma/impl! ~kw ~(symbol (str "impl-" name))
(defmethod buddho.core.dhamma.occur/impl! ~kw ~(symbol (str "impl-" name))
[~'dhamma & [~'parent]]
(let [~@(when (or data data-as)
(extraction-bindings
(or data-as `data#)
data
'#'buddho.core.dhamma/extract-data
'#'buddho.core.dhamma.data/extract-data
default-data))
~@(when (or meta meta-as)
(extraction-bindings
(or meta-as `meta#)
meta
'#'buddho.core.dhamma/extract-meta
'#'buddho.core.dhamma.data/extract-meta
default-meta))]
~@body)))))

View File

@@ -1,6 +1,6 @@
(ns buddho.core.dhamma.occur
"Implementation of dhamma occurence mechanism."
(:require [buddho.core.state :as s :refer [value]]
(:require [buddho.core.state.protocols :as s :refer [value]]
[buddho.core.dhamma.aspects :refer [pop-asp-stage]]
[buddho.core.dhamma.data :refer [make-dhamma]]))

View File

@@ -1,8 +1,6 @@
(ns buddho.dhamma.state
(:require [buddho.core.dhamma :as d]
[buddho.core.meta :as meta]
[buddho.core.state :as s]
[sekai.math.vectors :as vect])
(:require [buddho.core.dhamma.return :as ret]
[buddho.core.state.idea :as idea])
(:require-macros [buddho.macros.dhamma :refer [defdhamma]]))
(defdhamma have-idea
@@ -15,9 +13,9 @@ Mind: pulls _fields_ from only *one* dhamma, but will pull _data_ from *both* dh
:data-as all-data}
;; TODO error if no fields specified
(let [idea (s/have-idea!)
(let [idea (idea/have-idea!)
; fields (or fields (keys all-data))
data (zipmap fields (map all-data fields))]
(s/update-idea! idea data)
(d/with-return parent :have-idea
(idea/update-idea! idea data)
(ret/with-return parent :have-idea
{return-field idea})))

View File

@@ -0,0 +1,4 @@
(ns game.core.init)
(defn init []
(print "hello"))

View File

@@ -1,4 +1,4 @@
(ns sekai.graphics.pixi.canvas
(ns no_intellect.graphics.pixi.canvas
(:require ["pixi.js" :as PIXI]
[buddho.core.state.idea :as idea]
[buddho.core.state.property :as prop]))

View File

@@ -1,5 +0,0 @@
(ns sekai.core.init)
(defn init []
(print "chuu")
)