add modified colors section to palette editor

This commit is contained in:
scawful
2024-07-20 09:01:14 -04:00
parent 69a407fee1
commit 577f4e08f0
2 changed files with 40 additions and 4 deletions

View File

@@ -46,9 +46,9 @@ class PaletteEditorHistory {
}
// Restore the original color
gfx::SnesColor GetOriginalColor(const std::string& groupName,
size_t paletteIndex,
size_t colorIndex) const {
gfx::SnesColor RestoreOriginalColor(const std::string& groupName,
size_t paletteIndex,
size_t colorIndex) const {
for (const auto& change : recentChanges) {
if (change.group_name == groupName &&
change.palette_index == paletteIndex &&
@@ -61,6 +61,15 @@ class PaletteEditorHistory {
return gfx::SnesColor();
}
auto size() const { return recentChanges.size(); }
gfx::SnesColor& GetModifiedColor(size_t index) {
return recentChanges[index].new_color;
}
gfx::SnesColor& GetOriginalColor(size_t index) {
return recentChanges[index].original_color;
}
private:
std::deque<PaletteChange> recentChanges;
static const size_t maxHistorySize = 50; // or any other number you deem fit
@@ -96,6 +105,8 @@ class PaletteEditor : public SharedRom, public Editor {
void DrawCustomPalette();
void DrawModifiedColors();
private:
absl::Status HandleColorPopup(gfx::SnesPalette& palette, int i, int j, int n);
absl::Status InitializeSavedPalette(const gfx::SnesPalette& palette) {