From d47e8a838779781825774bcf1b48934309d36126 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 31 Dec 2024 16:40:24 -0500 Subject: [PATCH] Remove ImGui input flag and related code from core and editor components --- src/app/core/common.h | 27 ++++++++++----------------- src/app/core/controller.cc | 6 ------ src/app/editor/system/flags.h | 1 - 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/app/core/common.h b/src/app/core/common.h index fa78aeee..7bd5a482 100644 --- a/src/app/core/common.h +++ b/src/app/core/common.h @@ -7,9 +7,9 @@ #include #include +#include "absl/container/flat_hash_map.h" #include "absl/status/statusor.h" #include "absl/strings/str_format.h" -#include "absl/container/flat_hash_map.h" namespace yaze { @@ -19,7 +19,6 @@ namespace yaze { */ namespace core { - struct HexStringParams { enum class Prefix { kNone, kDollar, kHash, k0x } prefix = Prefix::kDollar; bool uppercase = true; @@ -38,16 +37,11 @@ bool StringReplace(std::string &str, const std::string &from, * @brief A class to manage experimental feature flags. */ class ExperimentFlags { -public: + public: struct Flags { // Log instructions to the GUI debugger. bool kLogInstructions = true; - // Flag to enable ImGui input config flags. Currently is - // handled manually by controller class but should be - // ported away from that eventually. - bool kUseNewImGuiInput = false; - // Flag to enable the saving of all palettes to the Rom. bool kSaveAllPalettes = false; @@ -121,9 +115,6 @@ public: std::string result; result += "kLogInstructions: " + std::to_string(flags_->kLogInstructions) + "\n"; - result += - "kUseNewImGuiInput: " + std::to_string(flags_->kUseNewImGuiInput) + - "\n"; result += "kSaveAllPalettes: " + std::to_string(flags_->kSaveAllPalettes) + "\n"; result += @@ -154,7 +145,7 @@ public: return result; } -private: + private: static std::shared_ptr flags_; }; @@ -163,8 +154,9 @@ private: * @brief A class to manage a value that can be modified and notify when it * changes. */ -template class NotifyValue { -public: +template +class NotifyValue { + public: NotifyValue() : value_(), modified_(false), temp_value_() {} NotifyValue(const T &value) : value_(value), modified_(false), temp_value_() {} @@ -197,7 +189,7 @@ public: bool modified() const { return modified_; } -private: + private: T value_; bool modified_; T temp_value_; @@ -221,7 +213,8 @@ struct StructuredLog { std::string category; }; -static absl::flat_hash_map> log_categories; +static absl::flat_hash_map> + log_categories; template static void logm(const std::string &category, @@ -236,7 +229,7 @@ static void logm(const std::string &category, } class Logger { -public: + public: static void log(std::string message) { static std::ofstream fout(log_file_out, std::ios::out | std::ios::app); fout << message << std::endl; diff --git a/src/app/core/controller.cc b/src/app/core/controller.cc index ec134966..23862b92 100644 --- a/src/app/core/controller.cc +++ b/src/app/core/controller.cc @@ -141,9 +141,6 @@ void Controller::OnExit() { absl::Status Controller::CreateWindow() { auto sdl_flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER; - if (flags()->kUseNewImGuiInput) { - sdl_flags |= SDL_INIT_GAMECONTROLLER; - } if (SDL_Init(sdl_flags) != 0) { return absl::InternalError( @@ -181,9 +178,6 @@ absl::Status Controller::CreateGuiContext() { ImGuiIO &io = ImGui::GetIO(); io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; - if (flags()->kUseNewImGuiInput) { - io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; - } // Initialize ImGui based on the backend ImGui_ImplSDL2_InitForSDLRenderer(window_.get(), diff --git a/src/app/editor/system/flags.h b/src/app/editor/system/flags.h index dc6ea6f4..6c00b978 100644 --- a/src/app/editor/system/flags.h +++ b/src/app/editor/system/flags.h @@ -52,7 +52,6 @@ struct FlagsMenu : public core::ExperimentFlags { Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes); Checkbox("Save Gfx Groups", &mutable_flags()->kSaveGfxGroups); Checkbox("Save Graphics Sheets", &mutable_flags()->kSaveGraphicsSheet); - Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput); } };