yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
interaction_coordinator.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_INTERACTION_INTERACTION_COORDINATOR_H_
2#define YAZE_APP_EDITOR_DUNGEON_INTERACTION_INTERACTION_COORDINATOR_H_
3
9
10namespace yaze {
11namespace editor {
12
21 public:
25 enum class Mode {
26 Select, // Normal selection mode (no placement)
27 PlaceDoor, // Door placement mode
28 PlaceSprite, // Sprite placement mode
29 PlaceItem // Item placement mode
30 };
31
35
42
46 Mode GetCurrentMode() const { return current_mode_; }
47
53 void SetMode(Mode mode);
54
58 void CancelCurrentMode();
59
63 bool IsPlacementActive() const;
64
65 // ========================================================================
66 // Handler Access
67 // ========================================================================
68
71
76
79
81 const TileObjectHandler& tile_handler() const { return tile_handler_; }
82
83 // ========================================================================
84 // Unified Interaction Methods
85 // ========================================================================
86
93 bool HandleClick(int canvas_x, int canvas_y);
94 bool HandleMouseWheel(float delta);
95
96 void SelectEntity(EntityType type, size_t index);
98 bool HasEntitySelection() const;
99 void CancelPlacement();
100
101 // Doors/sprites/items only (tile objects are handled by ObjectSelection).
102 std::optional<SelectedEntity> GetEntityAtPosition(int canvas_x,
103 int canvas_y) const;
104
105 // Current selection (doors/sprites/items only). Returns {None,0} if none.
107
111 void HandleDrag(ImVec2 current_pos, ImVec2 delta);
112
116 void HandleRelease();
117
121 void DrawGhostPreviews();
122
127
135
136 // ========================================================================
137 // Entity Selection
138 // ========================================================================
139
146 bool TrySelectEntityAtCursor(int canvas_x, int canvas_y);
147
152
157
163
164 private:
167
172
178};
179
180} // namespace editor
181} // namespace yaze
182
183#endif // YAZE_APP_EDITOR_DUNGEON_INTERACTION_INTERACTION_COORDINATOR_H_
Abstract base class for entity interaction handlers.
Handles door placement and interaction in the dungeon editor.
Coordinates interaction mode switching and dispatches to handlers.
const DoorInteractionHandler & door_handler() const
bool TrySelectEntityAtCursor(int canvas_x, int canvas_y)
Try to select entity at cursor position.
Mode GetSelectedEntityType() const
Get the type of currently selected entity.
const TileObjectHandler & tile_handler() const
void CancelCurrentMode()
Cancel current mode and return to select mode.
Mode GetCurrentMode() const
Get current interaction mode.
SpriteInteractionHandler & sprite_handler()
void SetContext(InteractionContext *ctx)
Set the shared interaction context.
BaseEntityHandler * GetActiveHandler()
Get active handler based on current mode.
void DeleteSelectedEntity()
Delete currently selected entity.
bool IsPlacementActive() const
Check if any placement mode is active.
bool HandleClick(int canvas_x, int canvas_y)
Handle click at canvas position.
void SelectEntity(EntityType type, size_t index)
void DrawPostPlacementOverlays()
Draw post-placement success toasts for all handlers (unconditional)
const SpriteInteractionHandler & sprite_handler() const
void DrawSelectionHighlights()
Draw selection highlights for all entity types.
const ItemInteractionHandler & item_handler() const
void SetMode(Mode mode)
Set interaction mode.
void ClearAllEntitySelections()
Clear all entity selections.
void DrawGhostPreviews()
Draw ghost previews for active placement mode.
std::optional< SelectedEntity > GetEntityAtPosition(int canvas_x, int canvas_y) const
void HandleDrag(ImVec2 current_pos, ImVec2 delta)
Handle drag operation.
Handles pot item placement and interaction in the dungeon editor.
Handles sprite placement and interaction in the dungeon editor.
Handles functional mutations and queries for tile objects.
EntityType
Type of entity that can be selected in the dungeon editor.
Shared context for all interaction handlers.
Represents a selected entity in the dungeon editor.