yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_settings_panel.cc
Go to the documentation of this file.
2
4#include "imgui/imgui.h"
6
7namespace yaze::editor {
8
10 if (!viewer_) {
11 ImGui::TextDisabled("No viewer available");
12 return;
13 }
14
15 auto& layer_manager = viewer_->GetRoomLayerManager(room_id);
16
17 // Helper to draw a combo box for blend mode selection
18 auto DrawBlendModeCombo = [&](const char* label,
19 zelda3::LayerType layer_type) {
20 zelda3::LayerBlendMode current_mode =
21 layer_manager.GetLayerBlendMode(layer_type);
22 const char* current_name =
24
25 if (ImGui::BeginCombo(label, current_name)) {
26 // Iterate through all blend modes
27 for (int mode_int = 0; mode_int <= 4; ++mode_int) {
29 static_cast<zelda3::LayerBlendMode>(mode_int);
30 const char* mode_name = zelda3::RoomLayerManager::GetBlendModeName(mode);
31 bool is_selected = (current_mode == mode);
32
33 if (ImGui::Selectable(mode_name, is_selected)) {
34 layer_manager.SetLayerBlendMode(layer_type, mode);
35 }
36
37 if (is_selected) {
38 ImGui::SetItemDefaultFocus();
39 }
40 }
41 ImGui::EndCombo();
42 }
43 };
44
45 // Draw combo boxes for each layer
46 ImGui::Text("BG1 Layers:");
47 ImGui::Indent();
48 DrawBlendModeCombo("BG1 Layout##blend", zelda3::LayerType::BG1_Layout);
49 DrawBlendModeCombo("BG1 Objects##blend", zelda3::LayerType::BG1_Objects);
50 ImGui::Unindent();
51
52 ImGui::Spacing();
53
54 ImGui::Text("BG2 Layers:");
55 ImGui::Indent();
56 DrawBlendModeCombo("BG2 Layout##blend", zelda3::LayerType::BG2_Layout);
57 DrawBlendModeCombo("BG2 Objects##blend", zelda3::LayerType::BG2_Objects);
58 ImGui::Unindent();
59
60 ImGui::Spacing();
61
62 // Reset to Default button
63 if (ImGui::Button(ICON_MD_REFRESH " Reset to Default")) {
64 // Reset all layers to Normal blend mode
65 layer_manager.SetLayerBlendMode(zelda3::LayerType::BG1_Layout,
67 layer_manager.SetLayerBlendMode(zelda3::LayerType::BG1_Objects,
69 layer_manager.SetLayerBlendMode(zelda3::LayerType::BG2_Layout,
71 layer_manager.SetLayerBlendMode(zelda3::LayerType::BG2_Objects,
73 }
74 if (ImGui::IsItemHovered()) {
75 ImGui::SetTooltip("Reset all layers to Normal blend mode");
76 }
77}
78
79} // namespace yaze::editor
zelda3::RoomLayerManager & GetRoomLayerManager(int room_id)
static const char * GetBlendModeName(LayerBlendMode mode)
Get blend mode name.
LayerBlendMode GetLayerBlendMode(LayerType layer) const
#define ICON_MD_REFRESH
Definition icons.h:1572
Editors are the view controllers for the application.
LayerBlendMode
Layer blend modes for compositing.
LayerType
Layer types for the 4-way visibility system.