From 2bf6c5c77306ffe75d59413ff7588266ba73054e Mon Sep 17 00:00:00 2001 From: scawful Date: Mon, 31 Jul 2023 21:25:19 -0400 Subject: [PATCH] Add TextWithSeparators gui function --- src/app/gui/color.cc | 4 +++- src/app/gui/style.cc | 6 ++++++ src/app/gui/style.h | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/gui/color.cc b/src/app/gui/color.cc index 22c836a1..a7fd6807 100644 --- a/src/app/gui/color.cc +++ b/src/app/gui/color.cc @@ -10,6 +10,7 @@ namespace yaze { namespace gui { + void DisplayPalette(app::gfx::SNESPalette& palette, bool loaded) { static ImVec4 color = ImVec4(0, 0, 0, 255.f); ImGuiColorEditFlags misc_flags = ImGuiColorEditFlags_AlphaPreview | @@ -47,7 +48,7 @@ void DisplayPalette(app::gfx::SNESPalette& palette, bool loaded) { color = backup_color; ImGui::Separator(); -ImGui::BeginGroup(); // Lock X position + ImGui::BeginGroup(); // Lock X position ImGui::Text("Palette"); for (int n = 0; n < IM_ARRAYSIZE(saved_palette); n++) { ImGui::PushID(n); @@ -80,5 +81,6 @@ ImGui::BeginGroup(); // Lock X position misc_flags | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoSmallPreview); } + } // namespace gui } // namespace yaze \ No newline at end of file diff --git a/src/app/gui/style.cc b/src/app/gui/style.cc index 2e22b55a..4b8c57a2 100644 --- a/src/app/gui/style.cc +++ b/src/app/gui/style.cc @@ -6,6 +6,12 @@ namespace yaze { namespace gui { +void TextWithSeparators(const absl::string_view &text) { + ImGui::Separator(); + ImGui::Text("%s", text.data()); + ImGui::Separator(); +} + void ColorsYaze() { ImGuiStyle *style = &ImGui::GetStyle(); ImVec4 *colors = style->Colors; diff --git a/src/app/gui/style.h b/src/app/gui/style.h index 7f64b582..9a1a97ba 100644 --- a/src/app/gui/style.h +++ b/src/app/gui/style.h @@ -4,9 +4,13 @@ #include #include +#include "absl/strings/string_view.h" + namespace yaze { namespace gui { +void TextWithSeparators(const absl::string_view& text); + void ColorsYaze(); } // namespace gui