Files
hollywoo-flixel/src/hollywoo_flixel/FlxLightSource.kiss
2023-03-29 06:47:45 -06:00

12 lines
458 B
Plaintext

(defNew [&prop :Array<FlxPoint> points
&prop :FlxColor color])
(method stringify []
"${color}|$(.join (for p points "${p.x}|${p.y}") "|")")
(method parse [:String data]
(case (data.split "|")
([::colorStr ...coordStrs]
(let [points (groups coordStrs 2)]
(new FlxLightSource (for [x y] points (new FlxPoint (Std.parseFloat x) (Std.parseFloat y))) (Std.parseInt colorStr))))
(never otherwise)))