add imgui input experiment flag
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <memory>
|
||||
|
||||
#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();
|
||||
|
||||
Reference in New Issue
Block a user