6#include <TargetConditionals.h>
11#include "absl/status/status.h"
22#include "imgui/imgui.h"
30#if defined(__APPLE__) && (TARGET_OS_IPHONE == 1 || TARGET_IPHONE_SIMULATOR == 1)
37 return absl::InternalError(
"Failed to create window backend");
41 config.
title =
"Yet Another Zelda3 Editor";
50 return absl::InternalError(
"Failed to initialize renderer");
70 return absl::OkStatus();
74 const std::string& panels) {
77 if (!editor_name.empty()) {
108 return absl::InternalError(
"Window backend not initialized");
113 return absl::OkStatus();
116#if TARGET_OS_IPHONE != 1
121 const ImGuiViewport* viewport = ImGui::GetMainViewport();
129 ImVec2 dockspace_pos = viewport->WorkPos;
130 ImVec2 dockspace_size = viewport->WorkSize;
132 dockspace_pos.x += left_offset;
133 dockspace_size.x -= (left_offset + right_offset);
134 dockspace_size.y -= bottom_offset;
136 ImGui::SetNextWindowPos(dockspace_pos);
137 ImGui::SetNextWindowSize(dockspace_size);
138 ImGui::SetNextWindowViewport(viewport->ID);
141 bool show_menu_bar =
true;
146 ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking;
148 window_flags |= ImGuiWindowFlags_MenuBar;
150 window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse |
151 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
153 ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus |
154 ImGuiWindowFlags_NoBackground;
156 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
157 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
158 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
159 ImGui::Begin(
"DockSpaceWindow",
nullptr, window_flags);
160 ImGui::PopStyleVar(3);
163 ImGuiID dockspace_id = ImGui::GetID(
"MainDockSpace");
165 dockspace_id, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_PassthruCentralNode);
188 return absl::OkStatus();
212 if (delta_time < 0.007f) {
213#if TARGET_OS_IPHONE != 1
250 auto result = test::CaptureHarnessScreenshot(request.preferred_path);
251 if (request.callback) {
252 request.callback(result);
std::queue< ScreenshotRequest > screenshot_requests_
editor::EditorManager editor_manager_
absl::Status LoadRomForTesting(const std::string &rom_path)
absl::Status OnEntry(std::string filename="")
void SetStartupEditor(const std::string &editor_name, const std::string &cards)
std::unique_ptr< platform::IWindowBackend > window_backend_
void ProcessScreenshotRequests() const
void RequestScreenshot(const ScreenshotRequest &request)
std::unique_ptr< gfx::IRenderer > renderer_
std::mutex screenshot_mutex_
static TimingManager & Get()
float Update()
Update the timing manager (call once per frame)
float GetRightLayoutOffset() const
void DrawMenuBar()
Draw the main menu bar.
UICoordinator * ui_coordinator()
void Initialize(gfx::IRenderer *renderer, const std::string &filename="")
float GetBottomLayoutOffset() const
void OpenEditorAndPanelsFromFlags(const std::string &editor_name, const std::string &panels_str)
absl::Status Update()
Main update loop for the editor application.
auto emulator() -> emu::Emulator &
absl::Status OpenRomOrProject(const std::string &filename)
float GetLeftLayoutOffset() const
bool IsMenuBarVisible() const
void DrawMenuBarRestoreButton()
void Initialize(IRenderer *renderer)
void ProcessTextureQueue(IRenderer *renderer)
static RendererBackendType GetDefaultBackendType()
Get the default backend type for this build.
static std::unique_ptr< IRenderer > Create(RendererBackendType type=RendererBackendType::kDefault)
Create a renderer instance with the specified backend type.
static void BeginEnhancedDockSpace(ImGuiID dockspace_id, const ImVec2 &size=ImVec2(0, 0), ImGuiDockNodeFlags flags=0)
static void EndEnhancedDockSpace()
@ Metal
Metal renderer backend (Apple platforms)
SDL2/SDL3 compatibility layer.
#define RETURN_IF_ERROR(expr)