yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::Controller Class Reference

Main controller for the application. More...

#include <controller.h>

Collaboration diagram for yaze::Controller:

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_
 

Detailed Description

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.

Member Function Documentation

◆ IsActive()

bool yaze::Controller::IsActive ( ) const
inline

Definition at line 45 of file controller.h.

References active_.

◆ OnEntry()

◆ OnInput()

◆ OnLoad()

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_.

◆ DoRender()

◆ OnExit()

◆ RequestScreenshot()

void yaze::Controller::RequestScreenshot ( const ScreenshotRequest & request)

Definition at line 638 of file controller.cc.

References screenshot_mutex_, and screenshot_requests_.

◆ SetStartupEditor()

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().

Here is the call graph for this function:

◆ ShowWindow()

void yaze::Controller::ShowWindow ( )
inline

Definition at line 60 of file controller.h.

References window_backend_.

◆ HideWindow()

void yaze::Controller::HideWindow ( )
inline

Definition at line 64 of file controller.h.

References window_backend_.

◆ window()

auto yaze::Controller::window ( ) -> SDL_Window*
inline

Definition at line 69 of file controller.h.

References window_backend_.

◆ set_active()

void yaze::Controller::set_active ( bool active)
inline

Definition at line 72 of file controller.h.

References active(), and active_.

Here is the call graph for this function:

◆ active()

auto yaze::Controller::active ( ) const
inline

Definition at line 73 of file controller.h.

References active_.

Referenced by set_active().

◆ overworld()

auto yaze::Controller::overworld ( ) -> yaze::zelda3::Overworld*
inline

Definition at line 74 of file controller.h.

References editor_manager_, and yaze::editor::EditorManager::overworld().

Here is the call graph for this function:

◆ GetCurrentRom()

auto yaze::Controller::GetCurrentRom ( ) -> Rom*
inline

Definition at line 77 of file controller.h.

References editor_manager_, and yaze::editor::EditorManager::GetCurrentRom().

Here is the call graph for this function:

◆ renderer()

auto yaze::Controller::renderer ( ) -> gfx::IRenderer*
inline

Definition at line 78 of file controller.h.

References renderer_.

◆ editor_manager()

editor::EditorManager * yaze::Controller::editor_manager ( )
inline

Definition at line 81 of file controller.h.

References editor_manager_.

Referenced by yaze::app::GetGlobalEditorManager(), yaze::app::GetGlobalEmulator(), and main().

◆ window_backend()

platform::IWindowBackend * yaze::Controller::window_backend ( )
inline

Definition at line 84 of file controller.h.

References window_backend_.

Referenced by SetWindowBackendForTesting().

◆ SetWindowBackendForTesting()

void yaze::Controller::SetWindowBackendForTesting ( std::unique_ptr< platform::IWindowBackend > window_backend)
inline

Definition at line 87 of file controller.h.

References window_backend(), and window_backend_.

Here is the call graph for this function:

◆ LoadRomForTesting()

absl::Status yaze::Controller::LoadRomForTesting ( const std::string & rom_path)

◆ int::main()

yaze::Controller::int::main ( int argc,
char ** argv )
private

◆ ProcessScreenshotRequests()

void yaze::Controller::ProcessScreenshotRequests ( ) const
private

Definition at line 643 of file controller.cc.

References yaze::Application::Instance(), screenshot_mutex_, and screenshot_requests_.

Referenced by DoRender().

Here is the call graph for this function:

Member Data Documentation

◆ active_

bool yaze::Controller::active_ = false
private

Definition at line 105 of file controller.h.

Referenced by active(), IsActive(), OnEntry(), OnLoad(), and set_active().

◆ last_event_time_

std::chrono::steady_clock::time_point yaze::Controller::last_event_time_
private
Initial value:
=
std::chrono::steady_clock::now()

Definition at line 108 of file controller.h.

Referenced by OnInput().

◆ window_hidden_

bool yaze::Controller::window_hidden_ = false
private

Definition at line 110 of file controller.h.

Referenced by OnInput().

◆ last_frame_end_

std::chrono::steady_clock::time_point yaze::Controller::last_frame_end_
mutableprivate
Initial value:
=
std::chrono::steady_clock::now()

Definition at line 112 of file controller.h.

Referenced by DoRender().

◆ window_backend_

std::unique_ptr<platform::IWindowBackend> yaze::Controller::window_backend_
private

◆ editor_manager_

editor::EditorManager yaze::Controller::editor_manager_
private

◆ renderer_

std::unique_ptr<gfx::IRenderer> yaze::Controller::renderer_
private

Definition at line 116 of file controller.h.

Referenced by DoRender(), OnEntry(), OnExit(), and renderer().

◆ screenshot_mutex_

std::mutex yaze::Controller::screenshot_mutex_
mutableprivate

Definition at line 119 of file controller.h.

Referenced by OnInput(), ProcessScreenshotRequests(), and RequestScreenshot().

◆ screenshot_requests_

std::queue<ScreenshotRequest> yaze::Controller::screenshot_requests_
mutableprivate

Definition at line 120 of file controller.h.

Referenced by OnInput(), ProcessScreenshotRequests(), and RequestScreenshot().


The documentation for this class was generated from the following files: