mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Made assertion more clear when trying to call Begin() outside of the NewFrame()..EndFrame() scope. (#1987)
This commit is contained in:
parent
d5400d9517
commit
a7ac9e8346
@ -56,6 +56,7 @@ Other Changes:
|
||||
- IsItemHovered(): Added ImGuiHoveredFlags_AllowWhenDisabled flag to query hovered status on disabled items. (#1940, #211)
|
||||
- Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut]
|
||||
- Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors.
|
||||
- Made assertion more clear when trying to call Begin() outside of the NewFrame()..EndFrame() scope. (#1987)
|
||||
- Fixed horizontal mouse wheel not forwarding the request to the parent window if ImGuiWindowFlags_NoScrollWithMouse is set. (#1463, #1380, #1502)
|
||||
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
||||
- OS/Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
||||
|
@ -3883,6 +3883,7 @@ void ImGui::NewFrame()
|
||||
}
|
||||
|
||||
g.Time += g.IO.DeltaTime;
|
||||
g.FrameScopeActive = true;
|
||||
g.FrameCount += 1;
|
||||
g.TooltipOverrideCount = 0;
|
||||
g.WindowsActiveCount = 0;
|
||||
@ -4421,9 +4422,11 @@ void ImGui::PopClipRect()
|
||||
void ImGui::EndFrame()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame()
|
||||
IM_ASSERT(g.Initialized);
|
||||
if (g.FrameCountEnded == g.FrameCount) // Don't process EndFrame() multiple times.
|
||||
return;
|
||||
IM_ASSERT(g.FrameScopeActive && "Forgot to call ImGui::NewFrame()");
|
||||
g.FrameScopeActive = false;
|
||||
|
||||
// Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)
|
||||
if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f)
|
||||
@ -4508,7 +4511,7 @@ void ImGui::EndFrame()
|
||||
void ImGui::Render()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame()
|
||||
IM_ASSERT(g.Initialized);
|
||||
|
||||
if (g.FrameCountEnded != g.FrameCount)
|
||||
ImGui::EndFrame();
|
||||
@ -6212,7 +6215,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiStyle& style = g.Style;
|
||||
IM_ASSERT(name != NULL); // Window name required
|
||||
IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame()
|
||||
IM_ASSERT(g.FrameScopeActive); // Forgot to call ImGui::NewFrame()
|
||||
IM_ASSERT(g.FrameCountEnded != g.FrameCount); // Called ImGui::Render() or ImGui::EndFrame() and haven't called ImGui::NewFrame() again yet
|
||||
|
||||
// Find or create
|
||||
|
@ -608,6 +608,7 @@ struct ImGuiNextWindowData
|
||||
struct ImGuiContext
|
||||
{
|
||||
bool Initialized;
|
||||
bool FrameScopeActive; // Set by NewFrame(), cleared by EndFrame()/Render()
|
||||
bool FontAtlasOwnedByContext; // Io.Fonts-> is owned by the ImGuiContext and will be destructed along with it.
|
||||
ImGuiIO IO;
|
||||
ImGuiStyle Style;
|
||||
@ -761,6 +762,7 @@ struct ImGuiContext
|
||||
ImGuiContext(ImFontAtlas* shared_font_atlas) : OverlayDrawList(NULL)
|
||||
{
|
||||
Initialized = false;
|
||||
FrameScopeActive = false;
|
||||
Font = NULL;
|
||||
FontSize = FontBaseSize = 0.0f;
|
||||
FontAtlasOwnedByContext = shared_font_atlas ? false : true;
|
||||
|
Loading…
Reference in New Issue
Block a user