Hey people, nop here, i can't tell for sure if this will work in all games but in the ones I've tried it has.
I don't have a PC as of the time I'm writing this so i won't be able to provide much images but hopefully a good explanation can still be done.
To use ImGui in your mods you must first make your UI, unlike with Java Menus you must make your own OpenGL3 ( or OpenGL2 if that's the case ) Environment, you can just use the example from github for this, this is needed to design your UI and test it to see how it looks.
I recommend putting the code you need such as initialization and UI Design close to each other and organized to easily copy it into your hook.
Next up we need to make a hook to SwapBuffers ( Sometimes it's AppDraw, depends ), to do this we do what we would go about in normal hooking, the old function, then the new function and finally Hook, except instead of hooking to an address, we hook to a Symbol, this is because AppDraw and SwapBuffers are symbols.
Here's an example of a simple ImGui hook i just wrote.
Finally, we hook the symbol and use our functions we wrote such as the ones in the above example.
To hook a Symbol you either make your own hooking tool or use the one provided by LGL Mod Menu in the Macros.h file, called HOOKSYM.
I don't have a PC as of the time I'm writing this so i won't be able to provide much images but hopefully a good explanation can still be done.
To use ImGui in your mods you must first make your UI, unlike with Java Menus you must make your own OpenGL3 ( or OpenGL2 if that's the case ) Environment, you can just use the example from github for this, this is needed to design your UI and test it to see how it looks.
I recommend putting the code you need such as initialization and UI Design close to each other and organized to easily copy it into your hook.
Next up we need to make a hook to SwapBuffers ( Sometimes it's AppDraw, depends ), to do this we do what we would go about in normal hooking, the old function, then the new function and finally Hook, except instead of hooking to an address, we hook to a Symbol, this is because AppDraw and SwapBuffers are symbols.
Here's an example of a simple ImGui hook i just wrote.
C++:
static bool init{ false }; // initiliazation checker
void (*old_swapbuffersHook)();
void swapbuffersHook()
{
if (!init)
{
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.IniFilename = NULL; //recommended
ImGui::GetStyle().WindowRounding = 12.0f; // Makes the UI Rounded
ImGui_ImplAndroid_Init(NULL);
ImGui_ImplOpenGL3_Init("#version 100"); // Initiates backends
ImFontConfig font_cfg;
font_cfg.SizePixels = 22.0f;
io.Fonts->AddFontDefault(&font_cfg); // loads default font, if you wanna add one, look at the documentation of ImGui
init = true;
}
// After initialization is done, we begin drawing
ImGuiIO& io = ImGui::GetIO();
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplAndroid_NewFrame(getSSX(), getSSY()); // the parameters are functions for getting screen size
ImGui::NewFrame(); // makes new frames to draw on
ImGui::Begin("PlatinMods Tuto"); // No flags cuz im not gonna make something complicated
ImGui::Text("PMT is epicly epic"); // Makes a new TextLabel
ImGui::End(); // ends drawing
ImGui::Render(); // renders the imgui
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
old_swapbuffershook();
}
To hook a Symbol you either make your own hooking tool or use the one provided by LGL Mod Menu in the Macros.h file, called HOOKSYM.
C++:
HOOKSYM_LIB("libroblox.so", "__imp_eglSwapBuffers", (void *) swapbuffersHook, (void **)&old_swapbuffersHook);
Last edited: