Rename SNESPalette, SNESColor to SnesPalette, SnesColor

Create snes_color.h and snes_color.cc to separate concerns
This commit is contained in:
scawful
2024-01-31 21:09:42 -05:00
parent adb7f0666e
commit 693dca1329
34 changed files with 391 additions and 316 deletions

View File

@@ -12,7 +12,7 @@ namespace yaze {
namespace app {
namespace gui {
ImVec4 ConvertSNESColorToImVec4(const SNESColor& color) {
ImVec4 ConvertSNESColorToImVec4(const SnesColor& color) {
return ImVec4(static_cast<float>(color.GetRGB().x) / 255.0f,
static_cast<float>(color.GetRGB().y) / 255.0f,
static_cast<float>(color.GetRGB().z) / 255.0f,
@@ -21,7 +21,7 @@ ImVec4 ConvertSNESColorToImVec4(const SNESColor& color) {
);
}
IMGUI_API bool SNESColorButton(absl::string_view id, SNESColor& color,
IMGUI_API bool SNESColorButton(absl::string_view id, SnesColor& color,
ImGuiColorEditFlags flags,
const ImVec2& size_arg) {
// Convert the SNES color values to ImGui color values (normalized to 0-1
@@ -34,7 +34,7 @@ IMGUI_API bool SNESColorButton(absl::string_view id, SNESColor& color,
return pressed;
}
void DisplayPalette(app::gfx::SNESPalette& palette, bool loaded) {
void DisplayPalette(app::gfx::SnesPalette& palette, bool loaded) {
static ImVec4 color = ImVec4(0, 0, 0, 255.f);
ImGuiColorEditFlags misc_flags = ImGuiColorEditFlags_AlphaPreview |
ImGuiColorEditFlags_NoDragDrop |

View File

@@ -13,18 +13,18 @@ namespace yaze {
namespace app {
namespace gui {
using gfx::SNESColor;
using gfx::SnesColor;
// A utility function to convert an SNESColor object to an ImVec4 with
// A utility function to convert an SnesColor object to an ImVec4 with
// normalized color values
ImVec4 ConvertSNESColorToImVec4(const SNESColor& color);
ImVec4 ConvertSNESColorToImVec4(const SnesColor& color);
// The wrapper function for ImGui::ColorButton that takes a SNESColor reference
IMGUI_API bool SNESColorButton(absl::string_view id, SNESColor& color,
// The wrapper function for ImGui::ColorButton that takes a SnesColor reference
IMGUI_API bool SNESColorButton(absl::string_view id, SnesColor& color,
ImGuiColorEditFlags flags = 0,
const ImVec2& size_arg = ImVec2(0, 0));
void DisplayPalette(app::gfx::SNESPalette& palette, bool loaded);
void DisplayPalette(app::gfx::SnesPalette& palette, bool loaded);
} // namespace gui
} // namespace app

View File

@@ -22,7 +22,7 @@ namespace app {
namespace gui {
void SelectablePalettePipeline(uint64_t& palette_id, bool& refresh_graphics,
gfx::SNESPalette& palette) {
gfx::SnesPalette& palette) {
const auto palette_row_size = 7;
if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)100);
ImGui::BeginChild(child_id, ImGui::GetContentRegionAvail(), true,
@@ -160,7 +160,7 @@ void BitmapCanvasPipeline(gui::Canvas& canvas, const gfx::Bitmap& bitmap,
void BuildAndRenderBitmapPipeline(int width, int height, int depth, Bytes data,
ROM& z3_rom, gfx::Bitmap& bitmap,
gfx::SNESPalette& palette) {
gfx::SnesPalette& palette) {
bitmap.Create(width, height, depth, data);
bitmap.ApplyPalette(palette);
z3_rom.RenderBitmap(&bitmap);

View File

@@ -21,7 +21,7 @@ namespace app {
namespace gui {
void SelectablePalettePipeline(uint64_t& palette_id, bool& refresh_graphics,
gfx::SNESPalette& palette);
gfx::SnesPalette& palette);
void GraphicsBinCanvasPipeline(int width, int height, int tile_size,
int num_sheets_to_load, int canvas_id,
@@ -40,7 +40,7 @@ void GraphicsManagerCanvasPipeline(int width, int height, int tile_size,
void BuildAndRenderBitmapPipeline(int width, int height, int depth, Bytes data,
ROM& z3_rom, gfx::Bitmap& bitmap,
gfx::SNESPalette& palette);
gfx::SnesPalette& palette);
void FileDialogPipeline(absl::string_view display_key,
absl::string_view file_extensions,

View File

@@ -44,9 +44,8 @@ void BeginNoPadding() {
}
void EndNoPadding() { ImGui::PopStyleVar(2); }
void BeginChildWithScrollbar(int id) {
ImGuiID child_id = ImGui::GetID((void*)(intptr_t)id);
ImGui::BeginChild(child_id, ImGui::GetContentRegionAvail(), true,
void BeginChildWithScrollbar(const char* str_id) {
ImGui::BeginChild(str_id, ImGui::GetContentRegionAvail(), true,
ImGuiWindowFlags_AlwaysVerticalScrollbar);
}

View File

@@ -21,7 +21,7 @@ void EndPadding();
void BeginNoPadding();
void EndNoPadding();
void BeginChildWithScrollbar(int id);
void BeginChildWithScrollbar(const char *str_id);
void BeginChildBothScrollbars(int id);