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,6 +2,13 @@
// TODO handleChanges() will need to kill every changed Entry's sprite and make a new one
// make interactible sprites for entries that have images
(prop &mut :EntrySpriteSystem spriteSystem)
(method :PlaygroundSystem playgroundSystem []
(set spriteSystem (new EntrySpriteSystem this controller)))
(method &override :Void create []
(super.create)
@@ -91,14 +98,6 @@
// make text-only sprites for entries that have no images:
(archive.addSystem (new TextSpriteSystem))
// make interactible sprites for entries that have images
// TODO allow configuring the tags at runtime and erasing/re-creating sprites later
// TODO allow using other position keys and erasing/re-creating sprites later
(prop &mut :EntrySpriteSystem spriteSystem)
(set spriteSystem (new EntrySpriteSystem "!done" "Playground-MAIN" this controller))
(archive.addSystem spriteSystem)
(prop &mut :EntrySpriteDepthSystem spriteDepthSystem)
(set spriteDepthSystem (new EntrySpriteDepthSystem this spriteSystem))
(archive.addSystem spriteDepthSystem)
@@ -148,7 +147,7 @@
(FlxG.camera.updateScrollWheelZoom elapsed 1)
// Don't check keys that can be used in shortcuts outside this block:
(unless sh.currentMap
(unless (or sh.currentMap (and textInput textInput.hasFocus))
(when FlxG.keys.justPressed.SEMICOLON
(sh.start)
(return))
@@ -156,10 +155,10 @@
(doFor e (controller.getSelectedEntries)
(when FlxG.keys.justPressed.MINUS
(withWritableComponents archive e [positions Positions]
(-= .z (dictGet positions spriteSystem.positionKey) 1)))
(-= .z (dictGet positions (spriteSystem.getPlaygroundKey)) 1)))
(when FlxG.keys.justPressed.PLUS
(withWritableComponents archive e [positions Positions]
(+= .z (dictGet positions spriteSystem.positionKey) 1))))
(+= .z (dictGet positions (spriteSystem.getPlaygroundKey)) 1))))
// don't move the ui camera before ui has been placed -- new UI elements could appear offscreen
(when (> uiGroup.length 0)