Main controller for the application. More...
#include <controller.h>

Classes | |
| struct | ScreenshotRequest |
Public Member Functions | |
| bool | IsActive () const |
| absl::Status | OnEntry (std::string filename="") |
| void | OnInput () |
| absl::Status | OnLoad () |
| void | DoRender () const |
| void | OnExit () |
| void | RequestScreenshot (const ScreenshotRequest &request) |
| void | SetStartupEditor (const std::string &editor_name, const std::string &cards) |
| void | ShowWindow () |
| void | HideWindow () |
| auto | window () -> SDL_Window * |
| void | set_active (bool active) |
| auto | active () const |
| auto | overworld () -> yaze::zelda3::Overworld * |
| auto | GetCurrentRom () -> Rom * |
| auto | renderer () -> gfx::IRenderer * |
| editor::EditorManager * | editor_manager () |
| platform::IWindowBackend * | window_backend () |
| void | SetWindowBackendForTesting (std::unique_ptr< platform::IWindowBackend > window_backend) |
| absl::Status | LoadRomForTesting (const std::string &rom_path) |
Private Member Functions | |
| friend | int::main (int argc, char **argv) |
| void | ProcessScreenshotRequests () const |
Private Attributes | |
| bool | active_ = false |
| std::chrono::steady_clock::time_point | last_event_time_ |
| bool | window_hidden_ = false |
| std::chrono::steady_clock::time_point | last_frame_end_ |
| std::unique_ptr< platform::IWindowBackend > | window_backend_ |
| editor::EditorManager | editor_manager_ |
| std::unique_ptr< gfx::IRenderer > | renderer_ |
| std::mutex | screenshot_mutex_ |
| std::queue< ScreenshotRequest > | screenshot_requests_ |
Main controller for the application.
This class is responsible for managing the main window and the main editor. It is the main entry point for the application.
Definition at line 35 of file controller.h.
|
inline |
Definition at line 45 of file controller.h.
References active_.
| absl::Status yaze::Controller::OnEntry | ( | std::string | filename = "" | ) |
Definition at line 213 of file controller.cc.
References active_, yaze::gfx::RendererFactory::Create(), yaze::platform::WindowBackendFactory::Create(), editor_manager_, yaze::editor::EditorManager::emulator(), yaze::gfx::Arena::Get(), yaze::test::TestManager::Get(), yaze::Application::GetConfig(), yaze::gfx::RendererFactory::GetDefaultBackendType(), yaze::platform::WindowBackendFactory::GetDefaultType(), yaze::platform::WindowConfig::hidden, yaze::platform::WindowConfig::high_dpi, yaze::editor::EditorManager::Initialize(), yaze::gfx::Arena::Initialize(), yaze::test::TestManager::InitializeUITesting(), yaze::Application::Instance(), yaze::platform::IOS, LOG_INFO, yaze::gfx::Metal, yaze::gfx::Null, yaze::platform::Null, renderer_, yaze::platform::WindowConfig::resizable, RETURN_IF_ERROR, yaze::editor::EditorManager::SetAssetLoadMode(), yaze::platform::WindowConfig::title, and window_backend_.
| void yaze::Controller::OnInput | ( | ) |
Definition at line 298 of file controller.cc.
References yaze::platform::Close, editor_manager_, yaze::editor::EditorManager::emulator(), yaze::platform::Exposed, yaze::util::LogManager::Flush(), yaze::platform::FocusGained, yaze::platform::FocusLost, yaze::test::TestManager::Get(), yaze::editor::EditorManager::HandleHostVisibilityChanged(), yaze::platform::WindowEvent::has_native_event, yaze::platform::Hidden, yaze::util::LogManager::instance(), last_event_time_, yaze::platform::Minimized, yaze::platform::WindowEvent::native_event, yaze::editor::EditorManager::Quit(), yaze::platform::Quit, yaze::platform::Restored, screenshot_mutex_, screenshot_requests_, yaze::platform::Shown, yaze::platform::WindowEvent::type, yaze::editor::EditorManager::WantsContinuousFrames(), window_backend_, and window_hidden_.
| absl::Status yaze::Controller::OnLoad | ( | ) |
Definition at line 399 of file controller.cc.
References active_, yaze::gui::DockSpaceRenderer::BeginEnhancedDockSpace(), yaze::gui::WidgetIdRegistry::BeginFrame(), yaze::platform::ios::EditorStateSnapshot::can_redo, yaze::platform::ios::EditorStateSnapshot::can_save, yaze::platform::ios::EditorStateSnapshot::can_undo, yaze::editor::FrameGuiBeginEvent::Create(), yaze::Rom::dirty(), yaze::editor::EditorManager::DrawMainMenuBar(), yaze::editor::UICoordinator::DrawMenuBarRestoreButton(), editor_manager_, yaze::platform::ios::EditorStateSnapshot::editor_type, yaze::editor::EditorTypeIndex(), yaze::gui::DockSpaceRenderer::EndEnhancedDockSpace(), yaze::gui::WidgetIdRegistry::EndFrame(), yaze::editor::ContentRegistry::Context::event_bus(), yaze::gui::ThemeManager::Get(), yaze::editor::EditorManager::GetBottomLayoutOffset(), yaze::editor::EditorManager::GetCurrentEditor(), yaze::editor::EditorManager::GetCurrentRom(), yaze::editor::EditorManager::GetLeftLayoutOffset(), yaze::platform::ios::GetOverlayTopInset(), yaze::editor::EditorManager::GetRightLayoutOffset(), yaze::platform::ios::GetSafeAreaInsets(), yaze::gui::WidgetIdRegistry::Instance(), yaze::platform::ios::EditorStateSnapshot::is_dirty, yaze::Rom::is_loaded(), yaze::editor::UICoordinator::IsMenuBarVisible(), yaze::editor::kEditorNames, yaze::editor::ContentRegistry::Context::layout_manager(), yaze::platform::ios::PostEditorStateUpdate(), yaze::editor::EditorManager::quit(), RETURN_IF_ERROR, yaze::platform::ios::EditorStateSnapshot::rom_title, yaze::Rom::title(), yaze::editor::EditorManager::ui_coordinator(), yaze::editor::EditorManager::Update(), yaze::gui::ThemeManager::UpdateTransition(), yaze::editor::ContentRegistry::Context::user_settings(), and window_backend_.
| void yaze::Controller::DoRender | ( | ) | const |
Definition at line 543 of file controller.cc.
References yaze::gfx::Arena::DrainRetiredBitmaps(), editor_manager_, yaze::gfx::Arena::Get(), yaze::test::TestManager::Get(), yaze::editor::EditorManager::GetUiSyncStateSnapshot(), yaze::Application::Instance(), last_frame_end_, yaze::editor::EditorManager::UiSyncState::layout_rebuild_pending, yaze::test::TestManager::OnPostSwap(), ProcessScreenshotRequests(), yaze::gfx::Arena::ProcessTextureQueue(), yaze::gfx::Arena::ProcessTextureQueueWithBudget(), renderer_, and window_backend_.
| void yaze::Controller::OnExit | ( | ) |
Definition at line 600 of file controller.cc.
References yaze::test::TestManager::DestroyUITestingContext(), yaze::gfx::Arena::DrainRetiredBitmaps(), yaze::gfx::Arena::Get(), yaze::test::TestManager::Get(), yaze::gfx::Arena::Initialize(), renderer_, yaze::test::TestManager::StopUITesting(), and window_backend_.
| void yaze::Controller::RequestScreenshot | ( | const ScreenshotRequest & | request | ) |
Definition at line 638 of file controller.cc.
References screenshot_mutex_, and screenshot_requests_.
| void yaze::Controller::SetStartupEditor | ( | const std::string & | editor_name, |
| const std::string & | cards ) |
Definition at line 289 of file controller.cc.
References editor_manager_, and yaze::editor::EditorManager::OpenEditorAndPanelsFromFlags().

