diff --git a/projects/nat-archive-tool/src/nat/ArchiveController.kiss b/projects/nat-archive-tool/src/nat/ArchiveController.kiss index 8e346d94..8020450a 100644 --- a/projects/nat-archive-tool/src/nat/ArchiveController.kiss +++ b/projects/nat-archive-tool/src/nat/ArchiveController.kiss @@ -249,6 +249,10 @@ (flatten (for name names (CreateMediaEntry medium name)))) + (defCommand CreateCircleEntry [radius (Number 0 null null)] + [(archive.createEntry ->e + (addComponent archive e Circle (objectWith radius)))]) + // TODO use Tag and VarTag arg types for AddTags and RemoveTags (defCommand AddTags [entries (SelectedEntries 1 null) tagsToAdd (VarText null)] diff --git a/projects/nat-flixel-desktop-playground/source/EntrySprite.hx b/projects/nat-flixel-desktop-playground/source/EntrySprite.hx index 45fed54b..91e3285c 100644 --- a/projects/nat-flixel-desktop-playground/source/EntrySprite.hx +++ b/projects/nat-flixel-desktop-playground/source/EntrySprite.hx @@ -5,6 +5,7 @@ import kiss.List; import flash.display.BitmapData; import flixel.addons.display.FlxExtendedSprite; import flixel.text.FlxText; +import flixel.util.FlxSpriteUtil; import nat.Entry; import nat.Archive; import nat.ArchiveController; diff --git a/projects/nat-flixel-desktop-playground/source/EntrySprite.kiss b/projects/nat-flixel-desktop-playground/source/EntrySprite.kiss index 40186c76..f90150bd 100644 --- a/projects/nat-flixel-desktop-playground/source/EntrySprite.kiss +++ b/projects/nat-flixel-desktop-playground/source/EntrySprite.kiss @@ -8,13 +8,20 @@ &prop :ArchiveController controller] [&mut :Bool selected false] (super position.x position.y) - (if (hasComponent e Images2) + (cond + ((hasComponent e Images2) (let [images (readComponent e Images2)] (.onComplete (BitmapData.loadFromFile (joinPath archive.archiveDir "files" (nth images.imageFiles images.pinnedImageIndex))) ->bitmapData { (loadGraphic bitmapData) - })) - (set pixels .pixels (new FlxText 0 0 0 (readComponent e Name) PlayState.TEXT_SIZE))) + }))) + ((hasComponent e Circle) + (let [c (readComponent e Circle) + diam (Std.int (* 2 c.radius))] + (makeGraphic diam diam FlxColor.TRANSPARENT true) + (FlxSpriteUtil.drawCircle this -1 -1 c.radius FlxColor.TRANSPARENT (object thickness 5 color FlxColor.LIME)))) + (true + (set pixels .pixels (new FlxText 0 0 0 (readComponent e Name) PlayState.TEXT_SIZE)))) (updateColor) (let [:Float scale (getScale e)] (this.scale.set scale scale) diff --git a/projects/nat-flixel-desktop-playground/source/EntrySpriteSystem.kiss b/projects/nat-flixel-desktop-playground/source/EntrySpriteSystem.kiss index 4763651c..624f556e 100644 --- a/projects/nat-flixel-desktop-playground/source/EntrySpriteSystem.kiss +++ b/projects/nat-flixel-desktop-playground/source/EntrySpriteSystem.kiss @@ -11,7 +11,7 @@ (super playState ->[archive e] - ?(hasComponent e Name) + ?(or (hasComponent e Name) (hasComponent e Circle)) ->[archive e pos &opt ui] (unless (sprites.exists e.id) (let [sprite (new EntrySprite this _playgroundKey pos archive e controller)]