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) |
| absl::StatusOr< std::string > | RequestEditorControl (const std::string &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_ |
| app::EditorControlQueue | editor_control_queue_ |
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 36 of file controller.h.
|
inline |
Definition at line 46 of file controller.h.
References active_.
| absl::Status yaze::Controller::OnEntry | ( | std::string | filename = "" | ) |
Definition at line 214 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::util::UiThreadQueue::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, yaze::editor::ContentRegistry::Context::layout_manager(), LOG_INFO, yaze::gfx::Metal, yaze::gfx::Null, yaze::platform::Null, renderer_, yaze::platform::WindowConfig::resizable, RETURN_IF_ERROR, yaze::editor::EditorManager::SetAssetLoadMode(), yaze::util::UiThreadQueue::SetWaker(), yaze::platform::WindowConfig::title, and window_backend_.
| void yaze::Controller::OnInput | ( | ) |
Definition at line 317 of file controller.cc.
References yaze::util::MainLoopIdleState::busy, yaze::platform::Close, editor_control_queue_, editor_manager_, yaze::editor::EditorManager::emulator(), yaze::platform::Exposed, yaze::util::LogManager::Flush(), yaze::platform::FocusGained, yaze::platform::FocusLost, yaze::test::TestManager::Get(), yaze::util::UiThreadQueue::Get(), yaze::editor::EditorManager::HandleHostVisibilityChanged(), yaze::platform::WindowEvent::has_native_event, yaze::util::UiThreadQueue::HasPendingTasks(), yaze::platform::Hidden, yaze::util::LogManager::instance(), yaze::platform::IsWakeEvent(), last_event_time_, yaze::util::MainLoopEventWaitMs(), yaze::platform::Minimized, yaze::platform::WindowEvent::native_event, yaze::app::EditorControlQueue::pending(), yaze::util::MainLoopIdleState::quiet_for, yaze::editor::EditorManager::Quit(), yaze::platform::Quit, yaze::platform::Restored, screenshot_mutex_, screenshot_requests_, yaze::platform::Shown, yaze::platform::WindowEvent::type, yaze::util::MainLoopIdleState::ui_tasks_pending, yaze::editor::EditorManager::WantsContinuousFrames(), window_backend_, yaze::util::MainLoopIdleState::window_hidden, and window_hidden_.
| absl::Status yaze::Controller::OnLoad | ( | ) |
Definition at line 434 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::util::UiThreadQueue::Drain(), yaze::editor::LayoutManager::DrawEditorHost(), yaze::editor::EditorManager::DrawMainMenuBar(), yaze::editor::UICoordinator::DrawMenuBarRestoreButton(), editor_control_queue_, 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::editor::EditorManager::ExecuteEditorControl(), yaze::gui::ThemeManager::Get(), yaze::util::UiThreadQueue::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::editor::LayoutManager::OuterDockspaceId(), yaze::platform::ios::PostEditorStateUpdate(), yaze::app::EditorControlQueue::ProcessOne(), yaze::editor::EditorManager::quit(), RETURN_IF_ERROR, yaze::platform::ios::EditorStateSnapshot::rom_title, yaze::util::UiThreadQueue::Shutdown(), 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 596 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 653 of file controller.cc.
References yaze::test::TestManager::DestroyUITestingContext(), yaze::gfx::Arena::DrainRetiredBitmaps(), yaze::gfx::Arena::Get(), yaze::test::TestManager::Get(), yaze::util::UiThreadQueue::Get(), yaze::gfx::Arena::Initialize(), renderer_, yaze::test::TestManager::StopUITesting(), and window_backend_.
| void yaze::Controller::RequestScreenshot | ( | const ScreenshotRequest & | request | ) |
Definition at line 9 of file controller_screenshot.cc.
References yaze::util::UiThreadQueue::Get(), yaze::util::UiThreadQueue::Post(), screenshot_mutex_, and screenshot_requests_.

| absl::StatusOr< std::string > yaze::Controller::RequestEditorControl | ( | const std::string & | request | ) |
Definition at line 429 of file controller.cc.
References editor_control_queue_, and yaze::app::EditorControlQueue::Submit().

| void yaze::Controller::SetStartupEditor | ( | const std::string & | editor_name, |
| const std::string & | cards ) |
Definition at line 308 of file controller.cc.
References editor_manager_, and yaze::editor::EditorManager::OpenEditorAndPanelsFromFlags().

|
inline |
Definition at line 64 of file controller.h.
References window_backend_.
|
inline |
Definition at line 68 of file controller.h.
References window_backend_.
|
inline |
Definition at line 73 of file controller.h.
References window_backend_.
|
inline |
Definition at line 76 of file controller.h.
References active(), and active_.

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

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

|
inline |
Definition at line 82 of file controller.h.
References renderer_.
|
inline |
Definition at line 85 of file controller.h.
References editor_manager_.
Referenced by yaze::app::GetGlobalEditorManager(), yaze::app::GetGlobalEmulator(), and main().
|
inline |
Definition at line 88 of file controller.h.
References window_backend_.
Referenced by SetWindowBackendForTesting().
|
inline |
Definition at line 91 of file controller.h.
References window_backend(), and window_backend_.

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

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

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