yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
tile16_editor_view.cc
Go to the documentation of this file.
2
3#include <string>
4
9#include "util/log.h"
10
11namespace yaze::editor {
12
13void Tile16EditorView::Draw(bool* p_open) {
14 (void)p_open;
15 const auto ctx = CurrentOverworldWindowContext();
16 if (!ctx || !ctx.editor->IsRomLoaded()) {
18 return;
19 }
20 if (ctx.editor->is_lyra_preview()) {
21 ImGui::TextDisabled("Lyra preview: Tile16 editing unavailable");
22 return;
23 }
24
25 // Log a failure once per distinct message; this runs every frame.
26 static std::string last_error;
27 if (auto status = ctx.editor->tile16_editor().UpdateAsPanel(); !status.ok()) {
28 if (status.ToString() != last_error) {
29 last_error = status.ToString();
30 LOG_ERROR("Tile16EditorView", "Failed to draw: %s", last_error.c_str());
31 }
32 } else {
33 last_error.clear();
34 }
35}
36
38
39} // namespace yaze::editor
WindowContent wrapper for Tile16Editor.
void Draw(bool *p_open) override
Draw the panel content.
#define LOG_ERROR(category, format,...)
Definition log.h:140
Editors are the view controllers for the application.
OverworldWindowContext CurrentOverworldWindowContext()
bool DrawEmptyState(const EmptyStateOptions &options)
Draw a centered empty-state block.
EmptyStateOptions EmptyNoRom(bool compact)
#define REGISTER_PANEL(PanelClass)
Auto-registration macro for panels with default constructors.