From 2bbf13e72c571c5063576a13e123f0ae3ad78f9f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 3 Oct 2022 20:28:33 +0200 Subject: fix msvc --- loader-impl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'loader-impl.cpp') diff --git a/loader-impl.cpp b/loader-impl.cpp index 5434af76..23552f77 100644 --- a/loader-impl.cpp +++ b/loader-impl.cpp @@ -11,12 +11,13 @@ #include #include #include +#include namespace Magnum::Examples { struct loader_impl final : loader_ { - const Utility::Resource shader_res{"game/shaders"}; + std::optional shader_res; PluginManager::Manager importer_plugins; Containers::Pointer tga_importer = importer_plugins.loadAndInstantiate("AnyImageImporter"); @@ -37,7 +38,9 @@ struct loader_impl final : loader_ std::string loader_impl::shader(const Containers::StringView& filename) { - auto ret = shader_res.getString(filename); + if (!shader_res) + shader_res = std::make_optional("game/shaders"); + auto ret = shader_res->getString(filename); if (ret.isEmpty()) ABORT("can't find shader resource '%s'", filename.cbegin()); return ret; @@ -76,8 +79,8 @@ loader_impl::~loader_impl() = default; static loader_& make_default_loader() { - static loader_impl loader{}; - return loader; + static loader_impl loader_singleton{}; + return loader_singleton; } // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -- cgit v1.2.3