Skip to content
Snippets Groups Projects
Commit 38a1e10c authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

seperate the service API stuff into it's own function to improve reablity

parent cb8b6849
No related branches found
No related tags found
No related merge requests found
......@@ -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");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment