Remove ImGui input flag and related code from core and editor components
This commit is contained in:
@@ -7,9 +7,9 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "absl/container/flat_hash_map.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
#include "absl/container/flat_hash_map.h"
|
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
|
|
||||||
@@ -19,7 +19,6 @@ namespace yaze {
|
|||||||
*/
|
*/
|
||||||
namespace core {
|
namespace core {
|
||||||
|
|
||||||
|
|
||||||
struct HexStringParams {
|
struct HexStringParams {
|
||||||
enum class Prefix { kNone, kDollar, kHash, k0x } prefix = Prefix::kDollar;
|
enum class Prefix { kNone, kDollar, kHash, k0x } prefix = Prefix::kDollar;
|
||||||
bool uppercase = true;
|
bool uppercase = true;
|
||||||
@@ -38,16 +37,11 @@ bool StringReplace(std::string &str, const std::string &from,
|
|||||||
* @brief A class to manage experimental feature flags.
|
* @brief A class to manage experimental feature flags.
|
||||||
*/
|
*/
|
||||||
class ExperimentFlags {
|
class ExperimentFlags {
|
||||||
public:
|
public:
|
||||||
struct Flags {
|
struct Flags {
|
||||||
// Log instructions to the GUI debugger.
|
// Log instructions to the GUI debugger.
|
||||||
bool kLogInstructions = true;
|
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.
|
// Flag to enable the saving of all palettes to the Rom.
|
||||||
bool kSaveAllPalettes = false;
|
bool kSaveAllPalettes = false;
|
||||||
|
|
||||||
@@ -121,9 +115,6 @@ public:
|
|||||||
std::string result;
|
std::string result;
|
||||||
result +=
|
result +=
|
||||||
"kLogInstructions: " + std::to_string(flags_->kLogInstructions) + "\n";
|
"kLogInstructions: " + std::to_string(flags_->kLogInstructions) + "\n";
|
||||||
result +=
|
|
||||||
"kUseNewImGuiInput: " + std::to_string(flags_->kUseNewImGuiInput) +
|
|
||||||
"\n";
|
|
||||||
result +=
|
result +=
|
||||||
"kSaveAllPalettes: " + std::to_string(flags_->kSaveAllPalettes) + "\n";
|
"kSaveAllPalettes: " + std::to_string(flags_->kSaveAllPalettes) + "\n";
|
||||||
result +=
|
result +=
|
||||||
@@ -154,7 +145,7 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::shared_ptr<Flags> flags_;
|
static std::shared_ptr<Flags> flags_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -163,8 +154,9 @@ private:
|
|||||||
* @brief A class to manage a value that can be modified and notify when it
|
* @brief A class to manage a value that can be modified and notify when it
|
||||||
* changes.
|
* changes.
|
||||||
*/
|
*/
|
||||||
template <typename T> class NotifyValue {
|
template <typename T>
|
||||||
public:
|
class NotifyValue {
|
||||||
|
public:
|
||||||
NotifyValue() : value_(), modified_(false), temp_value_() {}
|
NotifyValue() : value_(), modified_(false), temp_value_() {}
|
||||||
NotifyValue(const T &value)
|
NotifyValue(const T &value)
|
||||||
: value_(value), modified_(false), temp_value_() {}
|
: value_(value), modified_(false), temp_value_() {}
|
||||||
@@ -197,7 +189,7 @@ public:
|
|||||||
|
|
||||||
bool modified() const { return modified_; }
|
bool modified() const { return modified_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T value_;
|
T value_;
|
||||||
bool modified_;
|
bool modified_;
|
||||||
T temp_value_;
|
T temp_value_;
|
||||||
@@ -221,7 +213,8 @@ struct StructuredLog {
|
|||||||
std::string category;
|
std::string category;
|
||||||
};
|
};
|
||||||
|
|
||||||
static absl::flat_hash_map<std::string, std::vector<std::string>> log_categories;
|
static absl::flat_hash_map<std::string, std::vector<std::string>>
|
||||||
|
log_categories;
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
static void logm(const std::string &category,
|
static void logm(const std::string &category,
|
||||||
@@ -236,7 +229,7 @@ static void logm(const std::string &category,
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Logger {
|
class Logger {
|
||||||
public:
|
public:
|
||||||
static void log(std::string message) {
|
static void log(std::string message) {
|
||||||
static std::ofstream fout(log_file_out, std::ios::out | std::ios::app);
|
static std::ofstream fout(log_file_out, std::ios::out | std::ios::app);
|
||||||
fout << message << std::endl;
|
fout << message << std::endl;
|
||||||
|
|||||||
@@ -141,9 +141,6 @@ void Controller::OnExit() {
|
|||||||
|
|
||||||
absl::Status Controller::CreateWindow() {
|
absl::Status Controller::CreateWindow() {
|
||||||
auto sdl_flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
|
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) {
|
if (SDL_Init(sdl_flags) != 0) {
|
||||||
return absl::InternalError(
|
return absl::InternalError(
|
||||||
@@ -181,9 +178,6 @@ absl::Status Controller::CreateGuiContext() {
|
|||||||
|
|
||||||
ImGuiIO &io = ImGui::GetIO();
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
if (flags()->kUseNewImGuiInput) {
|
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize ImGui based on the backend
|
// Initialize ImGui based on the backend
|
||||||
ImGui_ImplSDL2_InitForSDLRenderer(window_.get(),
|
ImGui_ImplSDL2_InitForSDLRenderer(window_.get(),
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ struct FlagsMenu : public core::ExperimentFlags {
|
|||||||
Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes);
|
Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes);
|
||||||
Checkbox("Save Gfx Groups", &mutable_flags()->kSaveGfxGroups);
|
Checkbox("Save Gfx Groups", &mutable_flags()->kSaveGfxGroups);
|
||||||
Checkbox("Save Graphics Sheets", &mutable_flags()->kSaveGraphicsSheet);
|
Checkbox("Save Graphics Sheets", &mutable_flags()->kSaveGraphicsSheet);
|
||||||
Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user