guilhermerk Posted August 12, 2021 Share Posted August 12, 2021 Hi, I'm trying to implement imgui with plugin-sdk but I can't get it to work and I can't find any errors in my code bool showWindow = false; void GameProcess() { static int lastKeyPressTime = 0; if(plugin::KeyPressed('G') && CTimer::m_snTimeInMilliseconds - lastKeyPressTime >= 500) { lastKeyPressTime = CTimer::m_snTimeInMilliseconds; showWindow = !showWindow; if(showWindow) CMessages::AddMessageJumpQ("showWindow = true", 1000, 0, false); else CMessages::AddMessageJumpQ("showWindow = false", 1000, 0, false); } } void Init() { IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGui::StyleColorsDark(); ImGui_ImplWin32_Init((HWND *)0xC97C1C); ImGui_ImplDX9_Init((IDirect3DDevice9 *)RwD3D9GetCurrentD3DDevice()); } void Draw() { ImGui_ImplDX9_NewFrame(); ImGui_ImplWin32_NewFrame(); ImGui::NewFrame(); if(showWindow) { ImGui::Begin("Test", &showWindow); ImGui::Text("Hello World"); ImGui::End(); } ImGui::EndFrame(); ImGui::Render(); ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); } void Free() { ImGui_ImplDX9_Shutdown(); ImGui_ImplWin32_Shutdown(); ImGui::DestroyContext(); } __attribute__((constructor)) void Constructor() { plugin::Events::initRwEvent += Init; plugin::Events::drawingEvent += Draw; plugin::Events::shutdownRwEvent += Free; plugin::Events::d3dLostEvent += Free; plugin::Events::d3dResetEvent += Init; plugin::Events::gameProcessEvent += GameProcess; } Link to comment Share on other sites More sharing options...
FR4M3 Posted August 14, 2021 Share Posted August 14, 2021 You might wanna ask the Ruskies at Blast.hk Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now