Add COL file indexing for palettes

This commit is contained in:
Justin Scofield
2023-08-02 19:33:42 -04:00
parent e88b2a6d2f
commit e7ef0fae56
3 changed files with 36 additions and 9 deletions

View File

@@ -81,8 +81,15 @@ class SNESPalette {
explicit SNESPalette(const std::vector<SNESColor>&);
void Create(const std::vector<SNESColor>&);
void AddColor(SNESColor color) { colors.push_back(color); }
void AddColor(SNESColor color) {
colors.push_back(color);
size_++;
}
auto GetColor(int i) const { return colors[i]; }
void Clear() {
colors.clear();
size_ = 0;
}
SNESColor operator[](int i) {
if (i > size_) {
@@ -133,6 +140,10 @@ struct PaletteGroup {
}
palettes[0].AddColor(color);
}
void Clear() {
palettes.clear();
size_ = 0;
}
SNESPalette operator[](int i) {
if (i > size_) {
std::cout << "PaletteGroup: Index out of bounds" << std::endl;