1#ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_INTERACTION_H
2#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_INTERACTION_H
18#include "imgui/imgui.h"
128 void SetCurrentRoom(std::array<zelda3::Room, dungeon_coords::kRoomCount>* rooms,
215 for (
size_t idx : indices) {
281 [[deprecated(
"Use SetMutationCallback() instead")]]
316 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_
void PlaceDoorAtPosition(int canvas_x, int canvas_y)
bool IsWithinCanvasBounds(int canvas_x, int canvas_y, int margin=32) const
void SetCacheInvalidationCallback(std::function< void()> callback)
void HandleCanvasMouseInput()
void SetPreviewSpriteId(uint8_t id)
std::unique_ptr< gfx::BackgroundBuffer > ghost_preview_buffer_
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.
size_t hovered_object_index_
size_t GetHoveredObjectIndex() const
bool AreLayersMerged() const
void DrawDoorGhostPreview()
bool IsLayerFilterActive() const
void SetItemPlacementMode(bool enabled, uint8_t item_id=0)
void SendSelectedBackward()
bool IsObjectInSelectBox(const zelda3::RoomObject &object) const
void DrawHoverHighlight(const std::vector< zelda3::RoomObject > &objects)
const SelectedEntity & GetSelectedEntity() const
void PlaceSpriteAtPosition(int canvas_x, int canvas_y)
void DrawSpriteGhostPreview()
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 DrawItemGhostPreview()
void CancelDoorPlacement()
zelda3::RoomObject preview_object_
std::unique_ptr< zelda3::ObjectDrawer > object_drawer_
void SetSpritePlacementMode(bool enabled, uint8_t sprite_id=0)
void SetEditorSystem(zelda3::DungeonEditorSystem *system)
bool HasClipboardData() const
int GetLayerFilter() const
void DrawEntitySelectionHighlights()
void SetObjectPlacedCallback(std::function< void(const zelda3::RoomObject &)> callback)
bool IsItemPlacementActive() const
zelda3::DoorType GetPreviewDoorType() const
void UpdateSelectedObjects()
void DrawSelectionHighlights()
void HandleLayerKeyboardShortcuts()
void DrawObjectSelectRect()
void SetPreviewDoorType(zelda3::DoorType type)
void SendSelectedToBack()
bool IsObjectSelectActive() const
zelda3::DungeonEditorSystem * editor_system_
void CancelItemPlacement()
std::vector< size_t > GetSelectedObjectIndices() const
void SetSelectionChangeCallback(std::function< void()> callback)
bool TrySelectObjectAtCursor()
bool TrySelectEntityAtCursor()
const char * GetLayerFilterName() const
InteractionModeManager & mode_manager()
bool IsDoorPlacementActive() const
bool IsSpritePlacementActive() const
SelectedEntity selected_entity_
DungeonObjectInteraction(gui::Canvas *canvas)
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)
std::vector< zelda3::RoomObject > clipboard_
void SetMutationCallback(std::function< void()> callback)
void SetEntityChangedCallback(std::function< void()> callback)
void DrawDoorSnapIndicators()
void ClearEntitySelection()
void HandlePasteObjects()
std::optional< SelectedEntity > GetEntityAtPosition(int canvas_x, int canvas_y) const
void HandleScrollWheelResize()
void SetMutationHook(std::function< void()> callback)
bool HasEntitySelection() const
void SelectEntity(EntityType type, size_t index)
const InteractionCoordinator & entity_coordinator() const
bool IsObjectLoaded() const
void SelectObjectsInRect()
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
void RenderGhostPreviewBitmap()
uint8_t GetPreviewItemId() const
void SetPreviewObject(const zelda3::RoomObject &object, bool loaded)
void HandleCopySelected()
void PlaceItemAtPosition(int canvas_x, int canvas_y)
InteractionModeManager mode_manager_
void CancelSpritePlacement()
void CheckForObjectSelection()
void SendSelectedToFront()
void SetLayerFilter(int layer)
void SetLayersMerged(bool merged)
const InteractionModeManager & mode_manager() const
Coordinates interaction mode switching and dispatches to handlers.
void SetContext(InteractionContext *ctx)
Set the shared interaction context.
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.
Modern, robust canvas for drawing and manipulating graphics.
Comprehensive dungeon editing system.
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.
std::function< void()> on_invalidate_cache
std::function< void()> on_mutation
gfx::PaletteGroup current_palette_group
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.
bool operator==(const SelectedEntity &other) const
Represents a group of palettes.