MCPcopy Create free account
hub / github.com/ElectroZybr/LatticeLab / draw

Method draw

App/GUI/interface/panels/debug/DebugPanel.cpp:10–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8}
9
10void DebugPanel::draw(float uiScale, glm::ivec2 windowSize) {
11 float target = visible ? 1.f : 0.f;
12 float step = ImGui::GetIO().DeltaTime * 12.f;
13 animProgress += (target - animProgress) * std::min(step, 1.f);
14
15 if (animProgress < 0.01f) {
16 return;
17 }
18
19 const float panelWidth = 300.f * uiScale;
20 const float topOffset = 65.f * uiScale;
21 const float rawHeight = static_cast<float>(windowSize.y) - topOffset;
22 const float panelHeight = (rawHeight > 0.f) ? rawHeight : 0.f;
23 const float x = -panelWidth + panelWidth * animProgress;
24
25 ImGui::SetNextWindowPos(ImVec2(x, topOffset));
26 ImGui::SetNextWindowSize(ImVec2(panelWidth, panelHeight));
27 ImGui::Begin("##DebugPanel", nullptr,
28 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
29
30 if (ImGui::BeginTabBar("##DebugTabs")) {
31 for (auto& view : views) {
32 if (view.visible) {
33 if (ImGui::BeginTabItem(view.getTitle())) {
34 view.draw(uiScale);
35 ImGui::EndTabItem();
36 }
37 }
38 }
39 ImGui::EndTabBar();
40 }
41
42 ImGui::End();
43}

Callers

nothing calls this directly

Calls 1

getTitleMethod · 0.80

Tested by

no test coverage detected