FlxLightSource
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package hollywoo_flixel;
|
||||
|
||||
import kiss.Prelude;
|
||||
import kiss.List;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class FlxLightSource {}
|
@@ -0,0 +1,12 @@
|
||||
(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)))
|
Reference in New Issue
Block a user