You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hope to replace them with the screen-pos version, as they will go through unnecessary +- window-pos and window-scroll, and GetCursorPos is said "not the best friend". However, there are no SetCursorScreenPosX/Y counterparts, and it's inconvenient to use SetCursorScreenPos directly as I don't want to care about y-pos.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
staticvoidexample() {
if (ImGui::Begin("Example", 0, ImGuiWindowFlags_NoSavedSettings)) {
for (int i = 0; i < 10; ++i) {
ImGui::Text("%d", i);
ImGui::SameLine();
// (Initially tried this when I tried to simplify a complex conditional Begin/EndGroup.)ImGui::PushID(i);
constfloat cursor_pos = ImGui::GetCursorPosX(); // -> ImGui::GetCursorScreenPosXImGui::Button("AAAAA");
ImGui::SetCursorPosX(cursor_pos); // -> ImGui::SetCursorScreenPosXImGui::Button("BBBBB");
ImGui::PopID();
}
}
ImGui::End();
}
The text was updated successfully, but these errors were encountered:
I have been reluctant to add them because in my experience, almost everytime people use the X/Y it is to add an offset, and therefore the GetCursorPosX() versions are perfectly fine.
However, it does confuse the user and in the name of trying to get people to do the mental switch I should probably add them.
Version/Branch of Dear ImGui:
Version 1.91.2
Back-ends:
imgui_impl_sdl2.cpp + imgui_impl_sdlrenderer2.cpp
Compiler, OS:
Windows 10 + MSVC 2022
Full config/build information:
No response
Details:
Sometimes I will do:
I hope to replace them with the screen-pos version, as they will go through unnecessary +- window-pos and window-scroll, and
GetCursorPos
is said "not the best friend". However, there are noSetCursorScreenPosX/Y
counterparts, and it's inconvenient to useSetCursorScreenPos
directly as I don't want to care about y-pos.Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: