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

Method DrawLog

SampleFramework12/v1.00/App.cpp:266–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void App::DrawLog()
267{
268 const uint32 displayWidth = swapChain.Width();
269 const uint32 displayHeight = swapChain.Height();
270
271 if(showLog == false)
272 {
273 ImGui::SetNextWindowSize(ImVec2(75.0f, 25.0f));
274 ImGui::SetNextWindowPos(ImVec2(25.0f, displayHeight - 50.0f));
275 ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
276 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings;
277 if(ImGui::Begin("log_button", nullptr, ImVec2(75.0f, 25.0f), 0.0f, flags) == false)
278 {
279 ImGui::End();
280 return;
281 }
282
283 if(ImGui::Button("Log"))
284 showLog = true;
285
286 ImGui::End();
287
288 return;
289 }
290
291 ImVec2 initialSize = ImVec2(displayWidth * 0.5f, float(displayHeight) * 0.25f);
292 ImGui::SetNextWindowSize(initialSize, ImGuiSetCond_FirstUseEver);
293 ImGui::SetNextWindowPos(ImVec2(10.0f, displayHeight - initialSize.y - 10.0f), ImGuiSetCond_FirstUseEver);
294
295 if(ImGui::Begin("Log", &showLog) == false)
296 {
297 ImGui::End();
298 return;
299 }
300
301 const uint64 start = numLogMessages > MaxLogMessages ? numLogMessages - MaxLogMessages : 0;
302 for(uint64 i = start; i < numLogMessages; ++i)
303 ImGui::TextUnformatted(logMessages[i % MaxLogMessages].c_str());
304
305 if(newLogMessage)
306 ImGui::SetScrollHere();
307
308 ImGui::End();
309
310 newLogMessage = false;
311}
312
313void App::AddToLog(const char* msg)
314{

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