yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::OverworldCanvasRenderer Class Reference

Handles all canvas drawing and panel rendering for the overworld editor. More...

#include <overworld_canvas_renderer.h>

Collaboration diagram for yaze::editor::OverworldCanvasRenderer:

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] = {}
 

Detailed Description

Handles all canvas drawing and panel rendering for the overworld editor.

Extracted from OverworldEditor to separate rendering concerns from editing logic. This class handles:

  • Main overworld canvas drawing (map bitmaps, entities, tile edits)
  • Panel rendering (tile16 selector, tile8 selector, area graphics, etc.)
  • Properties panel rendering

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.

Member Enumeration Documentation

◆ Tile16UsageScope

Enumerator
kAllMaps 
kCurrentWorld 
kCurrentArea 
kArea 

Definition at line 108 of file overworld_canvas_renderer.h.

Constructor & Destructor Documentation

◆ OverworldCanvasRenderer()

yaze::editor::OverworldCanvasRenderer::OverworldCanvasRenderer ( OverworldEditor * editor)
explicit

Member Function Documentation

◆ DrawOverworldCanvas()

◆ DrawTile16Selector()

◆ DrawTile8Selector()

◆ DrawAreaGraphics()

◆ DrawV3Settings()

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.

Here is the call graph for this function:

◆ DrawMapProperties()

void yaze::editor::OverworldCanvasRenderer::DrawMapProperties ( )

Draw the map properties panel (sidebar-based)

Definition at line 1213 of file overworld_canvas_renderer.cc.

◆ DrawOverworldProperties()

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().

Here is the call graph for this function:

◆ tile16_usage_counts()

const std::vector< int > & yaze::editor::OverworldCanvasRenderer::tile16_usage_counts ( ) const
inline

Definition at line 72 of file overworld_canvas_renderer.h.

References tile16_usage_counts_.

◆ tile16_usage_count()

int yaze::editor::OverworldCanvasRenderer::tile16_usage_count ( int tile_id) const
inline

Definition at line 75 of file overworld_canvas_renderer.h.

References tile16_usage_counts_.

◆ Tile16ScopeLabel()

std::string yaze::editor::OverworldCanvasRenderer::Tile16ScopeLabel ( ) const

Definition at line 719 of file overworld_canvas_renderer.cc.

References yaze::zelda3::GetOverworldMapLabel().

Here is the call graph for this function:

◆ DrawOverworldMaps()

void yaze::editor::OverworldCanvasRenderer::DrawOverworldMaps ( )
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.

◆ DrawMapWithAreaLayers()

void yaze::editor::OverworldCanvasRenderer::DrawMapWithAreaLayers ( int map_index,
int map_x,
int map_y,
float scale )
private

Definition at line 393 of file overworld_canvas_renderer.cc.

References yaze::editor::kOverworldMapSize.

◆ EnsureOverlayLayer()

◆ PrepareContextMenu()

◆ FilterHoveredEntityByMode()

void yaze::editor::OverworldCanvasRenderer::FilterHoveredEntityByMode ( )
private

In an entity mode only that entity type responds to hover/drag/menu.

Definition at line 1126 of file overworld_canvas_renderer.cc.

◆ DrawEntityHoverTooltip()

◆ DrawTile16ViewControls()

void yaze::editor::OverworldCanvasRenderer::DrawTile16ViewControls ( )
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().

Here is the call graph for this function:

◆ DrawTile16AreaPicker()

void yaze::editor::OverworldCanvasRenderer::DrawTile16AreaPicker ( )
private

Definition at line 923 of file overworld_canvas_renderer.cc.

References yaze::zelda3::GetOverworldMapLabel(), and yaze::gui::ScaledSize().

Here is the call graph for this function:

◆ Tile16ScopeMaps()

std::vector< int > yaze::editor::OverworldCanvasRenderer::Tile16ScopeMaps ( ) const
private