|
inline |
Definition at line 60 of file controller.h.
References window_backend_.
|
inline |
Definition at line 64 of file controller.h.
References window_backend_.
|
inline |
Definition at line 69 of file controller.h.
References window_backend_.
|
inline |
Definition at line 72 of file controller.h.
References active(), and active_.

|
inline |
|
inline |
Definition at line 74 of file controller.h.
References editor_manager_, and yaze::editor::EditorManager::overworld().

|
inline |
Definition at line 77 of file controller.h.
References editor_manager_, and yaze::editor::EditorManager::GetCurrentRom().

|
inline |
Definition at line 78 of file controller.h.
References renderer_.
|
inline |
Definition at line 81 of file controller.h.
References editor_manager_.
Referenced by yaze::app::GetGlobalEditorManager(), yaze::app::GetGlobalEmulator(), and main().
|
inline |
Definition at line 84 of file controller.h.
References window_backend_.
Referenced by SetWindowBackendForTesting().
|
inline |
Definition at line 87 of file controller.h.
References window_backend(), and window_backend_.

| absl::Status yaze::Controller::LoadRomForTesting | ( | const std::string & | rom_path | ) |
Definition at line 625 of file controller.cc.
References yaze::editor::EditorManager::asset_load_mode(), editor_manager_, yaze::kFull, yaze::editor::EditorManager::OpenRomOrProject(), and yaze::editor::EditorManager::SetAssetLoadMode().

|
private |
|
private |
Definition at line 643 of file controller.cc.
References yaze::Application::Instance(), screenshot_mutex_, and screenshot_requests_.
Referenced by DoRender().

|
private |
Definition at line 105 of file controller.h.
Referenced by active(), IsActive(), OnEntry(), OnLoad(), and set_active().
|
private |
Definition at line 108 of file controller.h.
Referenced by OnInput().
|
private |
Definition at line 110 of file controller.h.
Referenced by OnInput().
|
mutableprivate |
Definition at line 112 of file controller.h.
Referenced by DoRender().
|
private |
Definition at line 114 of file controller.h.
Referenced by DoRender(), HideWindow(), OnEntry(), OnExit(), OnInput(), OnLoad(), SetWindowBackendForTesting(), ShowWindow(), window(), and window_backend().
|
private |
Definition at line 115 of file controller.h.
Referenced by DoRender(), editor_manager(), GetCurrentRom(), LoadRomForTesting(), OnEntry(), OnInput(), OnLoad(), overworld(), and SetStartupEditor().
|
private |
Definition at line 116 of file controller.h.
Referenced by DoRender(), OnEntry(), OnExit(), and renderer().
|
mutableprivate |
Definition at line 119 of file controller.h.
Referenced by OnInput(), ProcessScreenshotRequests(), and RequestScreenshot().
|
mutableprivate |
Definition at line 120 of file controller.h.
Referenced by OnInput(), ProcessScreenshotRequests(), and RequestScreenshot().