yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_toolset.cc
Go to the documentation of this file.
1#include "dungeon_toolset.h"
2
3#include <algorithm>
4#include <array>
5
7#include "imgui/imgui.h"
8
9namespace yaze::editor {
10
11using ImGui::BeginTable;
12using ImGui::Button;
13using ImGui::EndTable;
14using ImGui::RadioButton;
15using ImGui::TableNextColumn;
16using ImGui::TableSetupColumn;
17using ImGui::Text;
18
20 if (BeginTable("DWToolset", 16, ImGuiTableFlags_SizingFixedFit,
21 ImVec2(0, 0))) {
22 static std::array<const char*, 16> tool_names = {
23 "Undo", "Redo", "Separator", "All", "BG1", "BG2",
24 "BG3", "Separator", "Object", "Sprite", "Item", "Entrance",
25 "Door", "Chest", "Block", "Palette"};
26 std::ranges::for_each(tool_names,
27 [](const char* name) { TableSetupColumn(name); });
28
29 // Undo button
30 TableNextColumn();
31 if (Button(ICON_MD_UNDO)) {
34 }
35
36 // Redo button
37 TableNextColumn();
38 if (Button(ICON_MD_REDO)) {
41 }
42
43 // Separator
44 TableNextColumn();
46
47 // Background layer selection
48 TableNextColumn();
49 if (RadioButton("All", background_type_ == kBackgroundAny)) {
51 }
52 if (ImGui::IsItemHovered()) {
53 ImGui::SetTooltip("Show all background layers");
54 }
55
56 TableNextColumn();
57 if (RadioButton("BG1", background_type_ == kBackground1)) {
59 }
60 if (ImGui::IsItemHovered()) {
61 ImGui::SetTooltip("Show background layer 1 only");
62 }
63
64 TableNextColumn();
65 if (RadioButton("BG2", background_type_ == kBackground2)) {
67 }
68 if (ImGui::IsItemHovered()) {
69 ImGui::SetTooltip("Show background layer 2 only");
70 }
71
72 TableNextColumn();
73 if (RadioButton("BG3", background_type_ == kBackground3)) {
75 }
76 if (ImGui::IsItemHovered()) {
77 ImGui::SetTooltip("Show background layer 3 only");
78 }
79
80 // Separator
81 TableNextColumn();
83
84 // Placement mode selection
85 TableNextColumn();
86 if (RadioButton(ICON_MD_SQUARE, placement_type_ == kObject)) {
88 }
89 if (ImGui::IsItemHovered()) {
90 ImGui::SetTooltip("Objects");
91 }
92
93 TableNextColumn();
94 if (RadioButton(ICON_MD_PEST_CONTROL, placement_type_ == kSprite)) {
96 }
97 if (ImGui::IsItemHovered()) {
98 ImGui::SetTooltip("Sprites");
99 }
100
101 TableNextColumn();
102 if (RadioButton(ICON_MD_GRASS, placement_type_ == kItem)) {
104 }
105 if (ImGui::IsItemHovered()) {
106 ImGui::SetTooltip("Items");
107 }
108
109 TableNextColumn();
110 if (RadioButton(ICON_MD_NAVIGATION, placement_type_ == kEntrance)) {
112 }
113 if (ImGui::IsItemHovered()) {
114 ImGui::SetTooltip("Entrances");
115 }
116
117 TableNextColumn();
118 if (RadioButton(ICON_MD_SENSOR_DOOR, placement_type_ == kDoor)) {
120 }
121 if (ImGui::IsItemHovered()) {
122 ImGui::SetTooltip("Doors");
123 }
124
125 TableNextColumn();
126 if (RadioButton(ICON_MD_INVENTORY, placement_type_ == kChest)) {
128 }
129 if (ImGui::IsItemHovered()) {
130 ImGui::SetTooltip("Chests");
131 }
132
133 TableNextColumn();
134 if (RadioButton(ICON_MD_VIEW_MODULE, placement_type_ == kBlock)) {
136 }
137 if (ImGui::IsItemHovered()) {
138 ImGui::SetTooltip("Blocks");
139 }
140
141 // Palette button
142 TableNextColumn();
143 if (Button(ICON_MD_PALETTE)) {
146 }
147
148 ImGui::EndTable();
149 }
150
151 ImGui::Separator();
152 ImGui::Text(
153 "Instructions: Click to place objects, Ctrl+Click to select, drag to "
154 "move");
155}
156
157} // namespace yaze::editor
std::function< void()> undo_callback_
std::function< void()> palette_toggle_callback_
std::function< void()> redo_callback_
#define ICON_MD_VIEW_MODULE
Definition icons.h:2093
#define ICON_MD_MORE_VERT
Definition icons.h:1243
#define ICON_MD_SQUARE
Definition icons.h:1841
#define ICON_MD_REDO
Definition icons.h:1570
#define ICON_MD_GRASS
Definition icons.h:891
#define ICON_MD_SENSOR_DOOR
Definition icons.h:1687
#define ICON_MD_INVENTORY
Definition icons.h:1011
#define ICON_MD_PEST_CONTROL
Definition icons.h:1429
#define ICON_MD_PALETTE
Definition icons.h:1370
#define ICON_MD_UNDO
Definition icons.h:2039
#define ICON_MD_NAVIGATION
Definition icons.h:1276
Editors are the view controllers for the application.
Definition agent_chat.cc:23