Handles all canvas drawing and panel rendering for the overworld editor. More...
#include <overworld_canvas_renderer.h>

Classes | |
| struct | OverlayLayer |
Public Member Functions | |
| OverworldCanvasRenderer (OverworldEditor *editor) | |
| void | DrawOverworldCanvas () |
| Draw the main overworld canvas with toolbar, maps, and entities. This is the primary entry point called from the OverworldCanvasPanel. | |
| absl::Status | DrawTile16Selector () |
| Draw the tile16 selector panel. | |
| void | DrawTile8Selector () |
| Draw the tile8 selector panel (graphics bin) | |
| absl::Status | DrawAreaGraphics () |
| Draw the area graphics panel. | |
| void | DrawV3Settings () |
| Draw the v3 settings panel. | |
| void | DrawMapProperties () |
| Draw the map properties panel (sidebar-based) | |
| void | DrawOverworldProperties () |
| Draw the overworld properties grid (debug/info view) | |
| const std::vector< int > & | tile16_usage_counts () const |
| int | tile16_usage_count (int tile_id) const |
| std::string | Tile16ScopeLabel () const |
Private Types | |
| enum class | Tile16UsageScope { kAllMaps , kCurrentWorld , kCurrentArea , kArea } |
Private Member Functions | |
| void | DrawOverworldMaps () |
| Render the 64 overworld map bitmaps to the canvas. | |
| void | DrawMapWithAreaLayers (int map_index, int map_x, int map_y, float scale) |
| OverlayLayer * | EnsureOverlayLayer (int map_index) |
| bool | PrepareContextMenu (const ImVec2 &screen_position) |
| void | FilterHoveredEntityByMode () |
| In an entity mode only that entity type responds to hover/drag/menu. | |
| void | DrawEntityHoverTooltip () |
| void | DrawTile16ViewControls () |
| void | DrawTile16AreaPicker () |
| std::vector< int > | Tile16ScopeMaps () const |
| void | RefreshTile16Order (bool grid_hovered) |
| void | ResetTile16Order () |
| Shows every tile in ID order and forces a recount on the next refresh. | |
Private Attributes | |
| std::unordered_map< int, OverlayLayer > | overlay_layers_ |
| OverworldEditor * | editor_ |
| Non-owning pointer to the parent editor. | |
| std::optional< ImVec2 > | entity_drag_origin_ |
| gui::AdaptiveSheetScaleMode | tile16_scale_mode_ |
| gui::AdaptiveSheetScaleMode | area_graphics_scale_mode_ |
| zelda3::Tile16SortMode | tile16_sort_ = zelda3::Tile16SortMode::kUsage |
| Tile16UsageScope | tile16_scope_ = Tile16UsageScope::kAllMaps |
| int | tile16_scope_area_ = 0 |
| bool | tile16_hide_unused_ = false |
| bool | tile16_order_dirty_ = true |
| bool | tile16_grid_hovered_ = false |
| double | tile16_last_count_time_ = -1.0 |
| int | tile16_counted_world_ = -1 |
| int | tile16_counted_parent_ = -1 |
| std::vector< int > | tile16_usage_counts_ |
| char | tile16_area_search_ [64] = {} |
Handles all canvas drawing and panel rendering for the overworld editor.
Extracted from OverworldEditor to separate rendering concerns from editing logic. This class handles:
All state is accessed through a pointer to the owning OverworldEditor. The renderer is declared as a friend class of OverworldEditor for direct member access.
Definition at line 38 of file overworld_canvas_renderer.h.
|
strongprivate |
| Enumerator | |
|---|---|
| kAllMaps | |
| kCurrentWorld | |
| kCurrentArea | |
| kArea | |
Definition at line 108 of file overworld_canvas_renderer.h.
|
explicit |
Definition at line 70 of file overworld_canvas_renderer.cc.
References editor_, yaze::editor::OverworldEditor::ow_map_canvas_, PrepareContextMenu(), yaze::gui::Canvas::SetContextMenuOpenCallback(), and yaze::gui::Canvas::SetShowBuiltinContextMenu().

