From 08090529ef94a1268ea1a597756b9760f0aa2fb0 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 25 Nov 2023 20:52:09 -0500 Subject: [PATCH] Controller cleanup --- src/app/core/controller.cc | 12 ++++-------- src/app/core/controller.h | 3 ++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/app/core/controller.cc b/src/app/core/controller.cc index 0f2a3c1d..05475dc9 100644 --- a/src/app/core/controller.cc +++ b/src/app/core/controller.cc @@ -97,8 +97,6 @@ void HandleMouseMovement(int &wheel) { } // namespace -bool Controller::IsActive() const { return active_; } - absl::Status Controller::OnEntry() { RETURN_IF_ERROR(CreateSDL_Window()) RETURN_IF_ERROR(CreateRenderer()) @@ -149,7 +147,7 @@ void Controller::OnInput() { HandleMouseMovement(wheel); } -void Controller::OnLoad() { master_editor_.UpdateScreen(); } +void Controller::OnLoad() { PRINT_IF_ERROR(master_editor_.Update()); } void Controller::DoRender() const { SDL_RenderClear(renderer_.get()); @@ -219,10 +217,8 @@ absl::Status Controller::CreateGuiContext() { ImGuiIO &io = ImGui::GetIO(); if (flags()->kUseNewImGuiInput) { - io.ConfigFlags |= - ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls - io.ConfigFlags |= - ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls + io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; + io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; } // Initialize ImGui for SDL @@ -232,7 +228,7 @@ absl::Status Controller::CreateGuiContext() { if (flags()->kLoadSystemFonts) { LoadSystemFonts(); } else { - LoadFontFamilies(); + RETURN_IF_ERROR(LoadFontFamilies()); } // Set the default style diff --git a/src/app/core/controller.h b/src/app/core/controller.h index 4d2f117c..95739ffd 100644 --- a/src/app/core/controller.h +++ b/src/app/core/controller.h @@ -11,6 +11,7 @@ #include "absl/status/status.h" #include "app/core/common.h" +#include "app/core/editor.h" #include "app/editor/master_editor.h" #include "app/gui/icons.h" #include "app/gui/style.h" @@ -23,7 +24,7 @@ namespace core { class Controller : public ExperimentFlags { public: - bool IsActive() const; + bool IsActive() const { return active_; } absl::Status OnEntry(); void OnInput(); void OnLoad();