Allow Playground to download images and create text sprites at runtime
This commit is contained in:
@@ -20,6 +20,11 @@
|
|||||||
(print (+ "adding " (the nat.components ,componentType ,c) " as " ,(symbolName componentType) " for " .id ,e))
|
(print (+ "adding " (the nat.components ,componentType ,c) " as " ,(symbolName componentType) " for " .id ,e))
|
||||||
(dictSet .components ,e ,(symbolName componentType) (tink.Json.stringify (the nat.components ,componentType ,c)))))
|
(dictSet .components ,e ,(symbolName componentType) (tink.Json.stringify (the nat.components ,componentType ,c)))))
|
||||||
|
|
||||||
|
(defMacro removeComponent [archive e componentType]
|
||||||
|
`(withWritableEntry ,archive ,e
|
||||||
|
(print (+ "removing " ,(symbolName componentType) " component from " .id ,e))
|
||||||
|
(.remove .components ,e ,(symbolName componentType))))
|
||||||
|
|
||||||
// Retrieve multiple components from an Entity with mutable access.
|
// Retrieve multiple components from an Entity with mutable access.
|
||||||
// All components will be serialized after the block is done.
|
// All components will be serialized after the block is done.
|
||||||
(defMacro withWritableComponents [archive e bindings &body body]
|
(defMacro withWritableComponents [archive e bindings &body body]
|
||||||
|
@@ -21,7 +21,10 @@
|
|||||||
(.urlDecode (url.withoutDirectory))
|
(.urlDecode (url.withoutDirectory))
|
||||||
// Some symbols shouldn't be decoded because they're invalid in file systems!
|
// Some symbols shouldn't be decoded because they're invalid in file systems!
|
||||||
"\"" "%22"))]
|
"\"" "%22"))]
|
||||||
|
// TODO do this with ui.displayMessage
|
||||||
(print url "downloading")
|
(print url "downloading")
|
||||||
(assertProcess "curl" ["--output" filePath url])
|
(assertProcess "curl" ["--output" filePath url])
|
||||||
filePath)))
|
filePath)))
|
||||||
|
// Trigger the creation of a new Images component including the wikipedia images
|
||||||
|
(removeComponent archive e Images)
|
||||||
(addTags archive e ["wikipediaProcessed"])))
|
(addTags archive e ["wikipediaProcessed"])))
|
||||||
|
@@ -171,6 +171,8 @@
|
|||||||
(doFor e changeSet
|
(doFor e changeSet
|
||||||
// process the WikipediaImageSystem and run spriteSystem process on newly created entries that get one
|
// process the WikipediaImageSystem and run spriteSystem process on newly created entries that get one
|
||||||
(archive.processSystems)
|
(archive.processSystems)
|
||||||
|
// Do a second loop through the systems, so Playground systems that trigger Core systems have their effects processed
|
||||||
|
(archive.processSystems)
|
||||||
|
|
||||||
// Entries whose data changed to remove them from the sprite pool will already have been removed
|
// Entries whose data changed to remove them from the sprite pool will already have been removed
|
||||||
// by refreshEntry()
|
// by refreshEntry()
|
||||||
|
Reference in New Issue
Block a user