diff --git a/src/app/editor/agent/automation_bridge.h b/src/app/editor/agent/automation_bridge.h index a1b30a28..66cc920e 100644 --- a/src/app/editor/agent/automation_bridge.h +++ b/src/app/editor/agent/automation_bridge.h @@ -3,6 +3,11 @@ #if defined(YAZE_WITH_GRPC) +// Must define before any ImGui includes (test_manager.h includes ImGui headers) +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include #include "absl/synchronization/mutex.h" diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index c1c65e23..1f288d3a 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -47,25 +47,29 @@ #ifdef YAZE_ENABLE_GTEST #include "app/test/unit_test_suite.h" #endif -#ifdef YAZE_WITH_GRPC -#include "app/test/z3ed_test_suite.h" -#endif + #include "app/editor/system/settings_editor.h" #include "app/editor/system/toast_manager.h" #include "app/emu/emulator.h" #include "app/gfx/performance/performance_dashboard.h" #include "app/editor/editor.h" + #ifdef YAZE_WITH_GRPC #include "app/core/service/screenshot_utils.h" #include "app/editor/agent/agent_chat_widget.h" #include "cli/service/agent/agent_control_server.h" #include "cli/service/agent/conversational_agent_service.h" #include "cli/service/ai/gemini_ai_service.h" +#include "app/test/z3ed_test_suite.h" + #include "absl/flags/flag.h" -#endif -#ifdef YAZE_WITH_GRPC + +// Declare the agent_control flag (defined in src/cli/flags.cc) +// ABSL_DECLARE_FLAG(bool, agent_control); + #include "app/editor/agent/automation_bridge.h" #endif + #include "imgui/imgui.h" #include "imgui/misc/cpp/imgui_stdlib.h" #include "util/log.h" @@ -86,7 +90,15 @@ std::string GetEditorName(EditorType type) { } // namespace +EditorManager::EditorManager() : blank_editor_set_(nullptr, &user_settings_) { + std::stringstream ss; + ss << YAZE_VERSION_MAJOR << "." << YAZE_VERSION_MINOR << "." + << YAZE_VERSION_PATCH; + ss >> version_; + context_.popup_manager = popup_manager_.get(); +} +EditorManager::~EditorManager() = default; void EditorManager::InitializeTestSuites() { auto& test_manager = test::TestManager::Get(); @@ -543,10 +555,10 @@ void EditorManager::Initialize(gfx::IRenderer* renderer, const std::string& file [this]() { proposal_drawer_.Toggle(); }); // Start the agent control server if the flag is set - if (absl::GetFlag(FLAGS_agent_control)) { - agent_control_server_ = std::make_unique(&emulator_); - agent_control_server_->Start(); - } + // if (absl::GetFlag(FLAGS_agent_control)) { + // agent_control_server_ = std::make_unique(&emulator_); + // agent_control_server_->Start(); + // } #endif // Testing shortcuts (only when tests are enabled) diff --git a/src/app/editor/editor_manager.h b/src/app/editor/editor_manager.h index 23761d43..f0445324 100644 --- a/src/app/editor/editor_manager.h +++ b/src/app/editor/editor_manager.h @@ -1,9 +1,10 @@ #ifndef YAZE_APP_EDITOR_EDITOR_MANAGER_H #define YAZE_APP_EDITOR_EDITOR_MANAGER_H +#define IMGUI_DEFINE_MATH_OPERATORS + #include "app/editor/system/user_settings.h" #include "app/editor/ui/workspace_manager.h" -#define IMGUI_DEFINE_MATH_OPERATORS #include "imgui/imgui.h" @@ -42,6 +43,10 @@ #include "yaze_config.h" #ifdef YAZE_WITH_GRPC +// Forward declarations for gRPC-dependent types +namespace yaze::agent { +class AgentControlServer; +} #endif namespace yaze { @@ -103,13 +108,9 @@ class EditorSet { */ class EditorManager { public: - EditorManager() : blank_editor_set_(nullptr, &user_settings_) { - std::stringstream ss; - ss << YAZE_VERSION_MAJOR << "." << YAZE_VERSION_MINOR << "." - << YAZE_VERSION_PATCH; - ss >> version_; - context_.popup_manager = popup_manager_.get(); - } + // Constructor and destructor must be defined in .cc file for std::unique_ptr with forward-declared types + EditorManager(); + ~EditorManager(); void Initialize(gfx::IRenderer* renderer, const std::string& filename = ""); @@ -278,7 +279,7 @@ class EditorManager { #ifdef YAZE_WITH_GRPC // Agent editor - manages chat, collaboration, and network coordination AgentEditor agent_editor_; - std::unique_ptr agent_control_server_; + std::unique_ptr agent_control_server_; #endif std::string version_ = ""; diff --git a/src/app/editor/system/command_manager.h b/src/app/editor/system/command_manager.h index 0eb91ba0..773c6e74 100644 --- a/src/app/editor/system/command_manager.h +++ b/src/app/editor/system/command_manager.h @@ -6,6 +6,11 @@ #include #include +// Must define before including imgui.h +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/system/shortcut_manager.h b/src/app/editor/system/shortcut_manager.h index 29f8045d..4b0a7442 100644 --- a/src/app/editor/system/shortcut_manager.h +++ b/src/app/editor/system/shortcut_manager.h @@ -5,6 +5,11 @@ #include #include +// Must define before including imgui.h +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/system/toast_manager.h b/src/app/editor/system/toast_manager.h index 8e6ddad0..dc80eb52 100644 --- a/src/app/editor/system/toast_manager.h +++ b/src/app/editor/system/toast_manager.h @@ -4,6 +4,11 @@ #include #include +// Must define before including imgui.h +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/editor/ui/menu_builder.h b/src/app/editor/ui/menu_builder.h index f429f942..a9141d8a 100644 --- a/src/app/editor/ui/menu_builder.h +++ b/src/app/editor/ui/menu_builder.h @@ -5,6 +5,11 @@ #include #include +// Must define before including imgui.h +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include "app/gui/icons.h" #include "imgui/imgui.h" diff --git a/src/app/platform/app_delegate.mm b/src/app/platform/app_delegate.mm index 05afdfc6..bba99934 100644 --- a/src/app/platform/app_delegate.mm +++ b/src/app/platform/app_delegate.mm @@ -1,4 +1,10 @@ // AppDelegate.mm + +// Must define before any ImGui includes (needed by imgui_test_engine via editor_manager.h) +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #import "app/platform/app_delegate.h" #import "app/core/controller.h" #import "util/file_util.h" diff --git a/test/integration/asar_rom_test.cc b/test/integration/asar_rom_test.cc index 1389c892..dfa06621 100644 --- a/test/integration/asar_rom_test.cc +++ b/test/integration/asar_rom_test.cc @@ -1,3 +1,8 @@ +// Must define before any ImGui includes +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include #include #include diff --git a/test/integration/zelda3/dungeon_object_rendering_tests.cc b/test/integration/zelda3/dungeon_object_rendering_tests.cc index 3b2b1ac0..38f94322 100644 --- a/test/integration/zelda3/dungeon_object_rendering_tests.cc +++ b/test/integration/zelda3/dungeon_object_rendering_tests.cc @@ -2,6 +2,10 @@ // Updated for DungeonEditorV2 architecture - uses ObjectDrawer (production system) // instead of the obsolete ObjectRenderer +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include "app/zelda3/dungeon/object_drawer.h" #include "app/zelda3/dungeon/room.h" #include "app/zelda3/dungeon/room_object.h" diff --git a/test/test_utils.h b/test/test_utils.h index 77fb1fc7..7552a149 100644 --- a/test/test_utils.h +++ b/test/test_utils.h @@ -1,6 +1,10 @@ #ifndef YAZE_TEST_TEST_UTILS_H #define YAZE_TEST_TEST_UTILS_H +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include #include #include diff --git a/test/yaze_test.cc b/test/yaze_test.cc index 2ff57f45..d19aa743 100644 --- a/test/yaze_test.cc +++ b/test/yaze_test.cc @@ -1,5 +1,10 @@ #define SDL_MAIN_HANDLED +// Must define before any ImGui includes +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif + #include #include #include