fix: Make sure all textures are destroyed before glfw gets uninitialized

This commit is contained in:
WerWolv
2025-01-27 22:10:30 +01:00
parent 6e6c5bbc67
commit 24e7c2f3db
17 changed files with 104 additions and 56 deletions

View File

@@ -155,14 +155,18 @@ namespace hex::plugin::builtin {
ImGui::NewLine();
struct DonationPage {
ImGuiExt::Texture texture;
const char *link;
DonationPage(const std::fs::path &path, const std::string &link) :
texture(ImGuiExt::Texture::fromImage(romfs::get(path).span<std::byte>(), ImGuiExt::Texture::Filter::Linear)),
link(std::move(link)) { }
AutoReset<ImGuiExt::Texture> texture;
std::string link;
};
static std::array DonationPages = {
DonationPage { ImGuiExt::Texture::fromImage(romfs::get("assets/common/donation/paypal.png").span<std::byte>(), ImGuiExt::Texture::Filter::Linear), "https://werwolv.net/donate" },
DonationPage { ImGuiExt::Texture::fromImage(romfs::get("assets/common/donation/github.png").span<std::byte>(), ImGuiExt::Texture::Filter::Linear), "https://github.com/sponsors/WerWolv" },
DonationPage { ImGuiExt::Texture::fromImage(romfs::get("assets/common/donation/patreon.png").span<std::byte>(), ImGuiExt::Texture::Filter::Linear), "https://patreon.com/werwolv" },
DonationPage("assets/common/donation/paypal.png", "https://werwolv.net/donate"),
DonationPage("assets/common/donation/github.png", "https://github.com/sponsors/WerWolv"),
DonationPage("assets/common/donation/patreon.png", "https://patreon.com/werwolv")
};
if (ImGui::BeginTable("DonationLinks", 5, ImGuiTableFlags_SizingStretchSame)) {
@@ -172,9 +176,9 @@ namespace hex::plugin::builtin {
for (const auto &page : DonationPages) {
ImGui::TableNextColumn();
const auto size = page.texture.getSize() / 1.5F;
const auto size = page.texture->getSize() / 1.5F;
const auto startPos = ImGui::GetCursorScreenPos();
ImGui::Image(page.texture, page.texture.getSize() / 1.5F);
ImGui::Image(*page.texture, page.texture->getSize() / 1.5F);
if (ImGui::IsItemHovered()) {
ImGui::GetForegroundDrawList()->AddShadowCircle(startPos + size / 2, size.x / 2, ImGui::GetColorU32(ImGuiCol_Button), 100.0F, ImVec2(), ImDrawFlags_ShadowCutOutShapeBackground);