| void yaze::editor::OverworldCanvasRenderer::DrawOverworldCanvas | ( | ) |
Draw the main overworld canvas with toolbar, maps, and entities. This is the primary entry point called from the OverworldCanvasPanel.
Definition at line 85 of file overworld_canvas_renderer.cc.
References yaze::editor::OverworldEditor::current_map_, yaze::editor::OverworldEditor::current_map_lock_, yaze::editor::OverworldEditor::current_mode, yaze::editor::OverworldEditor::current_world_, yaze::editor::Editor::dependencies_, editor_, yaze::editor::OverworldEditor::entity_edit_mode_, yaze::editor::OverworldEditor::game_state_, yaze::Rom::InspectLyraLayout(), yaze::gui::WidgetIdRegistry::Instance(), yaze::Rom::is_loaded(), yaze::zelda3::Overworld::is_loaded(), yaze::zelda3::Overworld::is_lyra_preview(), yaze::editor::OverworldEditor::JumpToMap(), yaze::editor::OverworldEditor::lyra_a0_terrain_writable(), yaze::editor::OverworldEditor::lyra_terrain_brush_, yaze::editor::OverworldEditor::NormalizeCurrentSelectionState(), yaze::editor::OverworldEditor::overworld_, yaze::editor::EditorDependencies::project, yaze::gui::WidgetIdRegistry::RegisterWidget(), yaze::editor::OverworldEditor::rom_, yaze::editor::EditorDependencies::shortcut_manager, yaze::editor::OverworldEditor::toolbar_, and yaze::editor::EditorDependencies::window_manager.
| absl::Status yaze::editor::OverworldCanvasRenderer::DrawTile16Selector | ( | ) |
Draw the tile16 selector panel.
Definition at line 575 of file overworld_canvas_renderer.cc.
References yaze::gui::TileSelectorWidget::Config::display_scale, yaze::gui::TileSelectorWidget::Config::draw_offset, yaze::gui::TileSelectorWidget::Config::enable_drag, yaze::gui::TileSelectorWidget::Config::highlight_color, yaze::zelda3::kNumTile16Individual, yaze::editor::kTile16SelectorColumns, yaze::editor::kTile16SelectorDrawOffsetX, yaze::editor::kTile16SelectorScale, yaze::gui::TileSelectorWidget::Config::show_hover_tooltip, yaze::gui::TileSelectorWidget::Config::tile_size, yaze::gui::TileSelectorWidget::Config::tiles_per_row, and yaze::gui::TileSelectorWidget::Config::total_tiles.
| void yaze::editor::OverworldCanvasRenderer::DrawTile8Selector | ( | ) |
Draw the tile8 selector panel (graphics bin)
Definition at line 959 of file overworld_canvas_renderer.cc.
References yaze::gui::BeginCanvas(), yaze::gui::CanvasFrameOptions::canvas_size, yaze::gui::CanvasFrameOptions::draw_context_menu, yaze::gui::CanvasFrameOptions::draw_grid, yaze::gui::CanvasFrameOptions::draw_overlay, yaze::gui::EndCanvas(), yaze::gfx::Arena::Get(), yaze::gfx::Arena::gfx_sheets(), yaze::gui::CanvasFrameOptions::grid_step, yaze::editor::kGraphicsBinCanvasSize(), yaze::gui::CanvasFrameOptions::render_popups, and yaze::gui::CanvasFrameOptions::use_child_window.
| absl::Status yaze::editor::OverworldCanvasRenderer::DrawAreaGraphics | ( | ) |
Draw the area graphics panel.
Definition at line 993 of file overworld_canvas_renderer.cc.
References yaze::gui::BeginCanvas(), yaze::gui::BeginChildWithScrollbar(), yaze::gui::BeginPadding(), yaze::gui::CanvasFrameOptions::canvas_size, yaze::gfx::Arena::CREATE, yaze::gui::AdaptiveSheetLayout::display_scale, yaze::gui::AdaptiveSheetLayout::displayed_height, yaze::gui::AdaptiveSheetLayout::displayed_width, yaze::gui::CanvasFrameOptions::draw_context_menu, yaze::gui::CanvasFrameOptions::draw_grid, yaze::gui::CanvasFrameOptions::draw_overlay, yaze::editor::DrawSheetScaleControl(), yaze::gui::EndCanvas(), yaze::gui::EndPadding(), yaze::gfx::Arena::Get(), yaze::gui::CanvasFrameOptions::grid_step, yaze::editor::kOverworldMapSize, yaze::gfx::Arena::QueueTextureCommand(), yaze::gui::CanvasFrameOptions::render_popups, yaze::gui::ResolveAdaptiveSheetLayout(), RETURN_IF_ERROR, and yaze::gui::CanvasFrameOptions::use_child_window.
| void yaze::editor::OverworldCanvasRenderer::DrawV3Settings | ( | ) |
Draw the v3 settings panel.
Definition at line 1072 of file overworld_canvas_renderer.cc.
References yaze::gui::CenterText(), ICON_MD_SAVE, and yaze::zelda3::OverworldCustomASMHasBeenApplied.

| void yaze::editor::OverworldCanvasRenderer::DrawMapProperties | ( | ) |
Draw the map properties panel (sidebar-based)
Definition at line 1213 of file overworld_canvas_renderer.cc.
| void yaze::editor::OverworldCanvasRenderer::DrawOverworldProperties | ( | ) |
Draw the overworld properties grid (debug/info view)
Definition at line 1235 of file overworld_canvas_renderer.cc.
References yaze::gui::BeginWindowWithDisplaySettings(), and yaze::gui::EndWindowWithDisplaySettings().

|
inline |
Definition at line 72 of file overworld_canvas_renderer.h.
References tile16_usage_counts_.
|
inline |
Definition at line 75 of file overworld_canvas_renderer.h.
References tile16_usage_counts_.
| std::string yaze::editor::OverworldCanvasRenderer::Tile16ScopeLabel | ( | ) | const |
Definition at line 719 of file overworld_canvas_renderer.cc.
References yaze::zelda3::GetOverworldMapLabel().

|
private |
Render the 64 overworld map bitmaps to the canvas.
Definition at line 471 of file overworld_canvas_renderer.cc.
References IM_PI, and yaze::editor::kOverworldMapSize.
|
private |
Definition at line 393 of file overworld_canvas_renderer.cc.
References yaze::editor::kOverworldMapSize.
|
private |
Definition at line 426 of file overworld_canvas_renderer.cc.
References yaze::gfx::Arena::CREATE, yaze::gfx::Arena::Get(), yaze::editor::OverworldCanvasRenderer::OverlayLayer::has_overlay, yaze::editor::kOverworldMapSize, yaze::gfx::Arena::QueueTextureCommand(), yaze::zelda3::SubscreenOverlayScreen(), and yaze::gfx::Arena::UPDATE.

