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
11#include "imgui/imgui.h"
12
13namespace yaze::editor {
14
37
39 const auto& theme = gui::ThemeManager::Get().GetCurrentTheme();
40
41 // Undo / Redo buttons
42 if (gui::ThemedIconButton(ICON_MD_UNDO, "Undo (Ctrl+Z)")) {
45 }
46 ImGui::SameLine();
47 if (gui::ThemedIconButton(ICON_MD_REDO, "Redo (Ctrl+Y)")) {
50 }
51
52 ImGui::SameLine(0, 12.0f);
53 ImGui::TextDisabled("|");
54 ImGui::SameLine(0, 12.0f);
55
56 // Background layer radio buttons (compact)
57 auto bg_radio = [&](const char* label, BackgroundType type, const char* tip) {
58 if (ImGui::RadioButton(label, background_type_ == type)) {
59 background_type_ = type;
60 }
61 if (ImGui::IsItemHovered()) {
62 ImGui::SetTooltip("%s", tip);
63 }
64 ImGui::SameLine();
65 };
66
67 bg_radio("All", kBackgroundAny, "Show all layers");
68 bg_radio("BG1", kBackground1, "Background 1 only");
69 bg_radio("BG2", kBackground2, "Background 2 only");
70 bg_radio("BG3", kBackground3, "Background 3 only");
71
72 ImGui::SameLine(0, 12.0f);
73 ImGui::TextDisabled("|");
74 ImGui::SameLine(0, 12.0f);
75
76 // Placement mode tool strip — themed icon buttons with active highlighting
77 for (const auto& tool : kToolDefs) {
78 const bool is_active = (placement_type_ == tool.type);
79
80 if (gui::ThemedIconButton(tool.icon, nullptr, ImVec2(0, 0), is_active)) {
81 placement_type_ = tool.type;
82 }
83 if (ImGui::IsItemHovered()) {
84 ImGui::SetTooltip("%s (%s)", tool.tooltip, tool.shortcut);
85 }
86 ImGui::SameLine();
87 }
88
89 ImGui::SameLine(0, 12.0f);
90 ImGui::TextDisabled("|");
91 ImGui::SameLine(0, 12.0f);
92
93 // Palette toggle
94 if (gui::ThemedIconButton(ICON_MD_PALETTE, "Palette Editor")) {
97 }
98
99 ImGui::NewLine();
100}
101
103 for (const auto& tool : kToolDefs) {
104 if (tool.type == placement_type_) {
105 return tool.tooltip;
106 }
107 }
108 return "Select";
109}
110
111} // namespace yaze::editor
const char * GetToolModeName() const
std::function< void()> undo_callback_
std::function< void()> palette_toggle_callback_
std::function< void()> redo_callback_
const Theme & GetCurrentTheme() const
static ThemeManager & Get()
#define ICON_MD_REDO
Definition icons.h:1570
#define ICON_MD_GRASS
Definition icons.h:891
#define ICON_MD_WIDGETS
Definition icons.h:2156
#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_NEAR_ME
Definition icons.h:1277
#define ICON_MD_PALETTE
Definition icons.h:1370
#define ICON_MD_UNDO
Definition icons.h:2039
#define ICON_MD_NAVIGATION
Definition icons.h:1276
constexpr const char * kObjects
constexpr const char * kItems
constexpr const char * kEntrances
constexpr const char * kChests
constexpr const char * kSprites
constexpr const char * kSelect
constexpr const char * kDoors
Editors are the view controllers for the application.
bool ThemedIconButton(const char *icon, const char *tooltip, const ImVec2 &size, bool is_active, bool is_disabled, const char *panel_id, const char *anim_id)
Draw a standard icon button with theme-aware colors.