This commit is contained in:
EmsiaetKadosh
2025-02-05 15:13:02 +08:00
parent edcc095979
commit a086558f2d
19 changed files with 388 additions and 56 deletions
+7 -5
View File
@@ -62,19 +62,21 @@ class TextureManager {
Font* defaultFont = nullptr;
using IterFont = Map<int, Font>::const_iterator;
using IterTexture = Map<String, ObjectHolder<ITexture>>::const_iterator;
public:
TextureManager() {
try {
fonts.insert(std::make_pair(0, Font(L"Arial")));
defaultFont = &fonts.at(0);
}
catch (...) {
} catch (const std::out_of_range& e) {
}
} catch (const ArrayIndexOutOfBoundException& e){}
}
Font& getFont(const int id) const noexcept {
const Font& getFont(const int id) const noexcept {
IterFont iterator = fonts.find(id);
if (iterator == fonts.cend()) return
if (iterator == fonts.cend()) return *defaultFont;
return iterator->second;
}
};