MCPcopy Create free account
hub / github.com/OpenBoardView/OpenBoardView / render

Method render

src/openboardview/GUI/Help/Controls.cpp:21–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21void Controls::render() {
22 bool p_open = true;
23 auto &io = ImGui::GetIO();
24 ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f), 0, ImVec2(0.5f, 0.5f));
25 ImGui::SetNextWindowSize(ImVec2(DPI(540), 0.0f));
26 if (ImGui::BeginPopupModal("Controls", &p_open)) {
27 shown = false;
28
29 ImGui::Text("Keyboard controls");
30 ImGui::Separator();
31
32 if (ImGui::BeginTable("KeyboardControls", 2, ImGuiTableFlags_BordersInnerV)) {
33 ImGui::TableSetupColumn(nullptr, ImGuiTableColumnFlags_WidthFixed); // size according to content
34 ImGui::TableSetupColumn(nullptr, ImGuiTableColumnFlags_WidthFixed); // size according to content
35
36 for (auto &desc : keybindings.descriptions) {
37 ImGui::TableNextRow();
38 if (desc.second.empty()) {
39 ImGui::TableSetColumnIndex(0);
40 ImGui::Dummy(ImVec2(0.0f, DPI(5)));
41 ImGui::TableSetColumnIndex(1);
42 ImGui::Dummy(ImVec2(0.0f, DPI(5)));
43 } else {
44 ImGui::TableSetColumnIndex(0);
45 ImGui::Text("%s", desc.second.c_str());
46 ImGui::TableSetColumnIndex(1);
47 ImGui::Text("%s", keybindings.getKeyNames(desc.first).c_str());
48 }
49 }
50 ImGui::EndTable();
51 }
52 ImGui::Separator();
53 ImGui::Text("Mouse controls");
54 ImGui::Separator();
55
56 if (ImGui::BeginTable("MouseControls", 2, ImGuiTableFlags_BordersInnerV)) {
57 ImGui::TableSetupColumn(nullptr, ImGuiTableColumnFlags_WidthFixed); // size according to content
58 ImGui::TableSetupColumn(nullptr, ImGuiTableColumnFlags_WidthFixed); // size according to content
59
60 ImGui::TableNextRow();
61 ImGui::TableSetColumnIndex(0);
62 ImGui::Text("Highlight pins on network");
63 ImGui::TableSetColumnIndex(1);
64 ImGui::Text("Click (on pin)");
65
66 ImGui::TableNextRow();
67 ImGui::TableSetColumnIndex(0);
68 ImGui::Text("Move board");
69 ImGui::TableSetColumnIndex(1);
70 ImGui::Text("Click and drag");
71
72 ImGui::TableNextRow();
73 ImGui::TableSetColumnIndex(0);
74 ImGui::Text("Zoom (CTRL for finer steps)");
75 ImGui::TableSetColumnIndex(1);
76 ImGui::Text("Scroll");
77
78 ImGui::TableNextRow();

Callers

nothing calls this directly

Calls 3

DPIFunction · 0.85
getKeyNamesMethod · 0.80
isPressedMethod · 0.45

Tested by

no test coverage detected