mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 05:19:02 +08:00
Exposed CalcTextSize(), GetCursorScreenPos() for more advanced fiddling
This commit is contained in:
parent
23d156908d
commit
e807d97089
@ -179,7 +179,6 @@ namespace ImGui
|
||||
static bool ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_hovered, bool* out_held, bool allow_key_modifiers, bool repeat = false);
|
||||
static void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
|
||||
static void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, const bool hide_text_after_hash = true);
|
||||
static ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, const bool hide_text_after_hash = true);
|
||||
static void LogText(const ImVec2& ref_pos, const char* text, const char* text_end = NULL);
|
||||
|
||||
static void ItemSize(ImVec2 size, ImVec2* adjust_start_offset = NULL);
|
||||
@ -2441,6 +2440,12 @@ void SetCursorPos(const ImVec2& pos)
|
||||
window->DC.CursorPos = window->Pos + pos;
|
||||
}
|
||||
|
||||
ImVec2 GetCursorScreenPos()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
return window->DC.CursorPos;
|
||||
}
|
||||
|
||||
void SetScrollPosHere()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
4
imgui.h
4
imgui.h
@ -166,8 +166,9 @@ namespace ImGui
|
||||
float GetColumnOffset(int column_index = -1);
|
||||
void SetColumnOffset(int column_index, float offset);
|
||||
float GetColumnWidth(int column_index = -1);
|
||||
ImVec2 GetCursorPos(); // cursor position is relative to window position
|
||||
ImVec2 GetCursorPos(); // cursor position relative to window position
|
||||
void SetCursorPos(const ImVec2& pos); // "
|
||||
ImVec2 GetCursorScreenPos(); // cursor position in screen space
|
||||
void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match higher widgets.
|
||||
float GetTextLineSpacing();
|
||||
float GetTextLineHeight();
|
||||
@ -251,6 +252,7 @@ namespace ImGui
|
||||
int GetFrameCount();
|
||||
const char* GetStyleColorName(ImGuiCol idx);
|
||||
void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
|
||||
ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, const bool hide_text_after_hash = true);
|
||||
|
||||
}; // namespace ImGui
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user