4#include "absl/strings/str_cat.h"
5#include "absl/strings/str_format.h"
11#include "imgui/imgui.h"
16using ImGui::BeginChild;
17using ImGui::BeginGroup;
18using ImGui::BeginTable;
22using ImGui::GetContentRegionAvail;
27using ImGui::Selectable;
28using ImGui::Separator;
29using ImGui::SetNextItemWidth;
30using ImGui::TableHeadersRow;
31using ImGui::TableNextColumn;
32using ImGui::TableNextRow;
33using ImGui::TableSetupColumn;
36using gfx::kPaletteGroupNames;
46 return absl::OkStatus();
53 if (ImGui::IsItemHovered()) {
54 ImGui::SetTooltip(tr(
"Show full 16-color palettes instead of 8"));
59 if (BeginTable(
"##PalettesetLayout", 2,
60 ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable)) {
61 TableSetupColumn(
"Palettesets", ImGuiTableColumnFlags_WidthFixed, 200);
62 TableSetupColumn(
"Editor", ImGuiTableColumnFlags_WidthStretch);
75 return absl::OkStatus();
79 if (BeginChild(
"##PalettesetListChild", ImVec2(0, 400))) {
80 for (uint8_t idx = 0; idx < 72; idx++) {
83 std::string label = absl::StrFormat(
"0x%02X", idx);
87 std::string display_name = label;
94 if (Selectable(display_name.c_str(), is_selected)) {
110 std::string paletteset_label =
112 Text(
"%s", paletteset_label.c_str());
126 SetNextItemWidth(80.f);
129 Text(tr(
"Index: %d"), paletteset_ids[0]);
131 auto* dungeon_palette =
134 if (dungeon_palette) {
142 const char* sprite_labels[] = {
"Sprite Aux 1",
"Sprite Aux 2",
151 for (
int slot = 0; slot < 3; slot++) {
155 Text(
"%s %s", sprite_icons[slot], sprite_labels[slot]);
156 SetNextItemWidth(80.f);
159 Text(tr(
"Index: %d"), paletteset_ids[slot + 1]);
161 auto* sprite_palette =
163 if (sprite_palette) {
185 if (palette.
empty()) {
186 Text(tr(
"(Empty palette)"));
191 colors_to_show = std::min(colors_to_show, palette.
size());
193 for (
size_t color_idx = 0; color_idx < colors_to_show; color_idx++) {
194 PushID(
static_cast<int>(color_idx));
196 if ((color_idx % 8) != 0) {
197 SameLine(0.0f, GetStyle().ItemSpacing.y);
200 ImGuiColorEditFlags flags =
201 ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoTooltip;
203 flags |= ImGuiColorEditFlags_NoPicker;
207 palette[color_idx], flags)) {
211 if (ImGui::IsItemHovered()) {
212 auto& color = palette[color_idx];
213 ImGui::SetTooltip(tr(
"Color %zu\nRGB: %d, %d, %d\nSNES: $%04X"),
214 color_idx, color.rom_color().red,
215 color.rom_color().green, color.rom_color().blue,
224 Text(tr(
"(+%zu more)"), palette.
size() - 8);
project::ResourceLabelManager * resource_label()
zelda3::GameData * game_data() const
uint8_t selected_paletteset_
void DrawPaletteGrid(gfx::SnesPalette &palette, bool editable=false)
void DrawPalettesetEditor()
void DrawPalettesetList()
void Draw(bool *p_open) override
Draw the panel content.
void DrawPalettePreview(gfx::SnesPalette &palette, const char *label)
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
#define ICON_MD_LANDSCAPE
#define ICON_MD_SMART_TOY
IMGUI_API bool SnesColorButton(absl::string_view id, gfx::SnesColor &color, ImGuiColorEditFlags flags, const ImVec2 &size_arg)
bool DrawEmptyState(const EmptyStateOptions &options)
Draw a centered empty-state block.
EmptyStateOptions EmptyNoRom(bool compact)
bool InputHexByte(const char *label, uint8_t *data, float input_width, bool no_step)
PaletteGroup sprites_aux1
PaletteGroup sprites_aux2
PaletteGroup sprites_aux3
PaletteGroup dungeon_main
Represents a group of palettes.
auto mutable_palette(int i)
void SelectableLabelWithNameEdit(bool selected, const std::string &type, const std::string &key, const std::string &defaultValue)
std::array< std::array< uint8_t, 4 >, kNumPalettesets > paletteset_ids
gfx::PaletteGroupMap palette_groups