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 // Always refresh hover preview: when the canvas is not hovered this clears
163 // hovered_map_ so the status bar falls back to the selected map.
165 if (canvas_rt.hovered) {
167 }
168
169 // --- BEGIN ENTITY DRAG/DROP LOGIC ---
172 auto hovered_entity = editor_->entity_renderer_->hovered_entity();
173
174 // 1. Initiate drag
175 if (!editor_->is_dragging_entity_ && hovered_entity &&
176 ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
177 editor_->dragged_entity_ = hovered_entity;
179 if (hovered_entity->entity_type_ ==
182 *static_cast<zelda3::OverworldItem*>(hovered_entity));
183 }
187 }
188 }
189
190 // 2. Update drag
192 ImGui::IsMouseDragging(ImGuiMouseButton_Left)) {
193 ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
194 ImVec2 mouse_delta = ImGui::GetIO().MouseDelta;
195 float scale = canvas_rt.scale;
196 if (scale > 0.0f) {
197 editor_->dragged_entity_->x_ += mouse_delta.x / scale;
198 editor_->dragged_entity_->y_ += mouse_delta.y / scale;
199 }
200 }
201
202 // 3. End drag
204 ImGui::IsMouseReleased(ImGuiMouseButton_Left)) {
206 float end_scale = canvas_rt.scale;
207 MoveEntityOnGrid(editor_->dragged_entity_, canvas_rt.canvas_p0,
208 canvas_rt.scrolling,
210 // Pass overworld context for proper area size detection
213 editor_->rom_->set_dirty(true);
214 }
216 editor_->dragged_entity_ = nullptr;
218 }
219 }
220 // --- END ENTITY DRAG/DROP LOGIC ---
221
222 // --- TILE DROP TARGET ---
223 // Accept tile drops from the blockset selector onto the map canvas.
224 gui::TileDragPayload tile_drop;
225 if (gui::AcceptTileDrop(&tile_drop)) {
230 }
231 }
232 }
233
234 // End canvas frame - draws grid/overlay based on frame_opts
235 gui::EndCanvas(editor_->ow_map_canvas_, canvas_rt, frame_opts);
236 ImGui::EndChild();
237}
238
239// =============================================================================
240// Internal Canvas Drawing Helpers
241// =============================================================================
242
244 // Get the current zoom scale for positioning and sizing
245 float scale = editor_->ow_map_canvas_.global_scale();
246 if (scale <= 0.0f)
247 scale = 1.0f;
248
249 int xx = 0;
250 int yy = 0;
251 for (int i = 0; i < 0x40; i++) {
252 int world_index = i + (editor_->current_world_ * 0x40);
253
254 // Bounds checking to prevent crashes
255 if (world_index < 0 ||
256 world_index >= static_cast<int>(editor_->maps_bmp_.size())) {
257 continue; // Skip invalid map index
258 }
259
260 // Apply scale to positions for proper zoom support
261 int map_x = static_cast<int>(xx * kOverworldMapSize * scale);
262 int map_y = static_cast<int>(yy * kOverworldMapSize * scale);
263
264 // Ensure visible maps are materialized on demand before drawing.
265 if (!editor_->maps_bmp_[world_index].is_active() ||
266 !editor_->maps_bmp_[world_index].texture()) {
267 editor_->EnsureMapTexture(world_index);
268 }
269
270 // Only draw if the map has a valid texture AND is active (has bitmap data)
271 // The current_map_ check was causing crashes when hovering over unbuilt maps
272 // because the bitmap would be drawn before EnsureMapBuilt() was called
273 bool can_draw = editor_->maps_bmp_[world_index].texture() &&
274 editor_->maps_bmp_[world_index].is_active();
275
276 if (can_draw) {
277 // Draw bitmap at scaled position with scale applied to size
278 editor_->ow_map_canvas_.DrawBitmap(editor_->maps_bmp_[world_index], map_x,
279 map_y, scale);
280 } else {
281 // Draw a placeholder for maps that haven't loaded yet
282 ImDrawList* draw_list = ImGui::GetWindowDrawList();
283 ImVec2 canvas_pos = editor_->ow_map_canvas_.zero_point();
284 ImVec2 scrolling = editor_->ow_map_canvas_.scrolling();
285 // Apply scrolling offset and use already-scaled map_x/map_y
286 ImVec2 placeholder_pos = ImVec2(canvas_pos.x + scrolling.x + map_x,
287 canvas_pos.y + scrolling.y + map_y);
288 // Scale the placeholder size to match zoomed maps
289 float scaled_size = kOverworldMapSize * scale;
290 ImVec2 placeholder_size = ImVec2(scaled_size, scaled_size);
291
292 // Modern loading indicator with theme colors
293 const auto& theme = AgentUI::GetTheme();
294 draw_list->AddRectFilled(
295 placeholder_pos,
296 ImVec2(placeholder_pos.x + placeholder_size.x,
297 placeholder_pos.y + placeholder_size.y),
298 ImGui::GetColorU32(
299 theme.editor_background)); // Theme-aware background
300
301 // Animated loading spinner - scale spinner radius with zoom
302 ImVec2 spinner_pos = ImVec2(placeholder_pos.x + placeholder_size.x / 2,
303 placeholder_pos.y + placeholder_size.y / 2);
304
305 const float spinner_radius = 8.0f * scale;
306 const float rotation = static_cast<float>(ImGui::GetTime()) * 3.0f;
307 const float start_angle = rotation;
308 const float end_angle = rotation + IM_PI * 1.5f;
309
310 draw_list->PathArcTo(spinner_pos, spinner_radius, start_angle, end_angle,
311 12);
312 draw_list->PathStroke(ImGui::GetColorU32(theme.status_active), 0,
313 2.5f * scale);
314 }
315
316 xx++;
317 if (xx >= 8) {
318 yy++;
319 xx = 0;
320 }
321 }
322}
323
324// =============================================================================
325// Panel Drawing Methods
326// =============================================================================
327
330 gui::TileSelectorWidget::Config selector_config;
331 const auto& theme = AgentUI::GetTheme();
332 selector_config.tile_size = 16;
333 selector_config.display_scale = 2.0f;
334 selector_config.tiles_per_row = 8;
336 selector_config.draw_offset = ImVec2(2.0f, 0.0f);
337 selector_config.highlight_color = theme.selection_primary;
338
339 selector_config.enable_drag = true;
340 selector_config.show_hover_tooltip = true;
341
342 editor_->blockset_selector_ = std::make_unique<gui::TileSelectorWidget>(
343 "OwBlocksetSelector", selector_config);
345 }
346
349
350 auto open_tile16_editor = [this](int tile_id) {
353 const size_t session_id =
359 }
360 };
361
362 gui::CanvasMenuItem edit_tile_item;
363 edit_tile_item.label = ICON_MD_GRID_VIEW " Edit Tile16";
364 edit_tile_item.shortcut = "Double-click";
365 edit_tile_item.enabled_condition = [this]() {
366 return editor_->blockset_selector_ &&
367 editor_->blockset_selector_->GetSelectedTileID() >= 0;
368 };
369 edit_tile_item.callback = [this, open_tile16_editor]() {
371 return;
372 }
373 open_tile16_editor(editor_->blockset_selector_->GetSelectedTileID());
374 };
376
378 ImGui::BeginGroup();
380 "##Tile16SelectorScrollRegion",
381 ImVec2(editor_->blockset_selector_->GetPreferredViewportWidth(), 0.0f),
382 true);
384
385 // Tile ID search/jump bar
386 if (editor_->blockset_selector_->DrawFilterBar()) {
388 editor_->blockset_selector_->GetSelectedTileID());
389 }
390
392 bool atlas_ready = editor_->map_blockset_loaded_ && atlas.is_active();
393 auto result = editor_->blockset_selector_->Render(atlas, atlas_ready);
394
395 if (result.selection_changed) {
396 editor_->RequestTile16Selection(result.selected_tile);
397 // Note: We do NOT auto-scroll here because it breaks user interaction.
398 // The canvas should only scroll when explicitly requested (e.g., when
399 // selecting a tile from the overworld canvas via
400 // ScrollBlocksetCanvasToCurrentTile).
401 }
402
403 if (result.tile_double_clicked) {
404 open_tile16_editor(result.selected_tile);
405 }
406
407 ImGui::EndChild();
408 ImGui::EndGroup();
409 return absl::OkStatus();
410}
411
413 // Configure canvas frame options for graphics bin
414 gui::CanvasFrameOptions frame_opts;
416 frame_opts.draw_grid = true;
417 frame_opts.grid_step = 16.0f; // Tile8 grid
418 frame_opts.draw_context_menu = true;
419 frame_opts.draw_overlay = true;
420 frame_opts.render_popups = true;
421 frame_opts.use_child_window = false;
422
423 auto canvas_rt = gui::BeginCanvas(editor_->graphics_bin_canvas_, frame_opts);
424
426 int key = 0;
427 for (auto& value : gfx::Arena::Get().gfx_sheets()) {
428 int offset = 0x40 * (key + 1);
429 int top_left_y = canvas_rt.canvas_p0.y + 2;
430 if (key >= 1) {
431 top_left_y = canvas_rt.canvas_p0.y + 0x40 * key;
432 }
433 auto texture = value.texture();
434 canvas_rt.draw_list->AddImage(
435 (ImTextureID)(intptr_t)texture,
436 ImVec2(canvas_rt.canvas_p0.x + 2, top_left_y),
437 ImVec2(canvas_rt.canvas_p0.x + 0x100,
438 canvas_rt.canvas_p0.y + offset));
439 key++;
440 }
441 }
442
443 gui::EndCanvas(editor_->graphics_bin_canvas_, canvas_rt, frame_opts);
444}
445
448 // Always ensure current map graphics are loaded
451 if (!status.ok()) {
452 return status;
453 }
454 const auto* map =
456 if (!map) {
457 return absl::FailedPreconditionError(
458 "Current overworld map not loaded");
459 }
460 editor_->palette_ = map->current_palette();
461 auto bmp = std::make_unique<gfx::Bitmap>();
462 bmp->Create(0x80, kOverworldMapSize, 0x08, map->current_graphics());
463 bmp->SetPalette(editor_->palette_);
468 }
469 }
470
471 // Configure canvas frame options for area graphics
472 gui::CanvasFrameOptions frame_opts;
474 frame_opts.draw_grid = true;
475 frame_opts.grid_step = 32.0f; // Tile selector grid
476 frame_opts.draw_context_menu = true;
477 frame_opts.draw_overlay = true;
478 frame_opts.render_popups = true;
479 frame_opts.use_child_window = false;
480
482 ImGui::BeginGroup();
483 gui::BeginChildWithScrollbar("##AreaGraphicsScrollRegion");
484
485 auto canvas_rt = gui::BeginCanvas(editor_->current_gfx_canvas_, frame_opts);
487
492 }
494
495 gui::EndCanvas(editor_->current_gfx_canvas_, canvas_rt, frame_opts);
496 ImGui::EndChild();
497 ImGui::EndGroup();
498 return absl::OkStatus();
499}
500
502 // Lightweight v3 controls for map size and feature visibility.
503 ImGui::TextWrapped(tr("ZSCustomOverworld v3 settings"));
504 ImGui::Separator();
505
506 if (!editor_->rom_ || !editor_->rom_->is_loaded()) {
507 gui::CenterText("No ROM loaded");
508 return;
509 }
510
511 const uint8_t asm_version =
513 ImGui::Text(tr("ASM Version: 0x%02X"), asm_version);
514
515 if (asm_version == 0x00 || asm_version == 0xFF || asm_version < 0x03) {
516 ImGui::Spacing();
517 ImGui::TextColored(ImVec4(1.0f, 0.75f, 0.25f, 1.0f),
518 tr("v3 controls require ZSCustomOverworld v3+"));
519 ImGui::TextDisabled(tr("Apply the v3 patch to enable map-size editing."));
520 return;
521 }
522
524 if (!map) {
525 ImGui::TextDisabled(tr("Current map is unavailable."));
526 return;
527 }
528
529 ImGui::Spacing();
530 ImGui::Text(tr("Current map: 0x%02X"), editor_->current_map_);
531 ImGui::Text(tr("Parent map: 0x%02X"), map->parent());
532
533 static int selected_area_size = 0;
534 selected_area_size = static_cast<int>(map->area_size());
535 const char* area_size_labels[] = {"Small", "Wide", "Tall", "Large"};
536 ImGui::SetNextItemWidth(220.0f);
537 ImGui::Combo(tr("Area Size"), &selected_area_size, area_size_labels,
538 IM_ARRAYSIZE(area_size_labels));
539
540 if (ImGui::Button(ICON_MD_SAVE " Apply Area Size")) {
542 map->parent(), static_cast<zelda3::AreaSizeEnum>(selected_area_size));
543 if (status.ok()) {
546 }
547 }
548
549 ImGui::Spacing();
550 ImGui::TextDisabled(
551 tr("Area-size changes update sibling map relationships for this parent "
552 "map."));
553}
554
556 // Area Configuration panel
557 static bool show_custom_bg_color_editor = false;
558 static bool show_overlay_editor = false;
559
560 if (editor_->sidebar_) {
563 show_custom_bg_color_editor, show_overlay_editor);
564 }
565
566 // Draw popups if triggered from sidebar
567 if (show_custom_bg_color_editor) {
568 ImGui::OpenPopup("CustomBGColorEditor");
569 show_custom_bg_color_editor = false; // Reset after opening
570 }
571 if (show_overlay_editor) {
572 ImGui::OpenPopup("OverlayEditor");
573 show_overlay_editor = false; // Reset after opening
574 }
575
576 if (ImGui::BeginPopup("CustomBGColorEditor")) {
578 editor_->map_properties_system_->DrawCustomBackgroundColorEditor(
579 editor_->current_map_, show_custom_bg_color_editor);
580 }
581 ImGui::EndPopup();
582 }
583
584 if (ImGui::BeginPopup("OverlayEditor")) {
587 show_overlay_editor);
588 }
589 ImGui::EndPopup();
590 }
591}
592
594 static bool init_properties = false;
595
596 if (!init_properties) {
597 for (int i = 0; i < 0x40; i++) {
598 std::string area_graphics_str = absl::StrFormat(
599 "%02hX", editor_->overworld_.overworld_map(i)->area_graphics());
602 ->push_back(area_graphics_str);
603
604 area_graphics_str = absl::StrFormat(
605 "%02hX",
606 editor_->overworld_.overworld_map(i + 0x40)->area_graphics());
609 ->push_back(area_graphics_str);
610
611 std::string area_palette_str = absl::StrFormat(
612 "%02hX", editor_->overworld_.overworld_map(i)->area_palette());
615 ->push_back(area_palette_str);
616
617 area_palette_str = absl::StrFormat(
618 "%02hX", editor_->overworld_.overworld_map(i + 0x40)->area_palette());
621 ->push_back(area_palette_str);
622
623 std::string sprite_gfx_str = absl::StrFormat(
624 "%02hX", editor_->overworld_.overworld_map(i)->sprite_graphics(1));
627 ->push_back(sprite_gfx_str);
628
629 sprite_gfx_str = absl::StrFormat(
630 "%02hX", editor_->overworld_.overworld_map(i)->sprite_graphics(2));
633 ->push_back(sprite_gfx_str);
634
635 sprite_gfx_str = absl::StrFormat(
636 "%02hX",
637 editor_->overworld_.overworld_map(i + 0x40)->sprite_graphics(1));
640 ->push_back(sprite_gfx_str);
641
642 sprite_gfx_str = absl::StrFormat(
643 "%02hX",
644 editor_->overworld_.overworld_map(i + 0x40)->sprite_graphics(2));
647 ->push_back(sprite_gfx_str);
648
649 std::string sprite_palette_str = absl::StrFormat(
650 "%02hX", editor_->overworld_.overworld_map(i)->sprite_palette(1));
653 ->push_back(sprite_palette_str);
654
655 sprite_palette_str = absl::StrFormat(
656 "%02hX", editor_->overworld_.overworld_map(i)->sprite_palette(2));
659 ->push_back(sprite_palette_str);
660
661 sprite_palette_str = absl::StrFormat(
662 "%02hX",
663 editor_->overworld_.overworld_map(i + 0x40)->sprite_palette(1));
666 ->push_back(sprite_palette_str);
667
668 sprite_palette_str = absl::StrFormat(
669 "%02hX",
670 editor_->overworld_.overworld_map(i + 0x40)->sprite_palette(2));
673 ->push_back(sprite_palette_str);
674 }
675 init_properties = true;
676 }
677
678 ImGui::Text(tr("Area Gfx LW/DW"));
681 ImGui::SameLine();
684 ImGui::Separator();
685
686 ImGui::Text(tr("Sprite Gfx LW/DW"));
688 ImVec2(256, 256), 32,
690 ImGui::SameLine();
692 ImVec2(256, 256), 32,
694 ImGui::SameLine();
696 ImVec2(256, 256), 32,
698 ImGui::SameLine();
700 ImVec2(256, 256), 32,
702 ImGui::Separator();
703
704 ImGui::Text(tr("Area Pal LW/DW"));
707 ImGui::SameLine();
710
711 static bool show_gfx_group = false;
712 ImGui::Checkbox(tr("Show Gfx Group Editor"), &show_gfx_group);
713 if (show_gfx_group) {
714 gui::BeginWindowWithDisplaySettings("Gfx Group Editor", &show_gfx_group);
717 }
718}
719
720} // namespace yaze::editor
void set_dirty(bool dirty)
Definition rom.h:157
bool is_loaded() const
Definition rom.h:155
EditorDependencies dependencies_
Definition editor.h:338
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:39
std::array< gfx::Bitmap, 223 > & gfx_sheets()
Get reference to all graphics sheets.
Definition arena.h:177
static Arena & Get()
Definition arena.cc:24
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:69
bool is_active() const
Definition bitmap.h:407
void set_scrolling(ImVec2 scroll)
Definition canvas.h:357
void DrawBitmap(Bitmap &bitmap, int border_offset, float scale)
Definition canvas.cc:1173
auto global_scale() const
Definition canvas.h:403
auto select_rect_active() const
Definition canvas.h:399
void SetUsageMode(CanvasUsage usage)
Definition canvas.cc:301
auto selected_tiles() const
Definition canvas.h:400
void UpdateInfoGrid(ImVec2 bg_size, float grid_size=64.0f, int label_id=0)
Definition canvas.cc:605
bool DrawTileSelector(int size, int size_y=0)
Definition canvas.cc:1109
void ClearContextMenuItems()
Definition canvas.cc:874
auto mutable_labels(int i)
Definition canvas.h:447
void AddContextMenuItem(const gui::CanvasMenuItem &item)
Definition canvas.cc:851
auto zero_point() const
Definition canvas.h:354
auto scrolling() const
Definition canvas.h:356
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:296
void BeginChildBothScrollbars(int id)
Definition style.cc:346
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:308
void CenterText(const char *text)
void EndPadding()
Definition style.cc:300
void BeginNoPadding()
Definition style.cc:304
void EndWindowWithDisplaySettings()
Definition style.cc:291
void BeginWindowWithDisplaySettings(const char *id, bool *active, const ImVec2 &size, ImGuiWindowFlags flags)
Definition style.cc:270
void BeginChildWithScrollbar(const char *str_id)
Definition style.cc:312
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