From a39c9f50010815929b71b7ee3f2fa613ccb43db1 Mon Sep 17 00:00:00 2001 From: falsycat Date: Tue, 15 Oct 2019 00:00:00 +0000 Subject: [PATCH] [add] Added a template of ScheduledController for shapes.. --- .../CircleElementScheduledController.d | 23 +++------------ .../ShapeElementScheduledController.d | 28 +++++++++++++++++++ .../SquareElementScheduledController.d | 21 ++------------ 3 files changed, 35 insertions(+), 37 deletions(-) create mode 100644 sjplayer/src/sjplayer/ShapeElementScheduledController.d diff --git a/sjplayer/src/sjplayer/CircleElementScheduledController.d b/sjplayer/src/sjplayer/CircleElementScheduledController.d index 977bb6f..04a95f5 100644 --- a/sjplayer/src/sjplayer/CircleElementScheduledController.d +++ b/sjplayer/src/sjplayer/CircleElementScheduledController.d @@ -1,29 +1,14 @@ /// License: MIT module sjplayer.CircleElementScheduledController; -import std.typecons; - import sjplayer.CircleElement, sjplayer.ElementScheduledControllerFactory, - sjplayer.ScheduledController; + sjplayer.ScheduledController, + sjplayer.ShapeElementScheduledController; /// -alias CircleElementScheduledController = ScheduledController!( - CircleElement, - [ - "damage": "damage", - "nearness_coe": "nearness_coe", - "weight": "weight", - "smooth": "smooth", - "color_r": "color.r", - "color_g": "color.g", - "color_b": "color.b", - "color_a": "color.a", - ] - ); -static assert(CircleElementScheduledController.AliveManagementAvailable); -static assert(CircleElementScheduledController.MatrixModificationAvailable); -static assert(CircleElementScheduledController.AutoInitializationAvailable); +alias CircleElementScheduledController = + ShapeElementScheduledController!CircleElement; /// alias CircleElementScheduledControllerFactory = diff --git a/sjplayer/src/sjplayer/ShapeElementScheduledController.d b/sjplayer/src/sjplayer/ShapeElementScheduledController.d new file mode 100644 index 0000000..d046ff0 --- /dev/null +++ b/sjplayer/src/sjplayer/ShapeElementScheduledController.d @@ -0,0 +1,28 @@ +/// License: MIT +module sjplayer.ShapeElementScheduledController; + +import sjplayer.CircleElement, + sjplayer.ElementInterface, + sjplayer.ElementScheduledControllerFactory, + sjplayer.ScheduledController; + +/// +template ShapeElementScheduledController(Element) + if (is(Element : ElementInterface)) { + alias ShapeElementScheduledController = ScheduledController!( + Element, + [ + "damage": "damage", + "nearness_coe": "nearness_coe", + "weight": "weight", + "smooth": "smooth", + "color_r": "color.r", + "color_g": "color.g", + "color_b": "color.b", + "color_a": "color.a", + ] + ); + static assert(ShapeElementScheduledController.AliveManagementAvailable); + static assert(ShapeElementScheduledController.MatrixModificationAvailable); + static assert(ShapeElementScheduledController.AutoInitializationAvailable); +} diff --git a/sjplayer/src/sjplayer/SquareElementScheduledController.d b/sjplayer/src/sjplayer/SquareElementScheduledController.d index 419caf3..aee7e94 100644 --- a/sjplayer/src/sjplayer/SquareElementScheduledController.d +++ b/sjplayer/src/sjplayer/SquareElementScheduledController.d @@ -1,29 +1,14 @@ /// License: MIT module sjplayer.SquareElementScheduledController; -import std.typecons; - import sjplayer.ElementScheduledControllerFactory, sjplayer.ScheduledController, + sjplayer.ShapeElementScheduledController, sjplayer.SquareElement; /// -alias SquareElementScheduledController = ScheduledController!( - SquareElement, - [ - "damage": "damage", - "nearness_coe": "nearness_coe", - "weight": "weight", - "smooth": "smooth", - "color_r": "color.r", - "color_g": "color.g", - "color_b": "color.b", - "color_a": "color.a", - ] - ); -static assert(SquareElementScheduledController.AliveManagementAvailable); -static assert(SquareElementScheduledController.MatrixModificationAvailable); -static assert(SquareElementScheduledController.AutoInitializationAvailable); +alias SquareElementScheduledController = + ShapeElementScheduledController!SquareElement; /// alias SquareElementScheduledControllerFactory =