diff --git a/imgui.cpp b/imgui.cpp index df386da1..59c50755 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -129,6 +129,7 @@ Occasionally introducing changes that are breaking the API. The breakage are generally minor and easy to fix. Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code. + - 2015/02/08 (1.31) - renamed GetTextLineSpacing() to GetTextLineHeightWithSpacing() - 2015/02/01 (1.31) - removed IO.MemReallocFn (unused) - 2015/01/19 (1.30) - renamed ImGuiStorage::GetIntPtr()/GetFloatPtr() to GetIntRef()/GetIntRef() because Ptr was conflicting with actual pointer storage functions. - 2015/01/11 (1.30) - big font/image API change! now loads TTF file. allow for multiple fonts. no need for a PNG loader. @@ -3294,7 +3295,7 @@ float ImGui::GetTextLineHeight() return window->FontSize(); } -float ImGui::GetTextLineSpacing() +float ImGui::GetTextLineHeightWithSpacing() { ImGuiState& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -3333,6 +3334,16 @@ ImVec2 ImGui::GetCursorPos() return window->DC.CursorPos - window->Pos; } +float ImGui::GetCursorPosX() +{ + return ImGui::GetCursorPos().x; +} + +float ImGui::GetCursorPosY() +{ + return ImGui::GetCursorPos().y; +} + void ImGui::SetCursorPos(const ImVec2& pos) { ImGuiWindow* window = GetCurrentWindow(); @@ -8502,7 +8513,7 @@ struct ExampleAppConsole // Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end()); // NB- if you have lots of text this approach may be too inefficient. You can seek and display only the lines that are on display using a technique similar to what TextUnformatted() does, // or faster if your entries are already stored into a table. - ImGui::BeginChild("ScrollingRegion", ImVec2(0,-ImGui::GetTextLineSpacing()*2)); + ImGui::BeginChild("ScrollingRegion", ImVec2(0,-ImGui::GetTextLineHeightWithSpacing()*2)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing for (size_t i = 0; i < Items.size(); i++) { diff --git a/imgui.h b/imgui.h index ff88a634..fed27ab0 100644 --- a/imgui.h +++ b/imgui.h @@ -166,7 +166,7 @@ namespace ImGui IMGUI_API ImVec2 GetWindowContentRegionMax(); IMGUI_API ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives. IMGUI_API ImFont* GetWindowFont(); - IMGUI_API float GetWindowFontSize(); + IMGUI_API float GetWindowFontSize(); // size (also height in pixels) of current font with current scale applied IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows. IMGUI_API ImVec2 GetWindowPos(); // you should rarely need/care about the window position, but it can be useful if you want to do your own drawing. IMGUI_API ImVec2 GetWindowSize(); // get current window position. @@ -218,14 +218,16 @@ namespace ImGui IMGUI_API void SetColumnOffset(int column_index, float offset); IMGUI_API float GetColumnWidth(int column_index = -1); IMGUI_API ImVec2 GetCursorPos(); // cursor position is relative to window position + IMGUI_API float GetCursorPosX(); // " + IMGUI_API float GetCursorPosY(); // " IMGUI_API void SetCursorPos(const ImVec2& pos); // " IMGUI_API void SetCursorPosX(float x); // " IMGUI_API void SetCursorPosY(float y); // " IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute screen coordinates (0..io.DisplaySize) IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute screen coordinates (0..io.DisplaySize) IMGUI_API void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets. - IMGUI_API float GetTextLineSpacing(); - IMGUI_API float GetTextLineHeight(); + IMGUI_API float GetTextLineHeight(); // height of font == GetWindowFontSize() + IMGUI_API float GetTextLineHeightWithSpacing(); // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y // ID scopes // If you are creating repeated widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them.