#include "widget_manager.h" #include "widget_system.h" #include "core/window/mwindow.h" void widget_manager::init_window(const std::shared_ptr& in_window) { auto& registry = registries[in_window.get()]; auto& system_manager = registry.systems(); auto& entity_manager = registry.entities(); const auto layout_system = std::make_shared(); const auto hit_test_system = std::make_shared(); const auto render_system = std::make_shared(); layout_system->set_window(in_window); hit_test_system->set_window(in_window); render_system->set_window(in_window); system_manager.addSystem(layout_system); system_manager.addSystem(hit_test_system); system_manager.addSystem(render_system); registry.init(); in_window->on_close_delegate.add_raw(this, &widget_manager::on_window_close); const auto& entity = entity_manager.create<>(); widget_key key { in_window.get(), entity }; in_window->set_key(key); in_window->init_component(entity_manager); } void widget_manager::update() { for (auto& pair : registries) { auto& registry = pair.second; registry.systems().update(); } }