| 8 | #endif |
| 9 | |
| 10 | ImVec2 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 | |
| 24 | void utils::TextCentered(std::string text, int type = 0) |
| 25 | { |