Documentation bits. Misc comments.
This commit is contained in:
parent
58fd8ea303
commit
d1c16d4ccd
6
.github/CONTRIBUTING.md
vendored
6
.github/CONTRIBUTING.md
vendored
@ -13,12 +13,12 @@ You may use the Issue Tracker to submit bug reports, feature requests or suggest
|
|||||||
- If you get a assert, use a debugger to locate the line triggering it and read the comments around the assert.
|
- If you get a assert, use a debugger to locate the line triggering it and read the comments around the assert.
|
||||||
|
|
||||||
**Guidelines to report an issue or ask a question:**
|
**Guidelines to report an issue or ask a question:**
|
||||||
- Try to provide a Minimal, Complete and Verifiable Example ([MCVE](https://stackoverflow.com/help/mcve)) to demonstrate your problem. An ideal submission includes a small piece of code that anyone can paste in one of the examples/ application to understand and reproduce it. Narrowing your problem to its shortest and purest form is often the easiest way to understand it. Often while creating the MCVE you will end up solving the problem!
|
|
||||||
- Try to attach screenshots to clarify the context. They often convey useful information that are omitted by the description. You can drag pictures/files here (prefer github attachments over 3rd party hosting).
|
|
||||||
- If you are discussing an assert or a crash, please provide a debugger callstack.
|
|
||||||
- Please provide your imgui version number.
|
- Please provide your imgui version number.
|
||||||
|
- If you are discussing an assert or a crash, please provide a debugger callstack.
|
||||||
- Please state if you have made substantial modifications to your copy of imgui.
|
- Please state if you have made substantial modifications to your copy of imgui.
|
||||||
- When discussing issues related to rendering or inputs, please state which OS you are using, and if you are using a vanilla copy of one of the back end (imgui_impl_xxx files), or a modified one, or if you built your own.
|
- When discussing issues related to rendering or inputs, please state which OS you are using, and if you are using a vanilla copy of one of the back end (imgui_impl_xxx files), or a modified one, or if you built your own.
|
||||||
|
- Try to provide a Minimal, Complete and Verifiable Example ([MCVE](https://stackoverflow.com/help/mcve)) to demonstrate your problem. An ideal submission includes a small piece of code that anyone can paste in one of the examples/ application to understand and reproduce it. Narrowing your problem to its shortest and purest form is often the easiest way to understand it. Often while creating the MCVE you will end up solving the problem!
|
||||||
|
- Try to attach screenshots to clarify the context. They often convey useful information that are omitted by the description. You can drag pictures/files here (prefer github attachments over 3rd party hosting).
|
||||||
- When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
- When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||||
- Due to frequent abuse of this service from a certain category of users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and less patience for incomplete questions.
|
- Due to frequent abuse of this service from a certain category of users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and less patience for incomplete questions.
|
||||||
|
|
||||||
|
6
TODO.txt
6
TODO.txt
@ -172,6 +172,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- text: proper alignment options in imgui_internal.h
|
- text: proper alignment options in imgui_internal.h
|
||||||
- text wrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (#249)
|
- text wrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (#249)
|
||||||
- text: it's currently impossible to have a window title with "##". perhaps an official workaround would be nice. \ style inhibitor? non-visible ascii code to insert between #?
|
- text: it's currently impossible to have a window title with "##". perhaps an official workaround would be nice. \ style inhibitor? non-visible ascii code to insert between #?
|
||||||
|
- text: provided a framed text helper, e.g. https://pastebin.com/1Laxy8bT
|
||||||
- text link/url button: underlined. should api expose an ID or use text contents as ID? which colors enum to use?
|
- text link/url button: underlined. should api expose an ID or use text contents as ID? which colors enum to use?
|
||||||
|
|
||||||
- tree node / optimization: avoid formatting when clipped.
|
- tree node / optimization: avoid formatting when clipped.
|
||||||
@ -188,6 +189,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- stb: add defines to disable stb implementations
|
- stb: add defines to disable stb implementations
|
||||||
|
|
||||||
!- style: better default styles. (#707)
|
!- style: better default styles. (#707)
|
||||||
|
- style: add a highlighted text color (for headers, etc.)
|
||||||
- style: border types: out-screen, in-screen, etc. (#447)
|
- style: border types: out-screen, in-screen, etc. (#447)
|
||||||
- style/optimization: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding.
|
- style/optimization: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding.
|
||||||
- style: add window shadow (fading away from the window. Paint-style calculation of vertices alpha after drawlist would be easier)
|
- style: add window shadow (fading away from the window. Paint-style calculation of vertices alpha after drawlist would be easier)
|
||||||
@ -222,6 +224,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- font: better vertical centering (based e.g on height of lowercase 'x'?). currently Roboto-Medium size 16 px isn't currently centered. (#1619)
|
- font: better vertical centering (based e.g on height of lowercase 'x'?). currently Roboto-Medium size 16 px isn't currently centered. (#1619)
|
||||||
- font: free the Alpha buffer if user only requested RGBA.
|
- font: free the Alpha buffer if user only requested RGBA.
|
||||||
!- font: better CalcTextSizeA() API, at least for simple use cases. current one is horrible (perhaps have simple vs extended versions).
|
!- font: better CalcTextSizeA() API, at least for simple use cases. current one is horrible (perhaps have simple vs extended versions).
|
||||||
|
- font: a CalcTextHeight() helper could run faster than CalcTextSize().y
|
||||||
- font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX
|
- font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX
|
||||||
- font: finish CustomRectRegister() to allow mapping unicode codepoint to custom texture data
|
- font: finish CustomRectRegister() to allow mapping unicode codepoint to custom texture data
|
||||||
- font: PushFontSize API (#1018)
|
- font: PushFontSize API (#1018)
|
||||||
@ -262,8 +265,9 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- misc: idle refresh: expose cursor blink animation timer for backend to be able to lower framerate.
|
- misc: idle refresh: expose cursor blink animation timer for backend to be able to lower framerate.
|
||||||
- misc: make the ImGuiCond values linear (non-power-of-two). internal storage for ImGuiWindow can use integers to combine into flags (Why?)
|
- misc: make the ImGuiCond values linear (non-power-of-two). internal storage for ImGuiWindow can use integers to combine into flags (Why?)
|
||||||
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
||||||
- misc: fix for compilation settings where stdcall isn't the default (e.g. vectorcall) (#1230)
|
|
||||||
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
|
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
|
||||||
|
- misc: use more size_t in public api?
|
||||||
|
- misc: ImVector: erase_unsorted() helper
|
||||||
|
|
||||||
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
|
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
|
||||||
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
|
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
|
||||||
|
18
imgui.cpp
18
imgui.cpp
@ -4516,12 +4516,11 @@ static ImGuiWindow* FindHoveredWindow()
|
|||||||
bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip)
|
bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
|
||||||
|
|
||||||
// Clip
|
// Clip
|
||||||
ImRect rect_clipped(r_min, r_max);
|
ImRect rect_clipped(r_min, r_max);
|
||||||
if (clip)
|
if (clip)
|
||||||
rect_clipped.ClipWith(window->ClipRect);
|
rect_clipped.ClipWith(g.CurrentWindow->ClipRect);
|
||||||
|
|
||||||
// Expand for touch input
|
// Expand for touch input
|
||||||
const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding);
|
const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding);
|
||||||
@ -6172,12 +6171,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->DC.NavLayerCurrentMask >>= 1;
|
window->DC.NavLayerCurrentMask >>= 1;
|
||||||
window->DC.ItemFlags = item_flags_backup;
|
window->DC.ItemFlags = item_flags_backup;
|
||||||
|
|
||||||
// Title text (FIXME: refactor text alignment facilities along with RenderText helpers)
|
// Title text (FIXME: refactor text alignment facilities along with RenderText helpers, this is too much code for what it does.)
|
||||||
ImVec2 text_size = CalcTextSize(name, NULL, true);
|
ImVec2 text_size = CalcTextSize(name, NULL, true);
|
||||||
ImRect text_r = title_bar_rect;
|
ImRect text_r = title_bar_rect;
|
||||||
float pad_left = (flags & ImGuiWindowFlags_NoCollapse) == 0 ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : style.FramePadding.x;
|
float pad_left = (flags & ImGuiWindowFlags_NoCollapse) ? style.FramePadding.x : (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x);
|
||||||
float pad_right = (p_open != NULL) ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : style.FramePadding.x;
|
float pad_right = (p_open == NULL) ? style.FramePadding.x : (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x);
|
||||||
if (style.WindowTitleAlign.x > 0.0f) pad_right = ImLerp(pad_right, pad_left, style.WindowTitleAlign.x);
|
if (style.WindowTitleAlign.x > 0.0f)
|
||||||
|
pad_right = ImLerp(pad_right, pad_left, style.WindowTitleAlign.x);
|
||||||
text_r.Min.x += pad_left;
|
text_r.Min.x += pad_left;
|
||||||
text_r.Max.x -= pad_right;
|
text_r.Max.x -= pad_right;
|
||||||
ImRect clip_rect = text_r;
|
ImRect clip_rect = text_r;
|
||||||
@ -6200,7 +6200,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
|
|
||||||
// Inner rectangle
|
// Inner rectangle
|
||||||
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
||||||
// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.
|
// Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.
|
||||||
window->InnerRect.Min.x = title_bar_rect.Min.x + window->WindowBorderSize;
|
window->InnerRect.Min.x = title_bar_rect.Min.x + window->WindowBorderSize;
|
||||||
window->InnerRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
|
window->InnerRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
|
||||||
window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - window->WindowBorderSize;
|
window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - window->WindowBorderSize;
|
||||||
@ -6214,7 +6214,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize)));
|
window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize)));
|
||||||
window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y);
|
window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y);
|
||||||
|
|
||||||
// After Begin() we fill the last item / hovered data using the title bar data. Make that a standard behavior (to allow usage of context menus on title bar only, etc.).
|
// After Begin() we fill the last item / hovered data based on title bar data. It is a standard behavior (to allow creation of context menus on title bar only, etc.).
|
||||||
window->DC.LastItemId = window->MoveId;
|
window->DC.LastItemId = window->MoveId;
|
||||||
window->DC.LastItemStatusFlags = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0;
|
window->DC.LastItemStatusFlags = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0;
|
||||||
window->DC.LastItemRect = title_bar_rect;
|
window->DC.LastItemRect = title_bar_rect;
|
||||||
@ -6230,7 +6230,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
g.NextWindowData.SizeConstraintCond = 0;
|
g.NextWindowData.SizeConstraintCond = 0;
|
||||||
|
|
||||||
// Child window can be out of sight and have "negative" clip windows.
|
// Child window can be out of sight and have "negative" clip windows.
|
||||||
// Mark them as collapsed so commands are skipped earlier (we can't manually collapse because they have no title bar).
|
// Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).
|
||||||
if (flags & ImGuiWindowFlags_ChildWindow)
|
if (flags & ImGuiWindowFlags_ChildWindow)
|
||||||
{
|
{
|
||||||
IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
|
IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
|
||||||
|
@ -81,7 +81,7 @@ In this document:
|
|||||||
- Mind the fact that some graphics drivers have texture size limitation.
|
- Mind the fact that some graphics drivers have texture size limitation.
|
||||||
- Set io.Fonts.TexDesiredWidth to specify a texture width to minimize texture height (see comment in ImFontAtlas::Build function).
|
- Set io.Fonts.TexDesiredWidth to specify a texture width to minimize texture height (see comment in ImFontAtlas::Build function).
|
||||||
- Set io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight; to disable rounding the texture height to the next power of two.
|
- Set io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight; to disable rounding the texture height to the next power of two.
|
||||||
- You may reduce oversampling, e.g. config.OversampleH = 2 or 1.
|
- You may reduce oversampling, e.g. config.OversampleH = 1, this will largely reduce your textue size.
|
||||||
- Reduce glyphs ranges, consider calculating them based on your source data if this is possible.
|
- Reduce glyphs ranges, consider calculating them based on your source data if this is possible.
|
||||||
|
|
||||||
Combine two fonts into one:
|
Combine two fonts into one:
|
||||||
|
Loading…
Reference in New Issue
Block a user