psydack / uimgui

UImGui (Unity ImGui) is an UPM package for the immediate mode GUI library using ImGui.NET. This project is based on RG.ImGui project.
MIT License
351 stars 56 forks source link

Render without a window #55

Closed SachsKaylee closed 8 months ago

SachsKaylee commented 9 months ago

Hello, we are currently investigating using this library as our main UI solution in our current game. We have so far been using the native Unity IMGUI solution, but are hitting a lot of bugs/issues/missing features with it that would take a very significant amount of time to fix or implement. We have decided to use a non-retain mode for our UI to simplfy development due to not having to write as much UI glue code.

Integrating this project worked flawlessly, however I've noticed that all UI calls are always drawn within windows. While this is a nice feature we will certainly be utulizing for several aspects of the game, we would require the main UI to be drawn directly on screen, without a window wrapping around it.

How can this be achieved with this library?

Thank you for your time!

psydack commented 8 months ago

Hey thanks for using :D

One way to achieve it is creating a simple overlay image

ImGuiWindowFlags flags = ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoDocking | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoMove;
if (ImGui.Begin("Example: Simple overlay", flags))
{
    ImGui.Text("Simple overlay\n (right-click to change position)");
    ImGui.Separator();
    if (ImGui.IsMousePosValid()) {
        var io = ImGui.GetIO();
        ImGui.Text($"Mouse Position: ({io.MousePos.x}, {io.MousePos.y})");
    }
    else {
        ImGui.Text("Mouse Position: <invalid>");
    }
}

Do you have a reference what you want to do?