yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
overworld_canvas_renderer.cc
Go to the documentation of this file.
1// Related header
3#include "util/i18n/tr.h"
4
5#ifndef IM_PI
6#define IM_PI 3.14159265358979323846f
7#endif
8
9// C++ standard library headers
10#include <memory>
11#include <string>
12
13// Third-party library headers
14#include "absl/status/status.h"
15#include "absl/strings/str_format.h"
16#include "imgui/imgui.h"
17
18// Project headers
29#include "app/gfx/core/bitmap.h"
34#include "app/gui/core/icons.h"
35#include "app/gui/core/style.h"
38#include "rom/rom.h"
39#include "util/log.h"
41
42namespace yaze::editor {
43
46
47// =============================================================================
48// Main Canvas Drawing
49// =============================================================================
50
52 if (!editor_) {
53 return;
54 }
55
56 // Simplified map settings - compact row with popup panels for detailed
57 // editing
58 if (editor_->rom_ != nullptr && editor_->rom_->is_loaded() &&
60 const EditingMode old_mode = editor_->current_mode;
61 bool has_selection = editor_->ow_map_canvas_.select_rect_active() &&
63
64 // Check if scratch space has data
65 bool scratch_has_data = editor_->scratch_space_.in_use;
66
67 // Pass WorkspaceWindowManager to toolbar for panel visibility management
68 editor_->toolbar_->Draw(
72 has_selection, scratch_has_data, editor_->rom_, &editor_->overworld_,
76
77 // Toolbar toggles don't currently update canvas usage mode.
78 if (old_mode != editor_->current_mode) {
82 } else {
84 }
85 }
86 }
87
88 // ==========================================================================
89 // PHASE 3: Modern BeginCanvas/EndCanvas Pattern
90 // ==========================================================================
91 // Context menu setup MUST happen BEFORE BeginCanvas (lesson from dungeon)
92 bool show_context_menu =
95 editor_->entity_renderer_->hovered_entity() == nullptr);
96
97 if (editor_->rom_ != nullptr && editor_->rom_->is_loaded() &&
100 const int context_map = editor_->hovered_map_ >= 0 ? editor_->hovered_map_
102 editor_->map_properties_system_->SetupCanvasContextMenu(
106 static_cast<int>(editor_->current_mode), editor_->dependencies_.project,
108 }
109
110 // Configure canvas frame options
111 gui::CanvasFrameOptions frame_opts;
113 frame_opts.draw_grid = true;
114 frame_opts.grid_step = 64.0f; // Map boundaries (512px / 8 maps)
115 frame_opts.draw_context_menu = show_context_menu;
116 frame_opts.draw_overlay = true;
117 frame_opts.render_popups = true;
118 frame_opts.use_child_window = false; // CRITICAL: Canvas has own pan logic
119
120 // Wrap in child window for scrollbars
123
124 // Keep canvas scroll at 0 - ImGui's child window handles all scrolling
125 // The scrollbars scroll the child window which moves the entire canvas
126 editor_->ow_map_canvas_.set_scrolling(ImVec2(0, 0));
127
128 // Begin canvas frame - this handles DrawBackground + DrawContextMenu
129 auto canvas_rt = gui::BeginCanvas(editor_->ow_map_canvas_, frame_opts);
131
132 // Handle pan via ImGui scrolling (instead of canvas internal scroll)
135
137 // Draw the 64 overworld map bitmaps
139
140 // Draw all entities using the new CanvasRuntime-based methods
142 editor_->entity_renderer_->DrawExits(canvas_rt, editor_->current_world_);
143 editor_->entity_renderer_->DrawEntrances(canvas_rt,
145 editor_->entity_renderer_->DrawItems(canvas_rt, editor_->current_world_);
146 editor_->entity_renderer_->DrawSprites(canvas_rt, editor_->current_world_,
148 }
149
150 // Draw overlay preview if enabled
152 editor_->map_properties_system_->DrawOverlayPreviewOnMap(
155 }
156
160 }
161
162 // Use canvas runtime hover state for map detection
163 if (canvas_rt.hovered) {
166 }
167
168 // --- BEGIN ENTITY DRAG/DROP LOGIC ---
171 auto hovered_entity = editor_->entity_renderer_->hovered_entity();
172
173 // 1. Initiate drag
174 if (!editor_->is_dragging_entity_ && hovered_entity &&
175 ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
176 editor_->dragged_entity_ = hovered_entity;
178 if (hovered_entity->entity_type_ ==
181 *static_cast<zelda3::OverworldItem*>(hovered_entity));
182 }
186 }
187 }
188
189 // 2. Update drag
191 ImGui::IsMouseDragging(ImGuiMouseButton_Left)) {
192 ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
193 ImVec2 mouse_delta = ImGui::GetIO().MouseDelta;
194 float scale = canvas_rt.scale;
195 if (scale > 0.0f) {
196 editor_->dragged_entity_->x_ += mouse_delta.x / scale;
197 editor_->dragged_entity_->y_ += mouse_delta.y / scale;
198 }
199 }
200
201 // 3. End drag
203 ImGui::IsMouseReleased(ImGuiMouseButton_Left)) {
205 float end_scale = canvas_rt.scale;
206 MoveEntityOnGrid(editor_->dragged_entity_, canvas_rt.canvas_p0,
207 canvas_rt.scrolling,
209 // Pass overworld context for proper area size detection
212 editor_->rom_->set_dirty(true);
213 }
215 editor_->dragged_entity_ = nullptr;
217 }
218 }
219 // --- END ENTITY DRAG/DROP LOGIC ---
220
221 // --- TILE DROP TARGET ---
222 // Accept tile drops from the blockset selector onto the map canvas.
223 gui::TileDragPayload tile_drop;
224 if (gui::AcceptTileDrop(&tile_drop)) {
229 }
230 }
231 }
232
233 // End canvas frame - draws grid/overlay based on frame_opts
234 gui::EndCanvas(editor_->ow_map_canvas_, canvas_rt, frame_opts);
235 ImGui::EndChild();
236}
237
238// =============================================================================
239// Internal Canvas Drawing Helpers
240// =============================================================================
241
243 // Get the current zoom scale for positioning and sizing
244 float scale = editor_->ow_map_canvas_.global_scale();
245 if (scale <= 0.0f)
246 scale = 1.0f;
247
248 int xx = 0;
249 int yy = 0;
250 for (int i = 0; i < 0x40; i++) {
251 int world_index = i + (editor_->current_world_ * 0x40);
252
253 // Bounds checking to prevent crashes
254 if (world_index < 0 ||
255 world_index >= static_cast<int>(editor_->maps_bmp_.size())) {
256 continue; // Skip invalid map index
257 }
258
259 // Apply scale to positions for proper zoom support
260 int map_x = static_cast<int>(xx * kOverworldMapSize * scale);
261 int map_y = static_cast<int>(yy * kOverworldMapSize * scale);
262
263 // Ensure visible maps are materialized on demand before drawing.
264 if (!editor_->maps_bmp_[world_index].is_active() ||
265 !editor_->maps_bmp_[world_index].texture()) {
266 editor_->EnsureMapTexture(world_index);
267 }
268
269 // Only draw if the map has a valid texture AND is active (has bitmap data)
270 // The current_map_ check was causing crashes when hovering over unbuilt maps
271 // because the bitmap would be drawn before EnsureMapBuilt() was called
272 bool can_draw = editor_->maps_bmp_[world_index].texture() &&
273 editor_->maps_bmp_[world_index].is_active();
274
275 if (can_draw) {
276 // Draw bitmap at scaled position with scale applied to size
277 editor_->ow_map_canvas_.DrawBitmap(editor_->maps_bmp_[world_index], map_x,
278 map_y, scale);
279 } else {
280 // Draw a placeholder for maps that haven't loaded yet
281 ImDrawList* draw_list = ImGui::GetWindowDrawList();
282 ImVec2 canvas_pos = editor_->ow_map_canvas_.zero_point();
283 ImVec2 scrolling = editor_->ow_map_canvas_.scrolling();
284 // Apply scrolling offset and use already-scaled map_x/map_y
285 ImVec2 placeholder_pos = ImVec2(canvas_pos.x + scrolling.x + map_x,
286 canvas_pos.y + scrolling.y + map_y);
287 // Scale the placeholder size to match zoomed maps
288 float scaled_size = kOverworldMapSize * scale;
289 ImVec2 placeholder_size = ImVec2(scaled_size, scaled_size);
290
291 // Modern loading indicator with theme colors
292 const auto& theme = AgentUI::GetTheme();
293 draw_list->AddRectFilled(
294 placeholder_pos,
295 ImVec2(placeholder_pos.x + placeholder_size.x,
296 placeholder_pos.y + placeholder_size.y),
297 ImGui::GetColorU32(
298 theme.editor_background)); // Theme-aware background
299
300 // Animated loading spinner - scale spinner radius with zoom
301 ImVec2 spinner_pos = ImVec2(placeholder_pos.x + placeholder_size.x / 2,
302 placeholder_pos.y + placeholder_size.y / 2);
303
304 const float spinner_radius = 8.0f * scale;
305 const float rotation = static_cast<float>(ImGui::GetTime()) * 3.0f;
306 const float start_angle = rotation;
307 const float end_angle = rotation + IM_PI * 1.5f;
308
309 draw_list->PathArcTo(spinner_pos, spinner_radius, start_angle, end_angle,
310 12);
311 draw_list->PathStroke(ImGui::GetColorU32(theme.status_active), 0,
312 2.5f * scale);
313 }
314
315 xx++;
316 if (xx >= 8) {
317 yy++;
318 xx = 0;
319 }
320 }
321}
322
323// =============================================================================
324// Panel Drawing Methods
325// =============================================================================
326
329 gui::TileSelectorWidget::Config selector_config;
330 const auto& theme = AgentUI::GetTheme();
331 selector_config.tile_size = 16;
332 selector_config.display_scale = 2.0f;
333 selector_config.tiles_per_row = 8;
335 selector_config.draw_offset = ImVec2(2.0f, 0.0f);
336 selector_config.highlight_color = theme.selection_primary;
337
338 selector_config.enable_drag = true;
339 selector_config.show_hover_tooltip = true;
340
341 editor_->blockset_selector_ = std::make_unique<gui::TileSelectorWidget>(
342 "OwBlocksetSelector", selector_config);
344 }
345
348
349 auto open_tile16_editor = [this](int tile_id) {
352 const size_t session_id =
358 }
359 };
360
361 gui::CanvasMenuItem edit_tile_item;
362 edit_tile_item.label = ICON_MD_GRID_VIEW " Edit Tile16";
363 edit_tile_item.shortcut = "Double-click";
364 edit_tile_item.enabled_condition = [this]() {
365 return editor_->blockset_selector_ &&
366 editor_->blockset_selector_->GetSelectedTileID() >= 0;
367 };
368 edit_tile_item.callback = [this, open_tile16_editor]() {
370 return;
371 }
372 open_tile16_editor(editor_->blockset_selector_->GetSelectedTileID());
373 };
375
377 ImGui::BeginGroup();
379 "##Tile16SelectorScrollRegion",
380 ImVec2(editor_->blockset_selector_->GetPreferredViewportWidth(), 0.0f),
381 true);
383
384 // Tile ID search/jump bar
385 if (editor_->blockset_selector_->DrawFilterBar()) {
387 editor_->blockset_selector_->GetSelectedTileID());
388 }
389
391 bool atlas_ready = editor_->map_blockset_loaded_ && atlas.is_active();
392 auto result = editor_->blockset_selector_->Render(atlas, atlas_ready);
393
394 if (result.selection_changed) {
395 editor_->RequestTile16Selection(result.selected_tile);
396 // Note: We do NOT auto-scroll here because it breaks user interaction.
397 // The canvas should only scroll when explicitly requested (e.g., when
398 // selecting a tile from the overworld canvas via
399 // ScrollBlocksetCanvasToCurrentTile).
400 }
401
402 if (result.tile_double_clicked) {
403 open_tile16_editor(result.selected_tile);
404 }
405
406 ImGui::EndChild();
407 ImGui::EndGroup();
408 return absl::OkStatus();
409}
410
412 // Configure canvas frame options for graphics bin
413 gui::CanvasFrameOptions frame_opts;
415 frame_opts.draw_grid = true;
416 frame_opts.grid_step = 16.0f; // Tile8 grid
417 frame_opts.draw_context_menu = true;
418 frame_opts.draw_overlay = true;
419 frame_opts.render_popups = true;
420 frame_opts.use_child_window = false;
421
422 auto canvas_rt = gui::BeginCanvas(editor_->graphics_bin_canvas_, frame_opts);
423
425 int key = 0;
426 for (auto& value : gfx::Arena::Get().gfx_sheets()) {
427 int offset = 0x40 * (key + 1);
428 int top_left_y = canvas_rt.canvas_p0.y + 2;
429 if (key >= 1) {
430 top_left_y = canvas_rt.canvas_p0.y + 0x40 * key;
431 }
432 auto texture = value.texture();
433 canvas_rt.draw_list->AddImage(
434 (ImTextureID)(intptr_t)texture,
435 ImVec2(canvas_rt.canvas_p0.x + 2, top_left_y),
436 ImVec2(canvas_rt.canvas_p0.x + 0x100,
437 canvas_rt.canvas_p0.y + offset));
438 key++;
439 }
440 }
441
442 gui::EndCanvas(editor_->graphics_bin_canvas_, canvas_rt, frame_opts);
443}
444
447 // Always ensure current map graphics are loaded
450 if (!status.ok()) {
451 return status;
452 }
453 const auto* map =
455 if (!map) {
456 return absl::FailedPreconditionError(
457 "Current overworld map not loaded");
458 }
459 editor_->palette_ = map->current_palette();
460 auto bmp = std::make_unique<gfx::Bitmap>();
461 bmp->Create(0x80, kOverworldMapSize, 0x08, map->current_graphics());
462 bmp->SetPalette(editor_->palette_);
467 }
468 }
469
470 // Configure canvas frame options for area graphics
471 gui::CanvasFrameOptions frame_opts;
473 frame_opts.draw_grid = true;
474 frame_opts.grid_step = 32.0f; // Tile selector grid
475 frame_opts.draw_context_menu = true;
476 frame_opts.draw_overlay = true;
477 frame_opts.render_popups = true;
478 frame_opts.use_child_window = false;
479
481 ImGui::BeginGroup();
482 gui::BeginChildWithScrollbar("##AreaGraphicsScrollRegion");
483
484 auto canvas_rt = gui::BeginCanvas(editor_->current_gfx_canvas_, frame_opts);
486
491 }
493
494 gui::EndCanvas(editor_->current_gfx_canvas_, canvas_rt, frame_opts);
495 ImGui::EndChild();
496 ImGui::EndGroup();
497 return absl::OkStatus();
498}
499
501 // Lightweight v3 controls for map size and feature visibility.
502 ImGui::TextWrapped(tr("ZSCustomOverworld v3 settings"));
503 ImGui::Separator();
504
505 if (!editor_->rom_ || !editor_->rom_->is_loaded()) {
506 gui::CenterText("No ROM loaded");
507 return;
508 }
509
510 const uint8_t asm_version =
512 ImGui::Text(tr("ASM Version: 0x%02X"), asm_version);
513
514 if (asm_version == 0x00 || asm_version == 0xFF || asm_version < 0x03) {
515 ImGui::Spacing();
516 ImGui::TextColored(ImVec4(1.0f, 0.75f, 0.25f, 1.0f),
517 tr("v3 controls require ZSCustomOverworld v3+"));
518 ImGui::TextDisabled(tr("Apply the v3 patch to enable map-size editing."));
519 return;
520 }
521
523 if (!map) {
524 ImGui::TextDisabled(tr("Current map is unavailable."));
525 return;
526 }
527
528 ImGui::Spacing();
529 ImGui::Text(tr("Current map: 0x%02X"), editor_->current_map_);
530 ImGui::Text(tr("Parent map: 0x%02X"), map->parent());
531
532 static int selected_area_size = 0;
533 selected_area_size = static_cast<int>(map->area_size());
534 const char* area_size_labels[] = {"Small", "Wide", "Tall", "Large"};
535 ImGui::SetNextItemWidth(220.0f);
536 ImGui::Combo(tr("Area Size"), &selected_area_size, area_size_labels,
537 IM_ARRAYSIZE(area_size_labels));
538
539 if (ImGui::Button(ICON_MD_SAVE " Apply Area Size")) {
541 map->parent(), static_cast<zelda3::AreaSizeEnum>(selected_area_size));
542 if (status.ok()) {
545 }
546 }
547
548 ImGui::Spacing();
549 ImGui::TextDisabled(
550 tr("Area-size changes update sibling map relationships for this parent "
551 "map."));
552}
553
555 // Area Configuration panel
556 static bool show_custom_bg_color_editor = false;
557 static bool show_overlay_editor = false;
558
559 if (editor_->sidebar_) {
562 show_custom_bg_color_editor, show_overlay_editor);
563 }
564
565 // Draw popups if triggered from sidebar
566 if (show_custom_bg_color_editor) {
567 ImGui::OpenPopup("CustomBGColorEditor");
568 show_custom_bg_color_editor = false; // Reset after opening
569 }
570 if (show_overlay_editor) {
571 ImGui::OpenPopup("OverlayEditor");
572 show_overlay_editor = false; // Reset after opening
573 }
574
575 if (ImGui::BeginPopup("CustomBGColorEditor")) {
577 editor_->map_properties_system_->DrawCustomBackgroundColorEditor(
578 editor_->current_map_, show_custom_bg_color_editor);
579 }
580 ImGui::EndPopup();
581 }
582
583 if (ImGui::BeginPopup("OverlayEditor")) {
586 show_overlay_editor);
587 }
588 ImGui::EndPopup();
589 }
590}
591
593 static bool init_properties = false;
594
595 if (!init_properties) {
596 for (int i = 0; i < 0x40; i++) {
597 std::string area_graphics_str = absl::StrFormat(
598 "%02hX", editor_->overworld_.overworld_map(i)->area_graphics());
601 ->push_back(area_graphics_str);
602
603 area_graphics_str = absl::StrFormat(
604 "%02hX",
605 editor_->overworld_.overworld_map(i + 0x40)->area_graphics());
608 ->push_back(area_graphics_str);
609
610 std::string area_palette_str = absl::StrFormat(
611 "%02hX", editor_->overworld_.overworld_map(i)->area_palette());
614 ->push_back(area_palette_str);
615
616 area_palette_str = absl::StrFormat(
617 "%02hX", editor_->overworld_.overworld_map(i + 0x40)->area_palette());
620 ->push_back(area_palette_str);
621
622 std::string sprite_gfx_str = absl::StrFormat(
623 "%02hX", editor_->overworld_.overworld_map(i)->sprite_graphics(1));
626 ->push_back(sprite_gfx_str);
627
628 sprite_gfx_str = absl::StrFormat(
629 "%02hX", editor_->overworld_.overworld_map(i)->sprite_graphics(2));
632 ->push_back(sprite_gfx_str);
633
634 sprite_gfx_str = absl::StrFormat(
635 "%02hX",
636 editor_->overworld_.overworld_map(i + 0x40)->sprite_graphics(1));
639 ->push_back(sprite_gfx_str);
640
641 sprite_gfx_str = absl::StrFormat(
642 "%02hX",
643 editor_->overworld_.overworld_map(i + 0x40)->sprite_graphics(2));
646 ->push_back(sprite_gfx_str);
647
648 std::string sprite_palette_str = absl::StrFormat(
649 "%02hX", editor_->overworld_.overworld_map(i)->sprite_palette(1));
652 ->push_back(sprite_palette_str);
653
654 sprite_palette_str = absl::StrFormat(
655 "%02hX", editor_->overworld_.overworld_map(i)->sprite_palette(2));
658 ->push_back(sprite_palette_str);
659
660 sprite_palette_str = absl::StrFormat(
661 "%02hX",
662 editor_->overworld_.overworld_map(i + 0x40)->sprite_palette(1));
665 ->push_back(sprite_palette_str);
666
667 sprite_palette_str = absl::StrFormat(
668 "%02hX",
669 editor_->overworld_.overworld_map(i + 0x40)->sprite_palette(2));
672 ->push_back(sprite_palette_str);
673 }
674 init_properties = true;
675 }
676
677 ImGui::Text(tr("Area Gfx LW/DW"));
680 ImGui::SameLine();
683 ImGui::Separator();
684
685 ImGui::Text(tr("Sprite Gfx LW/DW"));
687 ImVec2(256, 256), 32,
689 ImGui::SameLine();
691 ImVec2(256, 256), 32,
693 ImGui::SameLine();
695 ImVec2(256, 256), 32,
697 ImGui::SameLine();
699 ImVec2(256, 256), 32,
701 ImGui::Separator();
702
703 ImGui::Text(tr("Area Pal LW/DW"));
706 ImGui::SameLine();
709
710 static bool show_gfx_group = false;
711 ImGui::Checkbox(tr("Show Gfx Group Editor"), &show_gfx_group);
712 if (show_gfx_group) {
713 gui::BeginWindowWithDisplaySettings("Gfx Group Editor", &show_gfx_group);
716 }
717}
718
719} // namespace yaze::editor
void set_dirty(bool dirty)
Definition rom.h:146
bool is_loaded() const
Definition rom.h:144
EditorDependencies dependencies_
Definition editor.h:333
absl::Status DrawTile16Selector()
Draw the tile16 selector panel.
absl::Status DrawAreaGraphics()
Draw the area graphics panel.
void DrawMapProperties()
Draw the map properties panel (sidebar-based)
void DrawOverworldProperties()
Draw the overworld properties grid (debug/info view)
OverworldEditor * editor_
Non-owning pointer to the parent editor.
void DrawOverworldCanvas()
Draw the main overworld canvas with toolbar, maps, and entities. This is the primary entry point call...
void DrawV3Settings()
Draw the v3 settings panel.
void DrawTile8Selector()
Draw the tile8 selector panel (graphics bin)
void DrawOverworldMaps()
Render the 64 overworld map bitmaps to the canvas.
Main UI class for editing overworld maps in A Link to the Past.
std::unique_ptr< MapPropertiesSystem > map_properties_system_
absl::Status CheckForCurrentMap()
Check for map changes and refresh if needed.
zelda3::GameEntity * dragged_entity_
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > maps_bmp_
void CheckForOverworldEdits()
Check for tile edits - delegates to TilePaintingManager.
void RefreshSiblingMapGraphics(int map_index, bool include_self=false)
std::unique_ptr< OverworldSidebar > sidebar_
bool NormalizeCurrentSelectionState()
Clamp and synchronize stale map/world selection before panels draw.
std::unique_ptr< OverworldEntityRenderer > entity_renderer_
void EnsureMapTexture(int map_index)
Ensure a specific map has its texture created.
std::unique_ptr< OverworldToolbar > toolbar_
std::unique_ptr< gui::TileSelectorWidget > blockset_selector_
bool SelectItemByIdentity(const zelda3::OverworldItem &item_identity)
Select an overworld item using value identity matching.
bool OpenWindow(size_t session_id, const std::string &base_window_id)
void MarkWindowRecentlyUsed(const std::string &window_id)
void QueueTextureCommand(TextureCommandType type, Bitmap *bitmap)
Definition arena.cc:36
std::array< gfx::Bitmap, 223 > & gfx_sheets()
Get reference to all graphics sheets.
Definition arena.h:152
static Arena & Get()
Definition arena.cc:21
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
bool is_active() const
Definition bitmap.h:405
void set_scrolling(ImVec2 scroll)
Definition canvas.h:351
void DrawBitmap(Bitmap &bitmap, int border_offset, float scale)
Definition canvas.cc:1162
auto global_scale() const
Definition canvas.h:397
auto select_rect_active() const
Definition canvas.h:393
void SetUsageMode(CanvasUsage usage)
Definition canvas.cc:290
auto selected_tiles() const
Definition canvas.h:394
void UpdateInfoGrid(ImVec2 bg_size, float grid_size=64.0f, int label_id=0)
Definition canvas.cc:594
bool DrawTileSelector(int size, int size_y=0)
Definition canvas.cc:1098
void ClearContextMenuItems()
Definition canvas.cc:863
auto mutable_labels(int i)
Definition canvas.h:441
void AddContextMenuItem(const gui::CanvasMenuItem &item)
Definition canvas.cc:840
auto zero_point() const
Definition canvas.h:348
auto scrolling() const
Definition canvas.h:350
virtual void UpdateMapProperties(uint16_t map_id, const void *context=nullptr)=0
Update entity properties based on map position.
enum yaze::zelda3::GameEntity::EntityType entity_type_
auto is_loaded() const
Definition overworld.h:728
auto overworld_map(int i) const
Definition overworld.h:662
absl::Status EnsureMapBuilt(int map_index)
Build a map on-demand if it hasn't been built yet.
absl::Status ConfigureMultiAreaMap(int parent_index, AreaSizeEnum size)
Configure a multi-area map structure (Large/Wide/Tall)
Definition overworld.cc:406
#define ICON_MD_GRID_VIEW
Definition icons.h:897
#define ICON_MD_SAVE
Definition icons.h:1644
const AgentUITheme & GetTheme()
Editors are the view controllers for the application.
constexpr ImVec2 kOverworldCanvasSize(kOverworldMapSize *8, kOverworldMapSize *8)
constexpr unsigned int kOverworldMapSize
constexpr ImVec2 kCurrentGfxCanvasSize(0x100+1, 0x10 *0x40+1)
void MoveEntityOnGrid(zelda3::GameEntity *entity, ImVec2 canvas_p0, ImVec2 scrolling, bool free_movement, float scale)
Move entity to grid-aligned position based on mouse.
Definition entity.cc:66
constexpr ImVec2 kGraphicsBinCanvasSize(0x100+1, kNumSheetsToLoad *0x40+1)
void EndCanvas(Canvas &canvas)
void BeginPadding(int i)
Definition style.cc:277
void BeginChildBothScrollbars(int id)
Definition style.cc:327
void BeginCanvas(Canvas &canvas, ImVec2 child_size)
bool AcceptTileDrop(TileDragPayload *out)
Accept a tile16 drop. Returns true if a payload was accepted.
Definition drag_drop.h:132
void EndNoPadding()
Definition style.cc:289
void CenterText(const char *text)
void EndPadding()
Definition style.cc:281
void BeginNoPadding()
Definition style.cc:285
void EndWindowWithDisplaySettings()
Definition style.cc:272
void BeginWindowWithDisplaySettings(const char *id, bool *active, const ImVec2 &size, ImGuiWindowFlags flags)
Definition style.cc:251
void BeginChildWithScrollbar(const char *str_id)
Definition style.cc:293
constexpr int kNumTile16Individual
Definition overworld.h:241
AreaSizeEnum
Area size enumeration for v3+ ROMs.
constexpr int OverworldCustomASMHasBeenApplied
Definition common.h:89
#define IM_PI
project::YazeProject * project
Definition editor.h:173
SharedClipboard * shared_clipboard
Definition editor.h:186
WorkspaceWindowManager * window_manager
Definition editor.h:181
static constexpr const char * kTile16Editor
Bitmap atlas
Master bitmap containing all tiles.
Definition tilemap.h:119
std::optional< float > grid_step
Declarative menu item definition.
Definition canvas_menu.h:64
std::function< bool()> enabled_condition
Definition canvas_menu.h:81
std::function< void()> callback
Definition canvas_menu.h:75