generalize EntrySpriteSystem into PlaygroundSystem which all ui will provide

This commit is contained in:
2022-07-02 19:51:30 +00:00
parent f62b42f06b
commit bcd1eca9a0
13 changed files with 97 additions and 29 deletions

View File

@@ -2,21 +2,19 @@
(prop :Map<String,EntrySprite> sprites (new Map))
(defNew [:String tagFilterString
&prop :String positionKey
:PlayState playState
// TODO this can also handle text sprites, and instead of saving out the text bitmap,
// just make the FlxText every time at runtime -- so PinNextImage won't be needed
// when the media tag is added
(defNew [:PlayState playState
&prop :ArchiveController controller]
(super
playState
->[archive e]
?(and (tagsMatch e tagFilterString) (hasComponent e Images))
->[archive e &opt ui]
?(hasComponent e Images)
->[archive e pos &opt ui]
(unless (sprites.exists e.id)
(when !(hasComponent e Positions)
(addComponent archive e Positions (new Map)))
(withWritableComponents archive e [positions Positions]
(when !(positions.exists positionKey)
(dictSet positions positionKey (object x 0.0 y 0.0 z 0.0))))
(let [sprite (new EntrySprite this positionKey archive e controller)]
(let [sprite (new EntrySprite this _playgroundKey pos archive e controller)]
(playState.entryGroup.add sprite)
(dictSet sprites e.id sprite))))
@@ -29,5 +27,7 @@
(controller.DeSelectEntry e)
}))
// TODO override process to z-sort all sprites after making them
(method getSelectedSprites []
(filter (for e (controller.getSelectedEntries) (dictGet sprites e.id))))