1#ifndef YAZE_APP_EDITOR_OVERWORLD_LYRA_TERRAIN_CANVAS_H_
2#define YAZE_APP_EDITOR_OVERWORLD_LYRA_TERRAIN_CANVAS_H_
8#include <unordered_map>
17#include "imgui/imgui.h"
26 const project::YazeProject& project,
const std::string& source_path,
27 const std::optional<std::string>& source_bytes,
28 const core::LyraTerrainDocument& document);
48 const std::string& project_path,
76 std::optional<core::LyraGameplayAreaSize> size,
109 static std::string
FormatMapIds(
const std::vector<int>& map_ids);
127 std::unordered_map<int, std::unique_ptr<gfx::Bitmap>>
sprites;
133 int state,
bool textures);
149 std::optional<std::string> source_bytes,
152 ImVec2 min,
float size)
const;
168 std::unordered_map<std::string, std::unique_ptr<MapAssets>>
map_assets_;
static constexpr int kMapCount
std::vector< uint8_t > source_rom_
void DrawEntities(const gui::CanvasRuntime &canvas, int world, int state)
void DrawProperties(int map_id, int &state, zelda3::Overworld &overworld, UndoManager &history)
bool PropertyConflict(int map_index) const
void ProjectSaveCommitted()
absl::Status PaintPattern(const TileBrush &brush, int x, int y, int width, int height, bool finalize, UndoManager &history)
LyraTerrainCanvas & operator=(const LyraTerrainCanvas &)=delete
bool PropertyPending(int map_index) const
absl::Status PrepareMapAssets(zelda3::Overworld &overworld, int state)
absl::Status SaveAs(project::YazeProject *project, const std::string &project_path, zelda3::Overworld &overworld)
bool stroke_active() const
std::optional< std::string > source_bytes_
bool entity_placement_active() const
absl::Status SetGameplayArea(int map_id, std::optional< core::LyraGameplayAreaSize > size, zelda3::Overworld &overworld, UndoManager &history)
void DrawSpecialWorld(const gui::CanvasRuntime &canvas)
void HandleEntityInput(const gui::CanvasRuntime &canvas, int world, zelda3::Overworld &overworld, UndoManager &history)
std::shared_ptr< core::LyraTerrainDocument > document_
std::optional< core::LyraAuthoringState > validated_authoring_
std::vector< int > PendingPropertyMaps() const
friend class LyraTerrainCanvasTestPeer
LyraTerrainCanvas()=default
absl::Status ValidateMapAssets(zelda3::Overworld &overworld, const core::LyraAuthoringState &authoring)
gfx::Bitmap & MapAtlas(int map_id)
absl::Status Create(project::YazeProject *project, zelda3::Overworld &overworld)
std::array< std::optional< PropertyDraft >, core::LyraTerrainDocument::kMapCount > property_drafts_
absl::StatusOr< std::unique_ptr< MapAssets > > ResolveMapAssets(zelda3::Overworld &overworld, const core::LyraMapProperties &properties, int state, bool textures)
void DrawEdgeConnections(int map_id, zelda3::Overworld &overworld, UndoManager &history)
void InstallDocument(std::shared_ptr< core::LyraTerrainDocument > document, gfx::Bitmap atlas, std::string source_path, std::optional< std::string > source_bytes, bool unpublished)
std::optional< ImVec2 > last_cell_
absl::Status EditAuthoring(core::LyraAuthoringState after, zelda3::Overworld &overworld, UndoManager &history)
const core::LyraTerrainDocument * document() const
void RevertPropertyDraft(int map_index)
const gfx::Bitmap & atlas() const
absl::Status authoring_assets_status_
static std::string FormatMapIds(const std::vector< int > &map_ids)
void PaintStamp(int x, int y)
std::array< MapAssets *, 32 > displayed_assets_
std::array< char, 64 > sprite_filter_
void DrawGameplayArea(int map_id, zelda3::Overworld &overworld, UndoManager &history)
std::vector< uint8_t > source_graphics_
gfx::Bitmap * MapGraphics(int map_id)
std::unordered_map< std::string, std::unique_ptr< MapAssets > > map_assets_
void DrawSpritePreview(const gui::CanvasRuntime &canvas, int map_id, const core::LyraSpritePlacement &sprite)
void DrawTile(ImDrawList *draw, const gfx::Bitmap &atlas, int tile, ImVec2 min, float size) const
std::optional< core::LyraAuthoringState > drag_before_
absl::Status BindSource(zelda3::Overworld &overworld, core::LyraTerrainProfile *profile, gfx::Bitmap *atlas=nullptr)
absl::StatusOr< core::LyraMapProperties > CopyNativeGraphicsSettings(zelda3::Overworld &overworld, int source_map, core::LyraMapProperties candidate)
bool pending_project_commit_
absl::Status CheckAssetSources(zelda3::Overworld &overworld)
absl::Status ApplyPropertyDraft(int map_index, zelda3::Overworld &overworld, UndoManager &history)
gfx::Bitmap unavailable_atlas_
absl::Status Load(project::YazeProject *project, zelda3::Overworld &overworld)
uint32_t selected_entity_
absl::Status Save(project::YazeProject *project, zelda3::Overworld &overworld)
void FinishStroke(UndoManager &history)
absl::Status ApplyAuthoring(core::LyraAuthoringState after, zelda3::Overworld &overworld, UndoManager &history)
std::string copy_message_
void PaintLine(int x, int y)
core::LyraMapProperties & PropertyDraftFor(int map_index)
absl::Status ValidateSave(project::YazeProject *project, zelda3::Overworld &overworld)
LyraTerrainCanvas(const LyraTerrainCanvas &)=delete
std::string source_metadata_
absl::Status source_status_
absl::Status Open(project::YazeProject *project, const std::string &path, zelda3::Overworld &overworld)
Manages undo/redo stacks for a single editor.
Represents a bitmap image optimized for SNES ROM hacking.
Editors are the view controllers for the application.
absl::StatusOr< std::string > PublishLyraTerrainSource(const project::YazeProject &project, const std::string &source_path, const std::optional< std::string > &source_bytes, const core::LyraTerrainDocument &document)
std::unordered_map< int, std::unique_ptr< gfx::Bitmap > > sprites
std::unordered_map< int, SDL_Rect > sprite_bounds
core::LyraMapProperties draft
core::LyraMapProperties baseline
Modern project structure with comprehensive settings consolidation.