Definition at line 741 of file overworld_canvas_renderer.cc.

◆ RefreshTile16Order()

void yaze::editor::OverworldCanvasRenderer::RefreshTile16Order ( bool grid_hovered)
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.

Here is the call graph for this function:

◆ ResetTile16Order()

void yaze::editor::OverworldCanvasRenderer::ResetTile16Order ( )
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.

Member Data Documentation

◆ overlay_layers_

std::unordered_map<int, OverlayLayer> yaze::editor::OverworldCanvasRenderer::overlay_layers_
private

Definition at line 102 of file overworld_canvas_renderer.h.

◆ editor_

OverworldEditor* yaze::editor::OverworldCanvasRenderer::editor_
private

Non-owning pointer to the parent editor.

Definition at line 122 of file overworld_canvas_renderer.h.

Referenced by DrawOverworldCanvas(), OverworldCanvasRenderer(), and PrepareContextMenu().

◆ entity_drag_origin_

std::optional<ImVec2> yaze::editor::OverworldCanvasRenderer::entity_drag_origin_
private

Definition at line 123 of file overworld_canvas_renderer.h.

◆ tile16_scale_mode_

gui::AdaptiveSheetScaleMode yaze::editor::OverworldCanvasRenderer::tile16_scale_mode_
private

◆ area_graphics_scale_mode_

gui::AdaptiveSheetScaleMode yaze::editor::OverworldCanvasRenderer::area_graphics_scale_mode_
private
Initial value:

Definition at line 126 of file overworld_canvas_renderer.h.

◆ tile16_sort_

zelda3::Tile16SortMode yaze::editor::OverworldCanvasRenderer::tile16_sort_ = zelda3::Tile16SortMode::kUsage
private

Definition at line 129 of file overworld_canvas_renderer.h.

◆ tile16_scope_

Tile16UsageScope yaze::editor::OverworldCanvasRenderer::tile16_scope_ = Tile16UsageScope::kAllMaps
private

Definition at line 130 of file overworld_canvas_renderer.h.

◆ tile16_scope_area_

int yaze::editor::OverworldCanvasRenderer::tile16_scope_area_ = 0
private

Definition at line 131 of file overworld_canvas_renderer.h.

◆ tile16_hide_unused_

bool yaze::editor::OverworldCanvasRenderer::tile16_hide_unused_ = false
private

Definition at line 132 of file overworld_canvas_renderer.h.

◆ tile16_order_dirty_

bool yaze::editor::OverworldCanvasRenderer::tile16_order_dirty_ = true
private

Definition at line 133 of file overworld_canvas_renderer.h.

◆ tile16_grid_hovered_

bool yaze::editor::OverworldCanvasRenderer::tile16_grid_hovered_ = false
private

Definition at line 134 of file overworld_canvas_renderer.h.

◆ tile16_last_count_time_

double yaze::editor::OverworldCanvasRenderer::tile16_last_count_time_ = -1.0
private

Definition at line 135 of file overworld_canvas_renderer.h.

◆ tile16_counted_world_

int yaze::editor::OverworldCanvasRenderer::tile16_counted_world_ = -1
private

Definition at line 137 of file overworld_canvas_renderer.h.

◆ tile16_counted_parent_

int yaze::editor::OverworldCanvasRenderer::tile16_counted_parent_ = -1
private

Definition at line 138 of file overworld_canvas_renderer.h.

◆ tile16_usage_counts_

std::vector<int> yaze::editor::OverworldCanvasRenderer::tile16_usage_counts_
private

Definition at line 139 of file overworld_canvas_renderer.h.

Referenced by tile16_usage_count(), and tile16_usage_counts().

◆ tile16_area_search_

char yaze::editor::OverworldCanvasRenderer::tile16_area_search_[64] = {}
private

Definition at line 140 of file overworld_canvas_renderer.h.


The documentation for this class was generated from the following files: