13
13
#include " app/gfx/bitmap.h"
14
14
#include " app/gfx/snes_palette.h"
15
15
#include " app/gui/canvas.h"
16
+ #include " app/gui/color.h"
17
+ #include " app/gui/input.h"
16
18
#include " app/rom.h"
17
19
18
20
namespace yaze {
@@ -30,15 +32,29 @@ void SelectablePalettePipeline(uint64_t& palette_id, bool& refresh_graphics,
30
32
ImGui::PushID (n);
31
33
if ((n % 8 ) != 0 ) ImGui::SameLine (0 .0f , ImGui::GetStyle ().ItemSpacing .y );
32
34
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 ))) {
38
49
palette_id = n / 8 ;
39
50
refresh_graphics = true ;
40
51
}
41
52
53
+ if (is_selected) {
54
+ ImGui::PopStyleColor ();
55
+ ImGui::PopStyleVar ();
56
+ }
57
+
42
58
ImGui::PopID ();
43
59
}
44
60
ImGui::EndGroup ();
0 commit comments