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
6#include "app/gui/icons.h"
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, ImVec2(0, 0))) {
21 static std::array<const char*, 16> tool_names = {
22 "Undo", "Redo", "Separator", "All", "BG1", "BG2",
23 "BG3", "Separator", "Object", "Sprite", "Item", "Entrance",
24 "Door", "Chest", "Block", "Palette"};
25 std::ranges::for_each(tool_names,
26 [](const char* name) { TableSetupColumn(name); });
27
28 // Undo button
29 TableNextColumn();
30 if (Button(ICON_MD_UNDO)) {
32 }
33
34 // Redo button
35 TableNextColumn();
36 if (Button(ICON_MD_REDO)) {
38 }
39
40 // Separator
41 TableNextColumn();
43
44 // Background layer selection
45 TableNextColumn();
46 if (RadioButton("All", background_type_ == kBackgroundAny)) {
48 }
49 if (ImGui::IsItemHovered()) {
50 ImGui::SetTooltip("Show all background layers");
51 }
52
53 TableNextColumn();
54 if (RadioButton("BG1", background_type_ == kBackground1)) {
56 }
57 if (ImGui::IsItemHovered()) {
58 ImGui::SetTooltip("Show background layer 1 only");
59 }
60
61 TableNextColumn();
62 if (RadioButton("BG2", background_type_ == kBackground2)) {
64 }
65 if (ImGui::IsItemHovered()) {
66 ImGui::SetTooltip("Show background layer 2 only");
67 }
68
69 TableNextColumn();
70 if (RadioButton("BG3", background_type_ == kBackground3)) {
72 }
73 if (ImGui::IsItemHovered()) {
74 ImGui::SetTooltip("Show background layer 3 only");
75 }
76
77 // Separator
78 TableNextColumn();
80
81 // Placement mode selection
82 TableNextColumn();
83 if (RadioButton(ICON_MD_SQUARE, placement_type_ == kObject)) {
85 }
86 if (ImGui::IsItemHovered()) {
87 ImGui::SetTooltip("Objects");
88 }
89
90 TableNextColumn();
91 if (RadioButton(ICON_MD_PEST_CONTROL, placement_type_ == kSprite)) {
93 }
94 if (ImGui::IsItemHovered()) {
95 ImGui::SetTooltip("Sprites");
96 }
97
98 TableNextColumn();
99 if (RadioButton(ICON_MD_GRASS, placement_type_ == kItem)) {
101 }
102 if (ImGui::IsItemHovered()) {
103 ImGui::SetTooltip("Items");
104 }
105
106 TableNextColumn();
107 if (RadioButton(ICON_MD_NAVIGATION, placement_type_ == kEntrance)) {
109 }
110 if (ImGui::IsItemHovered()) {
111 ImGui::SetTooltip("Entrances");
112 }
113
114 TableNextColumn();
115 if (RadioButton(ICON_MD_SENSOR_DOOR, placement_type_ == kDoor)) {
117 }
118 if (ImGui::IsItemHovered()) {
119 ImGui::SetTooltip("Doors");
120 }
121
122 TableNextColumn();
123 if (RadioButton(ICON_MD_INVENTORY, placement_type_ == kChest)) {
125 }
126 if (ImGui::IsItemHovered()) {
127 ImGui::SetTooltip("Chests");
128 }
129
130 TableNextColumn();
131 if (RadioButton(ICON_MD_VIEW_MODULE, placement_type_ == kBlock)) {
133 }
134 if (ImGui::IsItemHovered()) {
135 ImGui::SetTooltip("Blocks");
136 }
137
138 // Palette button
139 TableNextColumn();
140 if (Button(ICON_MD_PALETTE)) {
142 }
143
144 ImGui::EndTable();
145 }
146
147 ImGui::Separator();
148 ImGui::Text("Instructions: Click to place objects, Ctrl+Click to select, drag to move");
149}
150
151} // 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:2091
#define ICON_MD_MORE_VERT
Definition icons.h:1241
#define ICON_MD_SQUARE
Definition icons.h:1839
#define ICON_MD_REDO
Definition icons.h:1568
#define ICON_MD_GRASS
Definition icons.h:889
#define ICON_MD_SENSOR_DOOR
Definition icons.h:1685
#define ICON_MD_INVENTORY
Definition icons.h:1009
#define ICON_MD_PEST_CONTROL
Definition icons.h:1427
#define ICON_MD_PALETTE
Definition icons.h:1368
#define ICON_MD_UNDO
Definition icons.h:2037
#define ICON_MD_NAVIGATION
Definition icons.h:1274
Editors are the view controllers for the application.