mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
fix: Texture loading from romfs
This commit is contained in:
@@ -527,10 +527,7 @@ namespace hex::plugin::builtin {
|
||||
static std::mutex addressMutex;
|
||||
static TaskHolder addressTask;
|
||||
|
||||
static auto mapTexture = [] {
|
||||
auto image = romfs::get("assets/common/map.jpg");
|
||||
return ImGui::Texture(reinterpret_cast<const ImU8 *>(image.data()), image.size());
|
||||
}();
|
||||
static auto mapTexture = ImGui::Texture(romfs::get("assets/common/map.jpg").span());
|
||||
static ImVec2 mapSize = scaled(ImVec2(500, 500 / mapTexture.getAspectRatio()));
|
||||
|
||||
if (shouldReset) {
|
||||
|
||||
@@ -33,8 +33,6 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.menu.help.ask_for_help" }, 4000, CTRLCMD + SHIFT + Keys::D, [] {
|
||||
PopupDocsQuestion::open();
|
||||
});
|
||||
|
||||
this->m_logoTexture = ImGui::Texture(romfs::get("assets/common/logo.png").span());
|
||||
}
|
||||
|
||||
static void link(const std::string &name, const std::string &author, const std::string &url) {
|
||||
@@ -63,6 +61,9 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
// Draw the ImHex icon
|
||||
if (!this->m_logoTexture.isValid())
|
||||
this->m_logoTexture = ImGui::Texture(romfs::get("assets/common/logo.png").span());
|
||||
|
||||
ImGui::Image(this->m_logoTexture, scaled({ 64, 64 }));
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
|
||||
@@ -422,9 +422,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
(void)EventManager::subscribe<RequestChangeTheme>([](const std::string &theme) {
|
||||
auto changeTexture = [&](const std::string &path) {
|
||||
auto textureData = romfs::get(path);
|
||||
|
||||
return ImGui::Texture(reinterpret_cast<const ImU8*>(textureData.data()), textureData.size());
|
||||
return ImGui::Texture(romfs::get(path).span());
|
||||
};
|
||||
|
||||
ThemeManager::changeTheme(theme);
|
||||
|
||||
Reference in New Issue
Block a user