#include "ComponentRegistration.hpp"

std::vector<ComponentRegistration::RegistrationFunc>& ComponentRegistration::getRegistrants()
{
	static std::vector<RegistrationFunc> registrants;
	return registrants;
}

void ComponentRegistration::registerComponent(RegistrationFunc func)
{
	getRegistrants().push_back(func);
}

void ComponentRegistration::registerAll(ComponentRegistry& registry,
                                        Ogre::SceneManager* sceneMgr,
                                        EditorPhysicsSystem* physicsSystem,
                                        Ogre::RenderWindow* renderWindow)
{
	for (auto& func : getRegistrants()) {
		func(registry, sceneMgr, physicsSystem, renderWindow);
	}
}
