Skip to content

Commit 97bbae3

Browse files
committed
Add outline to SelectablePalettePipeline
1 parent cf2d023 commit 97bbae3

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

Diff for: src/app/core/pipeline.cc

+21-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "app/gfx/bitmap.h"
1414
#include "app/gfx/snes_palette.h"
1515
#include "app/gui/canvas.h"
16+
#include "app/gui/color.h"
17+
#include "app/gui/input.h"
1618
#include "app/rom.h"
1719

1820
namespace yaze {
@@ -30,15 +32,29 @@ void SelectablePalettePipeline(uint64_t& palette_id, bool& refresh_graphics,
3032
ImGui::PushID(n);
3133
if ((n % 8) != 0) ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.y);
3234

33-
if (ImGui::ColorButton("##palette", palette[n].GetRGB(),
34-
ImGuiColorEditFlags_NoAlpha |
35-
ImGuiColorEditFlags_NoPicker |
36-
ImGuiColorEditFlags_NoTooltip,
37-
ImVec2(20, 20))) {
35+
// Check if the current row is selected
36+
bool is_selected = (palette_id == n / 8);
37+
38+
// Add outline rectangle to the selected row
39+
if (is_selected) {
40+
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
41+
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 2.0f);
42+
}
43+
44+
if (gui::SNESColorButton("##palette", palette[n],
45+
ImGuiColorEditFlags_NoAlpha |
46+
ImGuiColorEditFlags_NoPicker |
47+
ImGuiColorEditFlags_NoTooltip,
48+
ImVec2(20, 20))) {
3849
palette_id = n / 8;
3950
refresh_graphics = true;
4051
}
4152

53+
if (is_selected) {
54+
ImGui::PopStyleColor();
55+
ImGui::PopStyleVar();
56+
}
57+
4258
ImGui::PopID();
4359
}
4460
ImGui::EndGroup();

0 commit comments

Comments
 (0)