7#include "absl/status/status.h"
17#include "imgui/imgui.h"
27 config.
title =
"Yet Another Zelda3 Editor";
36 return absl::InternalError(
"Failed to initialize renderer");
56 return absl::OkStatus();
60 const std::string& panels) {
63 if (!editor_name.empty()) {
94 return absl::InternalError(
"Window backend not initialized");
99 return absl::OkStatus();
102#if TARGET_OS_IPHONE != 1
107 const ImGuiViewport* viewport = ImGui::GetMainViewport();
115 ImVec2 dockspace_pos = viewport->WorkPos;
116 ImVec2 dockspace_size = viewport->WorkSize;
118 dockspace_pos.x += left_offset;
119 dockspace_size.x -= (left_offset + right_offset);
120 dockspace_size.y -= bottom_offset;
122 ImGui::SetNextWindowPos(dockspace_pos);
123 ImGui::SetNextWindowSize(dockspace_size);
124 ImGui::SetNextWindowViewport(viewport->ID);
127 bool show_menu_bar =
true;
132 ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking;
134 window_flags |= ImGuiWindowFlags_MenuBar;
136 window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse |
137 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
139 ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus |
140 ImGuiWindowFlags_NoBackground;
142 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
143 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
144 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
145 ImGui::Begin(
"DockSpaceWindow",
nullptr, window_flags);
146 ImGui::PopStyleVar(3);
149 ImGuiID dockspace_id = ImGui::GetID(
"MainDockSpace");
151 dockspace_id, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_PassthruCentralNode);
169 return absl::OkStatus();
190 if (delta_time < 0.007f) {
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_
std::unique_ptr< gfx::IRenderer > renderer_
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 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()
SDL2/SDL3 compatibility layer.
#define RETURN_IF_ERROR(expr)