Fix crash

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-10-10 17:25:42 +03:00
parent c4e13985ed
commit d5af4c9baf
4 changed files with 35 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <cassert>
#include <filesystem>
#include <string>
#include <unordered_set>
#include <vector>
@@ -196,6 +198,23 @@ private:
bool surrounding_dirty { false };
} m_ime;
// NOTE: Canonicalize first!
std::unordered_map<std::filesystem::path, Texture2D> m_textures;
auto get_texture(std::filesystem::path const &path) -> Texture2D const &
{
if (m_textures.contains(path)) {
return m_textures[path];
}
auto fname = path.c_str();
assert(fname);
TraceLog(LOG_INFO, std::format("loading texture at {}", fname).c_str());
auto const tex = LoadTexture(fname);
assert(IsTextureValid(tex));
m_textures[path] = tex;
return m_textures[path];
}
enum_array<Theme, ColorScheme> m_themes { make_default_themes() };
Theme m_active_theme { Theme::Light };