Use int-based colors for tag-color systems in NAT. Close #167

This commit is contained in:
2022-12-04 23:11:18 +00:00
parent 1ca8e30c33
commit 8579b6b8f0
10 changed files with 77 additions and 20 deletions

View File

@@ -0,0 +1,8 @@
package nat.systems;
import kiss.Prelude;
import kiss.List;
import nat.System;
@:build(kiss.Kiss.build())
class ColorSystem extends System {}

View File

@@ -0,0 +1,14 @@
(load "../Lib.kiss")
// Converts outdated Color component into a ColorF component and a ColorI component
(defNew []
(super
->[archive e]
(hasComponent e Color)
->[archive e &opt ui]
(let [c (readComponent e Color)]
(addComponent archive e ColorF c)
(addComponent archive e ColorI (colorIFromF c))
(removeComponent archive e Color))))

View File

@@ -5,7 +5,7 @@
(method :String getPlaygroundKey [] _playgroundKey)
(prop :Map<String,TagList> playgroundDefaultTags (new Map))
(prop :Map<String,Color> playgroundBGColors (new Map))
(prop :Map<String,ColorF> playgroundBGColors (new Map))
(defNew [&prop :ArchiveUI ui
:EntryChecker canProcess
@@ -25,7 +25,7 @@
(if (hasComponent e CatsMatchExp)
(archive.changePlaygrounds ->:Void [:DynamicAccess<Dynamic> p] (set .catsMatch (dictGet p name) (readComponent e CatsMatchExp)))
(addComponent archive e CatsMatchExp .catsMatch (dictGet archive.playgrounds name)))
(dictSet playgroundBGColors name (readComponentOr e Color (object r 0.0 g 0.0 b 0.0 a 1.0)))
(dictSet playgroundBGColors name (readComponentOr e ColorF (object r 0.0 g 0.0 b 0.0 a 1.0)))
(dictSet playgroundDefaultTags name (readComponentOr e TagList []))))
// Process Entries belonging to the current playground
@@ -52,7 +52,7 @@
})
(process ui.controller.archive ui))
(method :Void clear [:Color color]
(method :Void clear [:ColorF color]
(throw "(PlaygroundSystem.clear <color>) not implemented"))
(prop &mut :Bool setupProcess false)