|
private |
Definition at line 12 of file overworld_context_actions.cc.
References yaze::gui::Canvas::ClearContextMenuItems(), yaze::editor::OverworldEditor::current_map_lock_, yaze::editor::OverworldEditor::current_mode, yaze::editor::OverworldEditor::current_world_, yaze::editor::Editor::dependencies_, yaze::editor::OverworldEditor::DisplayedMapCount(), yaze::editor::LyraTerrainCanvas::document(), editor_, yaze::editor::OverworldEditor::entity_renderer_, yaze::editor::OverworldEditor::game_state_, yaze::Rom::is_loaded(), yaze::zelda3::Overworld::is_loaded(), yaze::zelda3::Overworld::is_lyra_preview(), yaze::editor::OverworldEditor::IsProjectTerrainMap(), yaze::editor::LyraTerrainCanvas::loaded(), yaze::editor::OverworldEditor::lyra_canvas_, yaze::editor::OverworldEditor::map_properties_system_, yaze::editor::MOUSE, yaze::zelda3::Overworld::mutable_map_tiles(), yaze::editor::OverworldEditor::overworld_, yaze::zelda3::Overworld::overworld_map(), yaze::editor::OverworldEditor::ow_map_canvas_, yaze::editor::EditorDependencies::project, yaze::editor::ResolveOverworldContextTarget(), yaze::editor::OverworldEditor::rom_, yaze::editor::EditorDependencies::shared_clipboard, and yaze::core::LyraTerrainDocument::tile().
Referenced by OverworldCanvasRenderer().
|
private |
In an entity mode only that entity type responds to hover/drag/menu.
Definition at line 1126 of file overworld_canvas_renderer.cc.
|
private |
Definition at line 1154 of file overworld_canvas_renderer.cc.
References ICON_MD_CYCLONE, ICON_MD_DOOR_BACK, ICON_MD_DOOR_FRONT, ICON_MD_GRASS, ICON_MD_PEST_CONTROL_RODENT, yaze::zelda3::GameEntity::kEntrance, yaze::zelda3::GameEntity::kExit, yaze::zelda3::GameEntity::kItem, yaze::zelda3::kSecretItemNames, and yaze::zelda3::GameEntity::kSprite.
|
private |
Definition at line 869 of file overworld_canvas_renderer.cc.
References yaze::gui::AutoRegisterLastItem(), ICON_MD_FILTER_LIST, yaze::zelda3::kTileId, yaze::zelda3::kUsage, and yaze::gui::ScaledSize().

|
private |
Definition at line 923 of file overworld_canvas_renderer.cc.
References yaze::zelda3::GetOverworldMapLabel(), and yaze::gui::ScaledSize().

|
private |
Definition at line 741 of file overworld_canvas_renderer.cc.
|
private |
Recounts placements at most twice a second, and never while the mouse is down or over the grid, so tiles don't move under the cursor.
Definition at line 779 of file overworld_canvas_renderer.cc.
References yaze::zelda3::AccumulateTile16MapUsage(), yaze::zelda3::BuildTile16DisplayOrder(), yaze::core::LyraTerrainDocument::kFirstMap, yaze::core::LyraTerrainDocument::kMapCount, yaze::zelda3::kNumTile16Individual, and yaze::zelda3::kTileId.

|
private |
Shows every tile in ID order and forces a recount on the next refresh.
Definition at line 861 of file overworld_canvas_renderer.cc.
|
private |
Definition at line 102 of file overworld_canvas_renderer.h.
|
private |
Non-owning pointer to the parent editor.
Definition at line 122 of file overworld_canvas_renderer.h.
Referenced by DrawOverworldCanvas(), OverworldCanvasRenderer(), and PrepareContextMenu().
|
private |
Definition at line 123 of file overworld_canvas_renderer.h.
|
private |
Definition at line 124 of file overworld_canvas_renderer.h.
|
private |
Definition at line 126 of file overworld_canvas_renderer.h.
|
private |
Definition at line 129 of file overworld_canvas_renderer.h.
|
private |
Definition at line 130 of file overworld_canvas_renderer.h.
|
private |
Definition at line 131 of file overworld_canvas_renderer.h.
|
private |
Definition at line 132 of file overworld_canvas_renderer.h.
|
private |
Definition at line 133 of file overworld_canvas_renderer.h.
|
private |
Definition at line 134 of file overworld_canvas_renderer.h.
|
private |
Definition at line 135 of file overworld_canvas_renderer.h.
|
private |
Definition at line 137 of file overworld_canvas_renderer.h.
|
private |
Definition at line 138 of file overworld_canvas_renderer.h.
|
private |
Definition at line 139 of file overworld_canvas_renderer.h.
Referenced by tile16_usage_count(), and tile16_usage_counts().
|
private |
Definition at line 140 of file overworld_canvas_renderer.h.