/** * Copyright: Copyright (C) 2018 Gabriel Gheorghe, All Rights Reserved * Authors: $(Gabriel Gheorghe) * License: $(LINK2 https://www.gnu.org/licenses/gpl-3.0.txt, GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007) * Source: $(LINK2 https://github.com/GabyForceQ/LibertyEngine/blob/master/source/liberty/scene/meta.d) * Documentation: * Coverage: **/ module liberty.scene.meta; /** * The scene entity default constructor. * You can send a string code with the construction code. * See $(D Entity). **/ mixin template NodeBody() { this(string id) { super(id); register; } private void register() { import std..string : capitalize; enum finalClass = __traits(isFinalClass, this); enum abstractClass = __traits(isAbstractClass, this); static if (!(finalClass || abstractClass)) static assert(0, "A entity object class must either be final or abstract!"); static if (__traits(isFinalClass, this)) { static foreach (el; ["start", "update"]) { static foreach (super_member; __traits(allMembers, typeof(super))) static if (super_member.stringof == "\"" ~ el ~ "\"") mixin("scene." ~ el ~ "ableMap[id] = this;"); static foreach (member; __traits(allMembers, typeof(this))) static if (member.stringof == "\"" ~ el ~ "\"") mixin("scene." ~ el ~ "ableMap[id] = this;"); } } } }