#pragma once #include namespace Scop { void FontRegistry::RegisterFont(std::shared_ptr font) { m_fonts_registry.insert(font); } void FontRegistry::UnregisterFont(std::shared_ptr font) { m_fonts_registry.erase(font); } std::shared_ptr FontRegistry::GetFont(const std::filesystem::path& name, float scale) { auto it = std::find_if(m_fonts_registry.begin(), m_fonts_registry.end(), [&name, scale](std::shared_ptr rhs) { return (name == rhs->GetName() && scale == rhs->GetScale()); }); return (it != m_fonts_registry.end() ? *it : nullptr); } void FontRegistry::Reset() { for(auto& font: m_fonts_registry) font->Destroy(); m_fonts_registry.clear(); } }