#include "BenGui.hpp" #include #include #define IMGUI_DEFINE_MATH_OPERATORS #include #include #include #include "UIWidgets.hpp" #include "HudEditor.h" #ifdef __APPLE__ #include "graphic/Fast3D/gfx_metal.h" #endif #ifdef __SWITCH__ #include #endif #include "include/global.h" #include "include/z64audio.h" bool ShouldClearTextureCacheAtEndOfFrame = false; namespace BenGui { // MARK: - Delegates std::shared_ptr mBenMenuBar; std::shared_ptr mConsoleWindow; std::shared_ptr mStatsWindow; std::shared_ptr mInputEditorWindow; std::shared_ptr mGfxDebuggerWindow; std::shared_ptr mSaveEditorWindow; std::shared_ptr mHudEditorWindow; std::shared_ptr mActorViewerWindow; std::shared_ptr mCollisionViewerWindow; std::shared_ptr mEventLogWindow; void SetupGuiElements() { auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui(); auto& style = ImGui::GetStyle(); style.FramePadding = ImVec2(4.0f, 6.0f); style.ItemSpacing = ImVec2(8.0f, 6.0f); style.Colors[ImGuiCol_MenuBarBg] = UIWidgets::Colors::DarkGray; mBenMenuBar = std::make_shared(CVAR_MENU_BAR_OPEN, CVarGetInteger(CVAR_MENU_BAR_OPEN, 0)); gui->SetMenuBar(std::reinterpret_pointer_cast(mBenMenuBar)); if (gui->GetMenuBar() && !gui->GetMenuBar()->IsVisible()) { #if defined(__SWITCH__) || defined(__WIIU__) gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Press - to access enhancements menu"); #else gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Press F1 to access enhancements menu"); #endif } mStatsWindow = gui->GetGuiWindow("Stats"); if (mStatsWindow == nullptr) { SPDLOG_ERROR("Could not find stats window"); } mConsoleWindow = gui->GetGuiWindow("Console"); if (mConsoleWindow == nullptr) { SPDLOG_ERROR("Could not find console window"); } mInputEditorWindow = gui->GetGuiWindow("Input Editor"); if (mInputEditorWindow == nullptr) { SPDLOG_ERROR("Could not find input editor window"); } mGfxDebuggerWindow = gui->GetGuiWindow("GfxDebuggerWindow"); if (mGfxDebuggerWindow == nullptr) { SPDLOG_ERROR("Could not find input GfxDebuggerWindow"); } mSaveEditorWindow = std::make_shared("gWindows.SaveEditor", "Save Editor"); gui->AddGuiWindow(mSaveEditorWindow); mHudEditorWindow = std::make_shared("gWindows.HudEditor", "Hud Editor"); gui->AddGuiWindow(mHudEditorWindow); mActorViewerWindow = std::make_shared("gWindows.ActorViewer", "Actor Viewer"); gui->AddGuiWindow(mActorViewerWindow); mCollisionViewerWindow = std::make_shared("gWindows.CollisionViewer", "Collision Viewer"); gui->AddGuiWindow(mCollisionViewerWindow); mEventLogWindow = std::make_shared("gWindows.EventLog", "Event Log"); gui->AddGuiWindow(mEventLogWindow); } void Destroy() { mBenMenuBar = nullptr; mStatsWindow = nullptr; mConsoleWindow = nullptr; mInputEditorWindow = nullptr; mGfxDebuggerWindow = nullptr; mCollisionViewerWindow = nullptr; mEventLogWindow = nullptr; mSaveEditorWindow = nullptr; mHudEditorWindow = nullptr; mActorViewerWindow = nullptr; } } // namespace BenGui