diff --git a/src/app/core/common.h b/src/app/core/common.h index 9c7204e7..f9913e89 100644 --- a/src/app/core/common.h +++ b/src/app/core/common.h @@ -12,9 +12,19 @@ namespace core { class ExperimentFlags { public: struct Flags { + // Load and render overworld sprites to the screen. Unstable. bool kDrawOverworldSprites = false; + + // Bitmap manager abstraction to manage graphics bin of ROM. bool kUseBitmapManager = true; + + // 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; }; ExperimentFlags() = default; diff --git a/src/app/core/controller.cc b/src/app/core/controller.cc index 65770e4f..9403127b 100644 --- a/src/app/core/controller.cc +++ b/src/app/core/controller.cc @@ -208,15 +208,21 @@ absl::Status Controller::CreateRenderer() { } absl::Status Controller::CreateGuiContext() const { + IMGUI_CHECKVERSION(); ImGui::CreateContext(); + ImGuiIO &io = ImGui::GetIO(); + if (flags()->kUseNewImGuiInput) { + io.ConfigFlags |= + ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls + io.ConfigFlags |= + ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls + } + // Initialize ImGui for SDL ImGui_ImplSDL2_InitForSDLRenderer(window_.get(), renderer_.get()); ImGui_ImplSDLRenderer2_Init(renderer_.get()); - // Load available fonts - const ImGuiIO &io = ImGui::GetIO(); - // Define constants static const char *KARLA_REGULAR = "assets/font/Karla-Regular.ttf"; static const char *ROBOTO_MEDIUM = "assets/font/Roboto-Medium.ttf"; diff --git a/src/app/core/controller.h b/src/app/core/controller.h index 1a2d3c9e..423823d4 100644 --- a/src/app/core/controller.h +++ b/src/app/core/controller.h @@ -10,6 +10,7 @@ #include #include "absl/status/status.h" +#include "app/core/common.h" #include "app/editor/master_editor.h" #include "app/gui/icons.h" #include "app/gui/style.h" @@ -20,7 +21,7 @@ namespace yaze { namespace app { namespace core { -class Controller { +class Controller : public ExperimentFlags { public: bool IsActive() const; absl::Status OnEntry();