diff --git a/demo/demo/main.cpp b/demo/demo/main.cpp index 8a03ad92b47042d0a4ea672a9025fbaae6785e60..30aadf558621c5f9329471119549fc0db3f4e0a6 100644 --- a/demo/demo/main.cpp +++ b/demo/demo/main.cpp @@ -69,19 +69,23 @@ static void test_atlas_api() { auto *atlas = fggl::gfx::ImageAtlas<char>::pack(images); } -int main(int argc, const char* argv[]) { - fggl::App app( "fggl-demo" ); - - // FIXME: janky API(s) - auto& locator = fggl::util::ServiceLocator::instance(); +static void setupServiceLocators(fggl::util::ServiceLocator& locator) { + // FIXME: janky API(s) auto inputs = locator.supply<fggl::input::Input>(std::make_shared<fggl::input::Input>()); auto storage = locator.supply<fggl::data::Storage>(std::make_shared<fggl::data::Storage>()); locator.supply<fggl::gui::FontLibrary>(std::make_shared<fggl::gui::FontLibrary>()); locator.supply<fggl::ecs3::TypeRegistry>(std::make_shared<fggl::ecs3::TypeRegistry>()); +} + +int main(int argc, const char* argv[]) { + fggl::App app( "fggl-demo" ); + + auto& locator = fggl::util::ServiceLocator::instance(); + setupServiceLocators(locator); // Would be nice to not take args like this, it messes with lifetimes - auto& windowing = app.use<fggl::gfx::ecsGlfwModule>(inputs); + auto& windowing = app.use<fggl::gfx::ecsGlfwModule>(locator.get<fggl::input::Input>()); // -- should not be our problem - this is a broken api auto window = windowing.createWindow("Demo Game");