#include "imgui.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl3.h"
// Initialize ImGui
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
(void)io;
ImGui::StyleColorsDark();
// Load the image data from a byte array
const unsigned char* imageData = ...;
int imageWidth = ...;
int imageHeight = ...;
ImTextureID texture = 0;
// Create the ImTextureID object from the image data
ImDrawListSharedData* sharedData = ImGui::GetDrawListSharedData();
if (sharedData)
{
texture = sharedData->MemoryCompressImTextureID(imageData, imageWidth, imageHeight);
}
while (true)
{
// Begin a new ImGui frame
ImGui::NewFrame();
// Create the menu
ImGui::Begin("Menu", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
// Get the ImDrawList for the current window
ImDrawList* drawList = ImGui::GetBackgroundDrawList();
// Add the image to the draw list
ImVec2 pos = ImGui::GetWindowPos();
ImVec2 size = ImGui::GetWindowSize();
drawList->AddImage(texture, pos, ImVec2(pos.x + size.x, pos.y + size.y));
// Add menu items here...
ImGui::End();
// Render the ImGui widgets
ImGui::Render();
}