Drawing inside groupbox starts 3 pixels after the left edge

#1

Hello, Im using dear imgui and im currently trying to make some modifications to the group boxes. I want the group box to have a bar on the very top of it. I tried drawing filled rect:
indent preformatted text by 4 spaces
float x1 = window->Pos.x;
float x2 = window->Pos.x+ size_arg.x;
const ImRect bb(ImVec2(x1, 0), ImVec2(x2, window->DC.CursorPos.y));

	window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Separator));
indent preformatted text by 4 spaces

But when I do that the filled rect is offseted to the right by about 3 pixels. Why is that?
i%20dont%20even%20know%20anymore

Edit: This code is written in the BeginGroupBox function. Also the white is the groupbox and the orange is the rectangle im trying to draw.

#2

There’s no BeginGroupBox() function in dear imgui. Please get support at the same cheating place you got the code you are using.

#3

It is hard to believe that something so good is made by such a cunt.

#4

Thanks for the compliment. It’s hard to believe you are referring to a function not provided in dear imgui, not providing any useful details, and expect to get your code magically fixed.

#5

Sorry, I didnt mean that. And also sorry that your imgui is often associated with people making cheats. Honestly imgui is such a wonderful rendering solution for menus. I would write my own but im not experienced enough with directx yet. Im sorry that Im using imgui for a game cheat, but I wanted to practice my c++ skills in other areas. Also im not of those pasting piece of shits that come here to get a pasteable solutions. The imgui im using is from a “cheat base” and I didnt know what is a part of imgui and what isnt. Also I asked this question because I want to modify imgui to my liking and not have anything in common with what I started with in this so called “cheat base/sdk”. Again im truly sorry for my offensive language.

1 Like
#6

My intuition is that most likely your shape is being masked out by the active clipping rectangle.
Each draw command has a clipping rectangle. If you use the Metrics window you can browse each ImDrawCmd and see the clipping rectangle, you can also use Metrics>Tools->Show window rectangles (although that is only in recent version and may not be in your version) to visualize the main clipping rectangle to understand what’s going on.

You can use PushClipRect()/PopClipRect() to alter the clipping rectangle if you want to draw past that limit, or more simply you can probably set WindowPadding.x to 0.0 before calling Begin, so PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0,0)) / Begin() / ... / End() / PopStyleVar() as by the inner clipping rectangle is generally based on the window rectangle + half window padding.

#7

I will try what you suggested about the padding and I will probably rewrite that begingroupbox thing someone wrote so badly. Thank you for helping me I dont really deserve help after insulting you for not helping someone you tought was another one of those pasting kids that just want to get their pasted abomination to work. Thank you :slight_smile:

1 Like