MCPcopy Create free account
hub / github.com/Raais/ImStudio / GetLocalCursor

Method GetLocalCursor

src/utils/ims_utils.cpp:10–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#endif
9
10ImVec2 utils::GetLocalCursor()
11{
12 ImGuiIO & io = ImGui::GetIO();
13 ImGuiContext &g = *ImGui::GetCurrentContext();
14 ImGuiWindow * w = g.CurrentWindow;
15 ImVec2 cursor = ImVec2(io.MousePos.x - w->Pos.x, io.MousePos.y - w->Pos.y);
16 ImRect itemrect = ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
17 float itemwidth = itemrect.Max.x - itemrect.Min.x;
18 float itemheight = itemrect.Max.y - itemrect.Min.y;
19 cursor.x -= itemwidth / 2;
20 cursor.y -= itemheight / 2;
21 return cursor;
22}
23
24void utils::TextCentered(std::string text, int type = 0)
25{

Callers

nothing calls this directly

Calls 2

ImVec2Function · 0.85
ImRectFunction · 0.50

Tested by

no test coverage detected