MCPcopy Create free account
hub / github.com/TheRealMJP/DXRPathTracer / DrawLog

Method DrawLog

SampleFramework12/v1.02/App.cpp:315–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315void App::DrawLog()
316{
317 const uint32 displayWidth = swapChain.Width();
318 const uint32 displayHeight = swapChain.Height();
319
320 if(showLog == false)
321 {
322 ImGui::SetNextWindowSize(ImVec2(75.0f, 25.0f));
323 ImGui::SetNextWindowPos(ImVec2(25.0f, displayHeight - 50.0f));
324 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
325 ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
326 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar;
327 if(ImGui::Begin("log_button", nullptr, ImVec2(75.0f, 25.0f), 0.0f, flags))
328 {
329 if(ImGui::Button("Log"))
330 showLog = true;
331 }
332
333 ImGui::PopStyleVar();
334
335 ImGui::End();
336
337 return;
338 }
339
340 ImVec2 initialSize = ImVec2(displayWidth * 0.5f, float(displayHeight) * 0.25f);
341 ImGui::SetNextWindowSize(initialSize, ImGuiSetCond_FirstUseEver);
342 ImGui::SetNextWindowPos(ImVec2(10.0f, displayHeight - initialSize.y - 10.0f), ImGuiSetCond_FirstUseEver);
343
344 if(ImGui::Begin("Log", &showLog) == false)
345 {
346 ImGui::End();
347 return;
348 }
349
350 const uint64 numMessages = numLogMessages;
351 const uint64 start = numMessages > MaxLogMessages ? numMessages - MaxLogMessages : 0;
352 for(uint64 i = start; i < numMessages; ++i)
353 ImGui::TextUnformatted(logMessages[i % MaxLogMessages].c_str());
354
355 if(newLogMessage)
356 ImGui::SetScrollHere();
357
358 ImGui::End();
359
360 newLogMessage = false;
361}
362
363void App::AddToLog(const char* msg)
364{

Callers

nothing calls this directly

Calls 5

ImVec2Class · 0.85
c_strMethod · 0.80
ButtonClass · 0.70
WidthMethod · 0.45
HeightMethod · 0.45

Tested by

no test coverage detected