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

Manages tile painting, fill, selection, and eyedropper operations. More...

#include <tile_painting_manager.h>

Collaboration diagram for yaze::editor::TilePaintingManager:

Classes

struct  TilePosition
 

Public Member Functions

 TilePaintingManager (const TilePaintingDependencies &deps, const TilePaintingCallbacks &callbacks)
 
void CheckForOverworldEdits ()
 Main entry point: check for tile edits (paint, fill, stamp).
 
void CheckForSelectRectangle ()
 Draw and create the tile16 IDs that are currently selected.
 
const TileBrush * selection_brush () const
 The captured selection, independent of its source or preview position.
 
absl::Status PasteBrush (const TileBrush &brush)
 
void RenderUpdatedMapBitmap (const ImVec2 &click_position, const std::vector< uint8_t > &tile_data)
 Update bitmap pixels after a single tile paint.
 
bool PickTile16FromHoveredCanvas ()
 Eyedropper: pick the tile16 under the hovered canvas position.
 
void ToggleBrushTool ()
 Toggle between DRAW_TILE and MOUSE modes.
 
void ActivateFillTool ()
 Toggle FILL_TILE mode on/off.
 
const gfx::Bitmap & map_brush_preview (int map_id) const
 

Private Types

using ChangedMaps = std::array<bool, zelda3::kNumOverworldMaps>
 

Private Member Functions

TilePosition HoveredTile () const
 
bool IsValidTile (TilePosition position) const
 
std::vector< std::vector< uint16_t > > & WorldTiles () const
 
void CaptureSelection ()
 
void DrawBrushPreview (const TileBrush &brush, TilePosition anchor, bool mark_selection, int alpha)
 
std::vector< uint8_t > Tile16PixelsForMap (int map_id, int tile_id) const
 
void PaintPattern (const TileBrush &brush, TilePosition anchor, int width, int height, bool finalize=true)
 
bool PaintTile (TilePosition position, int tile_id, ChangedMaps &changed_maps)
 
void RenderMapTile (int map_id, TilePosition position, const std::vector< uint8_t > &tile_data)
 

Private Attributes

TilePaintingDependencies deps_
 
TilePaintingCallbacks callbacks_
 
bool paint_gesture_owned_ = false
 
bool single_paint_pending_ = false
 
bool selection_gesture_owned_ = false
 
TileBrush brush_
 
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > map_brush_previews_
 

Detailed Description

Manages tile painting, fill, selection, and eyedropper operations.

Owns captured brush contents and canvas gestures. All destinations use world Tile16 coordinates; callbacks publish undo and refresh affected maps.

Definition at line 58 of file tile_painting_manager.h.

Member Typedef Documentation

◆ ChangedMaps

Definition at line 100 of file tile_painting_manager.h.

Constructor & Destructor Documentation

◆ TilePaintingManager()

yaze::editor::TilePaintingManager::TilePaintingManager ( const TilePaintingDependencies & deps,
const TilePaintingCallbacks & callbacks )

Definition at line 34 of file tile_painting_manager.cc.

Member Function Documentation

◆ CheckForOverworldEdits()

◆ CheckForSelectRectangle()

◆ selection_brush()

const TileBrush * yaze::editor::TilePaintingManager::selection_brush ( ) const

The captured selection, independent of its source or preview position.

Definition at line 71 of file tile_painting_manager.cc.

References brush_, deps_, yaze::editor::TilePaintingDependencies::ow_map_canvas, yaze::gui::Canvas::select_rect_active(), and yaze::editor::TileBrush::valid().

Referenced by CheckForOverworldEdits(), and CheckForSelectRectangle().

Here is the call graph for this function:

◆ PasteBrush()

absl::Status yaze::editor::TilePaintingManager::PasteBrush ( const TileBrush & brush)

Paste a validated pattern at the current canvas cursor, using the same clipping, per-map refresh, and undo path as rectangle painting.

Definition at line 132 of file tile_painting_manager.cc.

References deps_, yaze::editor::TileBrush::height, HoveredTile(), yaze::gui::Canvas::IsMouseHovering(), yaze::editor::TilePaintingDependencies::ow_map_canvas, PaintPattern(), yaze::editor::TileBrush::valid(), and yaze::editor::TileBrush::width.

Here is the call graph for this function:

◆ RenderUpdatedMapBitmap()

void yaze::editor::TilePaintingManager::RenderUpdatedMapBitmap ( const ImVec2 & click_position,
const std::vector< uint8_t > & tile_data )

◆ PickTile16FromHoveredCanvas()

◆ ToggleBrushTool()

void yaze::editor::TilePaintingManager::ToggleBrushTool ( )

◆ ActivateFillTool()

void yaze::editor::TilePaintingManager::ActivateFillTool ( )

◆ map_brush_preview()

const gfx::Bitmap & yaze::editor::TilePaintingManager::map_brush_preview ( int map_id) const
inline

Last brush preview piece built for map_id: the brush drawn with that map's own tile16 graphics and palette (tests and diagnostics).

Definition at line 91 of file tile_painting_manager.h.

References yaze::gfx::Bitmap::at(), and map_brush_previews_.

Here is the call graph for this function:

◆ HoveredTile()

TilePaintingManager::TilePosition yaze::editor::TilePaintingManager::HoveredTile ( ) const
private

◆ IsValidTile()

◆ WorldTiles()

std::vector< std::vector< uint16_t > > & yaze::editor::TilePaintingManager::WorldTiles ( ) const
private

◆ CaptureSelection()

◆ DrawBrushPreview()

◆ Tile16PixelsForMap()

std::vector< uint8_t > yaze::editor::TilePaintingManager::Tile16PixelsForMap ( int map_id,
int tile_id ) const
private

◆ PaintPattern()

◆ PaintTile()

◆ RenderMapTile()

void yaze::editor::TilePaintingManager::RenderMapTile ( int map_id,
TilePosition position,
const std::vector< uint8_t > & tile_data )
private

Member Data Documentation

◆ deps_

◆ callbacks_

TilePaintingCallbacks yaze::editor::TilePaintingManager::callbacks_
private

◆ paint_gesture_owned_

bool yaze::editor::TilePaintingManager::paint_gesture_owned_ = false
private

Definition at line 121 of file tile_painting_manager.h.

Referenced by CheckForOverworldEdits().

◆ single_paint_pending_

bool yaze::editor::TilePaintingManager::single_paint_pending_ = false
private

Definition at line 122 of file tile_painting_manager.h.

Referenced by CheckForOverworldEdits(), and PaintPattern().

◆ selection_gesture_owned_

bool yaze::editor::TilePaintingManager::selection_gesture_owned_ = false
private

Definition at line 123 of file tile_painting_manager.h.

Referenced by CheckForSelectRectangle().

◆ brush_

TileBrush yaze::editor::TilePaintingManager::brush_
private

◆ map_brush_previews_

std::array<gfx::Bitmap, zelda3::kNumOverworldMaps> yaze::editor::TilePaintingManager::map_brush_previews_
private

Definition at line 125 of file tile_painting_manager.h.

Referenced by DrawBrushPreview(), and map_brush_preview().


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