Update PaletteEditor, remove Delta experiment

This commit is contained in:
scawful
2023-05-15 08:23:13 -05:00
parent 3abfaf3336
commit 46fe8993ea
18 changed files with 247 additions and 852 deletions

View File

@@ -190,7 +190,7 @@ SDL_Palette* SNESPalette::GetSDL_Palette() {
return sdl_palette.get();
}
PaletteGroup::PaletteGroup(uint8_t mSize) : size(mSize) {}
PaletteGroup::PaletteGroup(uint8_t mSize) : size_(mSize) {}
} // namespace gfx
} // namespace app

View File

@@ -47,10 +47,18 @@ struct SNESColor {
void setSNES(uint16_t);
void setTransparent(bool t) { transparent = t; }
auto RGB() {
return ImVec4(rgb.x / 255, rgb.y / 255, rgb.z / 255, rgb.w);
auto RGB() { return ImVec4(rgb.x / 255, rgb.y / 255, rgb.z / 255, rgb.w); }
float* ToFloatArray() const {
static std::vector<float> colorArray(4);
colorArray[0] = rgb.x / 255.0f;
colorArray[1] = rgb.y / 255.0f;
colorArray[2] = rgb.z / 255.0f;
colorArray[3] = rgb.w;
return colorArray.data();
}
bool modified = false;
bool transparent = false;
uint16_t snes = 0;
ImVec4 rgb;
@@ -82,6 +90,7 @@ class SNESPalette {
SDL_Palette* GetSDL_Palette();
int size_ = 0;
auto size() const { return colors.size(); }
std::vector<SNESColor> colors;
};
@@ -90,23 +99,24 @@ struct PaletteGroup {
explicit PaletteGroup(uint8_t mSize);
void AddPalette(SNESPalette pal) {
palettes.emplace_back(pal);
size = palettes.size();
size_ = palettes.size();
}
void AddColor(SNESColor color) {
if (size == 0) {
if (size_ == 0) {
SNESPalette empty_pal;
palettes.emplace_back(empty_pal);
}
palettes[0].AddColor(color);
}
SNESPalette operator[](int i) {
if (i > size) {
if (i > size_) {
std::cout << "PaletteGroup: Index out of bounds" << std::endl;
return palettes[0];
}
return palettes[i];
}
int size = 0;
int size_ = 0;
auto size() const { return palettes.size(); }
std::vector<SNESPalette> palettes;
};