diff --git a/.vscode/launch.json b/.vscode/launch.json index 337fe0f..8d2f06c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,10 +20,10 @@ "name": "Launch SA", "type": "cppvsdbg", "request": "launch", - "program": "F:/GTA San Andreas/gta_sa.exe", + "program": "D:/Games/GTA San Andreas/gta_sa.exe", "args": [], "stopAtEntry": false, - "cwd": "F:/GTA San Andreas/", + "cwd": "D:/Games/GTA San Andreas/", "environment": [], "console": "internalConsole" }, diff --git a/src/opcodemgr.cpp b/src/opcodemgr.cpp index bfcb079..c9e2c30 100644 --- a/src/opcodemgr.cpp +++ b/src/opcodemgr.cpp @@ -3,6 +3,7 @@ #include #include "texturemgr.h" #include "wrapper.hpp" +#include "imgui_internal.h" static RTN_TYPE RUNTIME_API ImGuiBegin(RUNTIME_CONTEXT ctx) { char label[RUNTIME_STR_LEN]; @@ -61,13 +62,17 @@ static RTN_TYPE RUNTIME_API ImGuiImageButton(RUNTIME_CONTEXT ctx) { // FIX: // Due to an issue textures aren't loaded in LoadImage but on ImageButton first call - if (pInfo && TextureMgr::Exists(pInfo)) { + + if (!pInfo->pTexture && TextureMgr::Exists(pInfo)) { TextureMgr::LoadTexture(*pInfo); } ScriptExData* data = ScriptExData::Get(); data->imgui += [=]() { - bool isPressed = ImGui::ImageButton(pInfo->pTexture, ImVec2(size.x, size.y), ImVec2(0, 0), ImVec2(1, 1), 0, data->imgui.m_ImGCol.m_fBgCol, data->imgui.m_ImGCol.m_fTintCol); + ImGui::PushID(buf); + const ImGuiID id = ImGui::GetID(buf); + bool isPressed = ImGui::ImageButtonEx(id, pInfo->pTexture, size, {0.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}, data->imgui.m_ImGCol.m_fBgCol, data->imgui.m_ImGCol.m_fTintCol); + ImGui::PopID(); data->SetData(buf, 0, isPressed); }; diff --git a/src/texturemgr.cpp b/src/texturemgr.cpp index 4cb69fc..fab7825 100644 --- a/src/texturemgr.cpp +++ b/src/texturemgr.cpp @@ -88,7 +88,8 @@ TextureInfo* TextureMgr::LoadTextureFromPath(const char *path) { TextureInfo info; info.path = std::string(path); info.pTexture = nullptr; - LoadTexture(info); + // FIX ME + // LoadTexture(info); textureList.push_back(std::move(info)); return &textureList.back(); } diff --git a/tools/Setup.bat b/tools/Setup.bat index 9c2f6d0..fa18ec2 100644 --- a/tools/Setup.bat +++ b/tools/Setup.bat @@ -2,7 +2,7 @@ rem Generate visual studio files and run the devcmd init @echo off rem Set game paths below -set "OUT_DIR="F:/GTA San Andreas/"" +set "OUT_DIR="D:/Games/GTA San Andreas/"" cd tools premake5.exe vs2022