yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
settings_editor.cc
Go to the documentation of this file.
1
3
4#include "absl/status/status.h"
5#include "app/core/features.h"
6#include "app/gui/style.h"
7#include "imgui/imgui.h"
8
9namespace yaze {
10namespace editor {
11
12using ImGui::BeginChild;
13using ImGui::BeginTabBar;
14using ImGui::BeginTabItem;
15using ImGui::BeginTable;
16using ImGui::EndChild;
17using ImGui::EndTabBar;
18using ImGui::EndTabItem;
19using ImGui::EndTable;
20using ImGui::TableHeadersRow;
21using ImGui::TableNextColumn;
22using ImGui::TableSetupColumn;
23
25
26absl::Status SettingsEditor::Load() { return absl::OkStatus(); }
27
28absl::Status SettingsEditor::Update() {
29 if (BeginTabBar("Settings", ImGuiTabBarFlags_None)) {
30 if (BeginTabItem("General")) {
32 EndTabItem();
33 }
34 if (BeginTabItem("Font Manager")) {
36 EndTabItem();
37 }
38 if (BeginTabItem("Keyboard Shortcuts")) {
40 EndTabItem();
41 }
42 EndTabBar();
43 }
44
45 return absl::OkStatus();
46}
47
49 static core::FlagsMenu flags;
50
51 if (BeginTable("##SettingsTable", 4,
52 ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable |
53 ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable)) {
54 TableSetupColumn("System Flags", ImGuiTableColumnFlags_WidthStretch);
55 TableSetupColumn("Overworld Flags", ImGuiTableColumnFlags_WidthStretch);
56 TableSetupColumn("Dungeon Flags", ImGuiTableColumnFlags_WidthStretch);
57 TableSetupColumn("Resource Flags", ImGuiTableColumnFlags_WidthStretch,
58 0.0f);
59
60 TableHeadersRow();
61
62 TableNextColumn();
63 flags.DrawSystemFlags();
64
65 TableNextColumn();
66 flags.DrawOverworldFlags();
67
68 TableNextColumn();
69 flags.DrawDungeonFlags();
70
71 TableNextColumn();
72 flags.DrawResourceFlags();
73
74 EndTable();
75 }
76}
77
79 for (const auto& [name, shortcut] :
80 context_->shortcut_manager.GetShortcuts()) {
81 ImGui::PushID(name.c_str());
82 ImGui::Text("%s", name.c_str());
83 ImGui::SameLine(ImGui::GetWindowWidth() - 100);
84 ImGui::Text("%s", PrintShortcut(shortcut.keys).c_str());
85 ImGui::PopID();
86 }
87}
88
89} // namespace editor
90} // namespace yaze
EditorContext * context_
Definition editor.h:89
absl::Status Update() override
absl::Status Load() override
Editors are the view controllers for the application.
std::string PrintShortcut(const std::vector< ImGuiKey > &keys)
void DrawFontManager()
Definition style.cc:759
Main namespace for the application.
Definition controller.cc:18