Remove outdated Color component and migration system

This commit is contained in:
2022-12-18 04:56:45 +00:00
parent 132a61fc56
commit 3c933e8b0d
5 changed files with 5 additions and 33 deletions

View File

@@ -215,7 +215,6 @@
(archive.addAndProcessSystem (new KeyShortcutSystem this) ui)
(archive.addSystem (new DLSystem))
(archive.addSystem (new AutoStepperSystem))
(archive.addSystem (new ColorSystem))
(localFunction colorEqual [:nat.components.ColorI c1 :nat.components.ColorI c2]
(and (= c1.r c2.r) (= c1.g c2.g) (= c1.b c2.b) (= c1.a c2.a)))
@@ -231,8 +230,11 @@
(when (or !(hasComponent e ColorI) (colorsContain colors (readComponent e ColorI)))
(AddColorIRGBA [e] color.r color.g color.b color.a)))))))
(addColorTagSystems [
// Active: green
=>"(or active enabled)" (object r 0 g 255 b 0 a 255)
// Inactive: gray
=>"(or inactive disabled)" (object r 128 g 128 b 128 a 255)
// todo: orange
=>"todo" (object r 255 g 128 b 0 a 255)])
(whenLet [ps (ui.playgroundSystem)]

View File

@@ -1,8 +0,0 @@
package nat.components;
typedef Color = {
r:Float,
g:Float,
b:Float,
a:Float
};

View File

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

View File

@@ -1,14 +0,0 @@
(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))))