1#ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_INTERACTION_H
2#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_INTERACTION_H
19#include "imgui/imgui.h"
111 void SetCurrentRoom(std::array<zelda3::Room, dungeon_coords::kRoomCount>* rooms,
189 for (
size_t idx : indices) {
290 std::array<zelda3::Room, dungeon_coords::kRoomCount>*
rooms_ =
nullptr;
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Handles object selection, placement, and interaction within the dungeon canvas.
void BringSelectedForward()
void HandleDeleteSelected()
void SetSelectedObjects(const std::vector< size_t > &indices)
void SetCurrentRoom(std::array< zelda3::Room, dungeon_coords::kRoomCount > *rooms, int room_id)
std::pair< int, int > CalculateObjectBounds(const zelda3::RoomObject &object)
InteractionContext interaction_context_
bool IsWithinCanvasBounds(int canvas_x, int canvas_y, int margin=32) const
void SetCacheInvalidationCallback(std::function< void()> callback)
void HandleDeleteAllObjects()
void HandleCanvasMouseInput()
void SetPreviewSpriteId(uint8_t id)
void HandleObjectSelectionStart(const ImVec2 &canvas_mouse_pos)
std::pair< int, int > RoomToCanvasCoordinates(int room_x, int room_y) const
bool IsMaskModeActive() const
bool IsObjectSelected(size_t index) const
void SetCurrentPaletteGroup(const gfx::PaletteGroup &group)
void SetContext(const InteractionContext &ctx)
Set the unified interaction context.
bool AreLayersMerged() const
bool IsLayerFilterActive() const
void SetItemPlacementMode(bool enabled, uint8_t item_id=0)
void SendSelectedBackward()
void DrawHoverHighlight(const std::vector< zelda3::RoomObject > &objects)
std::function< void(const zelda3::RoomObject &) object_placed_callback_)
void SetPreviewItemId(uint8_t id)
InteractionCoordinator entity_coordinator_
void PlaceObjectAtPosition(int room_x, int room_y)
ObjectSelection selection_
void CancelDoorPlacement()
zelda3::RoomObject preview_object_
SelectedEntity GetSelectedEntity() const
void SetSpritePlacementMode(bool enabled, uint8_t sprite_id=0)
void SetEditorSystem(zelda3::DungeonEditorSystem *system)
bool HasClipboardData() const
int GetLayerFilter() const
void HandleMouseRelease()
void DrawEntitySelectionHighlights()
bool SetObjectLayer(size_t index, zelda3::RoomObject::LayerType layer)
void SetObjectPlacedCallback(std::function< void(const zelda3::RoomObject &)> callback)
bool IsItemPlacementActive() const
zelda3::DoorType GetPreviewDoorType() const
void DrawSelectionHighlights()
void HandleLayerKeyboardShortcuts()
MutationDomain last_mutation_domain() const
void SetPreviewDoorType(zelda3::DoorType type)
void SendSelectedToBack()
bool IsObjectSelectActive() const
zelda3::DungeonEditorSystem * editor_system_
void CancelItemPlacement()
void HandleLeftClick(const ImVec2 &canvas_mouse_pos)
std::vector< size_t > GetSelectedObjectIndices() const
void SetSelectionChangeCallback(std::function< void()> callback)
bool SetObjectSize(size_t index, uint8_t size)
const char * GetLayerFilterName() const
InteractionModeManager & mode_manager()
bool IsDoorPlacementActive() const
bool IsSpritePlacementActive() const
void UpdateWaterFillPainting(const ImVec2 &canvas_mouse_pos)
DungeonObjectInteraction(gui::Canvas *canvas)
MutationDomain last_invalidation_domain() const
bool SetObjectId(size_t index, int16_t id)
uint8_t GetPreviewSpriteId() const
InteractionCoordinator & entity_coordinator()
Get the interaction coordinator for entity handling.
std::array< zelda3::Room, dungeon_coords::kRoomCount > * rooms_
size_t GetSelectionCount() const
void SendSelectedToLayer(int target_layer)
void SetMutationCallback(std::function< void()> callback)
void SetEntityChangedCallback(std::function< void()> callback)
void DrawDoorSnapIndicators()
void ClearEntitySelection()
void HandlePasteObjects()
void HandleScrollWheelResize()
bool HasEntitySelection() const
void SelectEntity(EntityType type, size_t index)
const InteractionCoordinator & entity_coordinator() const
bool IsObjectLoaded() const
void SetDoorPlacementMode(bool enabled, zelda3::DoorType type=zelda3::DoorType::NormalDoor)
gfx::PaletteGroup current_palette_group_
std::pair< int, int > CanvasToRoomCoordinates(int canvas_x, int canvas_y) const
uint8_t GetPreviewItemId() const
void HandleEmptySpaceClick(const ImVec2 &canvas_mouse_pos)
void SetPreviewObject(const zelda3::RoomObject &object, bool loaded)
void HandleCopySelected()
InteractionModeManager mode_manager_
void CancelSpritePlacement()
void CheckForObjectSelection()
void SendSelectedToFront()
void SetLayerFilter(int layer)
void SetLayersMerged(bool merged)
void UpdateCollisionPainting(const ImVec2 &canvas_mouse_pos)
const InteractionModeManager & mode_manager() const
Coordinates interaction mode switching and dispatches to handlers.
SelectedEntity GetSelectedEntity() const
void SetContext(InteractionContext *ctx)
Set the shared interaction context.
TileObjectHandler & tile_handler()
bool HasEntitySelection() const
Manages interaction mode state and transitions.
void CancelCurrentMode()
Cancel current mode and return to Select.
InteractionMode GetMode() const
Get current interaction mode.
ModeState & GetModeState()
Get mutable reference to mode state.
Manages object selection state and operations for the dungeon editor.
void SetSelectionChangedCallback(std::function< void()> callback)
Set callback to be invoked when selection changes.
bool IsMaskModeActive() const
Check if mask selection mode is active.
bool IsRectangleSelectionActive() const
Check if a rectangle selection is in progress.
int GetLayerFilter() const
Get the current active layer filter.
bool IsObjectSelected(size_t index) const
Check if an object is selected.
std::vector< size_t > GetSelectedIndices() const
Get all selected object indices.
bool AreLayersMerged() const
Check if layers are currently merged.
size_t GetSelectionCount() const
Get the number of selected objects.
void SelectObject(size_t index, SelectionMode mode=SelectionMode::Single)
Select a single object by index.
void ClearSelection()
Clear all selections.
const char * GetLayerFilterName() const
Get the name of the current layer filter for display.
void SetLayersMerged(bool merged)
Set whether layers are currently merged in the room.
void SetLayerFilter(int layer)
Set the active layer filter for selection.
bool IsLayerFilterActive() const
Check if layer filtering is active.
bool HasSelection() const
Check if any objects are selected.
bool HasClipboardData() const
Check if clipboard has data.
Modern, robust canvas for drawing and manipulating graphics.
Core dungeon editing system.
MutationDomain
Domain/type of mutation for undo + invalidation routing.
EntityType
Type of entity that can be selected in the dungeon editor.
DoorType
Door types from ALTTP.
@ NormalDoor
Normal door (upper layer)
Shared context for all interaction handlers.
MutationDomain last_invalidation_domain
std::function< void()> on_invalidate_cache
ObjectSelection * selection
std::function< void()> on_mutation
gfx::PaletteGroup current_palette_group
MutationDomain last_mutation_domain
std::function< void()> on_entity_changed
std::optional< zelda3::DoorType > preview_door_type
std::optional< uint8_t > preview_item_id
std::optional< uint8_t > preview_sprite_id
Represents a selected entity in the dungeon editor.
Represents a group of palettes.