From e5454edba30100d98ef6e2adb847142682fd5060 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 29 Mar 2023 06:47:45 -0600 Subject: [PATCH] FlxLightSource --- src/hollywoo_flixel/FlxLightSource.hx | 9 +++++++++ src/hollywoo_flixel/FlxLightSource.kiss | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/hollywoo_flixel/FlxLightSource.hx create mode 100644 src/hollywoo_flixel/FlxLightSource.kiss diff --git a/src/hollywoo_flixel/FlxLightSource.hx b/src/hollywoo_flixel/FlxLightSource.hx new file mode 100644 index 0000000..0f1c751 --- /dev/null +++ b/src/hollywoo_flixel/FlxLightSource.hx @@ -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 {} diff --git a/src/hollywoo_flixel/FlxLightSource.kiss b/src/hollywoo_flixel/FlxLightSource.kiss new file mode 100644 index 0000000..c06f062 --- /dev/null +++ b/src/hollywoo_flixel/FlxLightSource.kiss @@ -0,0 +1,12 @@ +(defNew [&prop :Array 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))) \ No newline at end of file