The Mega Snivy Update
Some checks failed
Build / Build Game (push) Has been cancelled

This commit is contained in:
2026-02-28 21:48:00 -05:00
parent 8b2edd1359
commit 17f3348e94
163 changed files with 8725 additions and 13281 deletions

View File

@@ -1,10 +1,52 @@
#include "font.h"
#include "font.hpp"
#include "../log.hpp"
using namespace game::util;
namespace game::resource
{
Font::Font(const std::string& path, float size)
Font::Font(const std::filesystem::path& path, float size)
{
internal = ImGui::GetIO().Fonts->AddFontFromFileTTF(path.c_str(), size);
ImFontConfig config;
config.FontDataOwnedByAtlas = false;
internal = ImGui::GetIO().Fonts->AddFontFromFileTTF(path.c_str(), size, &config);
if (internal)
logger.info(std::format("Initialized font: {}", path.c_str()));
else
logger.error(std::format("Failed to initialize font: {}", path.c_str()));
}
Font::Font(const physfs::Path& path, float size)
{
if (!path.is_valid())
{
logger.error(
std::format("Failed to initialize font from PhysicsFS path: {} ({})", path.c_str(), physfs::error_get()));
return;
}
auto buffer = path.read();
if (buffer.empty())
{
logger.error(
std::format("Failed to initialize font from PhysicsFS path: {} ({})", path.c_str(), physfs::error_get()));
return;
}
ImFontConfig config;
config.FontDataOwnedByAtlas = false;
internal = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(buffer.data(), (int)buffer.size(), size, &config);
if (internal)
logger.info(std::format("Initialized font: {}", path.c_str()));
else
logger.error(std::format("Failed to initialize font: {}", path.c_str()));
}
ImFont* Font::get() { return internal; };
}
}