Support zero-sized display, now sets default as -1,-1 and assert if display size is negative.

This commit is contained in:
ocornut 2014-12-22 01:45:13 +00:00
parent a3af51fd4e
commit ac29859f70

View File

@ -371,6 +371,7 @@ ImGuiStyle::ImGuiStyle()
ImGuiIO::ImGuiIO() ImGuiIO::ImGuiIO()
{ {
memset(this, 0, sizeof(*this)); memset(this, 0, sizeof(*this));
DisplaySize = ImVec2(-1.0f, -1.0f);
DeltaTime = 1.0f/60.0f; DeltaTime = 1.0f/60.0f;
IniSavingRate = 5.0f; IniSavingRate = 5.0f;
IniFilename = "imgui.ini"; IniFilename = "imgui.ini";
@ -1411,7 +1412,7 @@ void ImGui::NewFrame()
// Check user inputs // Check user inputs
IM_ASSERT(g.IO.DeltaTime > 0.0f); IM_ASSERT(g.IO.DeltaTime > 0.0f);
IM_ASSERT(g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f); IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f);
IM_ASSERT(g.IO.RenderDrawListsFn != NULL); // Must be implemented IM_ASSERT(g.IO.RenderDrawListsFn != NULL); // Must be implemented
if (!g.Initialized) if (!g.Initialized)