mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-23 12:27:01 +00:00
Comments (#209)
This commit is contained in:
parent
fbbe7fee53
commit
13c3f11c66
11
imgui.cpp
11
imgui.cpp
@ -2190,17 +2190,17 @@ void ImGui::Render()
|
|||||||
|
|
||||||
if (first_render_of_the_frame)
|
if (first_render_of_the_frame)
|
||||||
{
|
{
|
||||||
// Hide implicit window if it hasn't been used
|
// Hide implicit "Debug" window if it hasn't been used
|
||||||
IM_ASSERT(g.CurrentWindowStack.size() == 1); // Mismatched Begin/End
|
IM_ASSERT(g.CurrentWindowStack.size() == 1); // Mismatched Begin/End
|
||||||
if (g.CurrentWindow && !g.CurrentWindow->Accessed)
|
if (g.CurrentWindow && !g.CurrentWindow->Accessed)
|
||||||
g.CurrentWindow->Active = false;
|
g.CurrentWindow->Active = false;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
|
// Click to focus window and start moving (after we're done with all our widgets)
|
||||||
if (g.ActiveId == 0 && g.HoveredId == 0 && g.IO.MouseClicked[0])
|
if (g.ActiveId == 0 && g.HoveredId == 0 && g.IO.MouseClicked[0])
|
||||||
{
|
{
|
||||||
if (g.HoveredRootWindow != NULL)
|
if (g.HoveredRootWindow != NULL)
|
||||||
{
|
{
|
||||||
// Select window for move/focus when we're done with all our widgets (we use the root window ID here)
|
|
||||||
IM_ASSERT(g.MovedWindow == NULL);
|
IM_ASSERT(g.MovedWindow == NULL);
|
||||||
g.MovedWindow = g.HoveredWindow;
|
g.MovedWindow = g.HoveredWindow;
|
||||||
SetActiveId(g.HoveredRootWindow->MoveID);
|
SetActiveId(g.HoveredRootWindow->MoveID);
|
||||||
@ -2227,19 +2227,18 @@ void ImGui::Render()
|
|||||||
IM_ASSERT(g.Windows.size() == g.WindowsSortBuffer.size()); // we done something wrong
|
IM_ASSERT(g.Windows.size() == g.WindowsSortBuffer.size()); // we done something wrong
|
||||||
g.Windows.swap(g.WindowsSortBuffer);
|
g.Windows.swap(g.WindowsSortBuffer);
|
||||||
|
|
||||||
// Clear data for next frame
|
// Clear Input data for next frame
|
||||||
g.IO.MouseWheel = 0.0f;
|
g.IO.MouseWheel = 0.0f;
|
||||||
memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));
|
memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip render altogether if alpha is 0.0
|
// Skip render altogether if alpha is 0.0
|
||||||
// Note that vertex buffers have been created, so it is best practice that you don't call Begin/End in the first place.
|
// Note that vertex buffers have been created, so it is best practice that you don't create windows in the first place, or respond to Begin() returning false
|
||||||
if (g.Style.Alpha > 0.0f)
|
if (g.Style.Alpha > 0.0f)
|
||||||
{
|
{
|
||||||
// Render tooltip
|
// Render tooltip
|
||||||
if (g.Tooltip[0])
|
if (g.Tooltip[0])
|
||||||
{
|
{
|
||||||
// Use a dummy window to render the tooltip
|
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::TextUnformatted(g.Tooltip);
|
ImGui::TextUnformatted(g.Tooltip);
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
@ -3160,7 +3159,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
// When reusing window again multiple times a frame, just append content (don't need to setup again)
|
// When reusing window again multiple times a frame, just append content (don't need to setup again)
|
||||||
const int current_frame = ImGui::GetFrameCount();
|
const int current_frame = ImGui::GetFrameCount();
|
||||||
const bool first_begin_of_the_frame = (window->LastFrameDrawn != current_frame);
|
const bool first_begin_of_the_frame = (window->LastFrameDrawn != current_frame);
|
||||||
const bool window_was_visible = (window->LastFrameDrawn == current_frame - 1);
|
const bool window_was_visible = (window->LastFrameDrawn == current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
|
||||||
if (first_begin_of_the_frame)
|
if (first_begin_of_the_frame)
|
||||||
{
|
{
|
||||||
window->Active = true;
|
window->Active = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user