fabric-imgui-example-mod
fabric-imgui-example-mod copied to clipboard
How can i open my imgui menu without any opened minecraft menu?
How can i open my imgui menu without any opened minecraft menu?
I don't really know whether your goal is to only remove the background appearing when opening screens ingame (which would be done by removing the super.render in the render method or if you want custom viewports so you can drag out the imgui window outside of MC, for that there is a tutorial on imguis github repository.
I don't really know whether your goal is to only remove the background appearing when opening screens ingame (which would be done by removing the super.render in the render method or if you want custom viewports so you can drag out the imgui window outside of MC, for that there is a tutorial on imguis github repository.
No, you misunderstood me. I want to open Imgui menu directly in the game on the server. I am newbie, and don't know how can i do it
I am not sure if it's possible to open ImGui without having a minecraft screen as backend, at least not if you want proper mouse interactions.
I am not sure if this is what you are getting at by minecraft "menu", but you can mixin to the InGameHud class, and draw your ImGui window(s) there.
How can i open my imgui menu without any opened minecraft menu?
@Mixin(InGameHud.class)
public class Window {
@Inject(method = "render", at = @At("RETURN"))
private void render(DrawContext context, float tickDelta, CallbackInfo ci) {
ImGuiImpl.draw(io -> {
if(ImGui.begin("Hello World", ImGuiWindowFlags.MenuBar)) {
ImGui.setWindowSize(200, 200);
if (ImGui.beginMenuBar())
{
if (ImGui.beginMenu("File"))
{
if (ImGui.menuItem("Open..", "Ctrl+O")) { /* Do stuff */ }
if (ImGui.menuItem("Save", "Ctrl+S")) { /* Do stuff */ }
if (ImGui.menuItem("Close", "Ctrl+W")) { }
ImGui.endMenu();
}
ImGui.endMenuBar();
}
ImString ms = new ImString("wqe");
float f = 0;
ImGui.text("Hello, world %d");
if (ImGui.button("Save")) {
}
ImGui.inputText("string", ms);
ImGui.end();
}
});
}
}
This should work, although I don't see why you would want that since you can't interact with it in game.
you can have it display stuff, like I have the gizmo display a view of the world in my hud, you can interact with it in screens like chat aswell when mixed into the ingame hud
How does the Gizmo of the world looks like? I'm curious
You can post it into https://github.com/FlorianMichael/fabric-imgui-example-mod/issues/5