yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
door_interaction_handler.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_INTERACTION_DOOR_INTERACTION_HANDLER_H_
2#define YAZE_APP_EDITOR_DUNGEON_INTERACTION_DOOR_INTERACTION_HANDLER_H_
3
8
9namespace yaze {
10namespace editor {
11
19 public:
21 kNone = 0,
25 };
26
27 // ========================================================================
28 // BaseEntityHandler interface
29 // ========================================================================
30
31 void BeginPlacement() override;
32 void CancelPlacement() override;
33 bool IsPlacementActive() const override { return door_placement_mode_; }
34
35 bool HandleClick(int canvas_x, int canvas_y) override;
36 void HandleDrag(ImVec2 current_pos, ImVec2 delta) override;
37 void HandleRelease() override;
38
39 void DrawGhostPreview() override;
40 void DrawSelectionHighlight() override;
41
42 std::optional<size_t> GetEntityAtPosition(int canvas_x,
43 int canvas_y) const override;
44
45 // ========================================================================
46 // Door-specific methods
47 // ========================================================================
48
53
58
64 void DrawSnapIndicators();
65
69 void SelectDoor(size_t index);
70
74 void ClearSelection();
75
79 bool HasSelection() const { return selected_door_index_.has_value(); }
80
84 std::optional<size_t> GetSelectedIndex() const { return selected_door_index_; }
85
89 void DeleteSelected();
90
101
102 private:
103 // Placement state
109
110 // Selection state
111 std::optional<size_t> selected_door_index_;
112 bool is_dragging_ = false;
115
119 void PlaceDoorAtSnappedPosition(int canvas_x, int canvas_y);
120
124 bool UpdateSnappedPosition(int canvas_x, int canvas_y);
125};
126
127} // namespace editor
128} // namespace yaze
129
130#endif // YAZE_APP_EDITOR_DUNGEON_INTERACTION_DOOR_INTERACTION_HANDLER_H_
Abstract base class for entity interaction handlers.
Handles door placement and interaction in the dungeon editor.
void DrawSelectionHighlight() override
Draw selection highlight for selected entities.
void DrawSnapIndicators()
Draw snap position indicators during door drag.
void SelectDoor(size_t index)
Select door at index.
void DrawGhostPreview() override
Draw ghost preview during placement.
zelda3::DoorType GetDoorType() const
Get current door type for placement.
void HandleDrag(ImVec2 current_pos, ImVec2 delta) override
Handle mouse drag.
void SetDoorType(zelda3::DoorType type)
Set door type for placement.
void CancelPlacement() override
Cancel current placement.
PlacementBlockReason placement_block_reason() const
void BeginPlacement() override
Begin placement mode.
void HandleRelease() override
Handle mouse release.
bool HandleClick(int canvas_x, int canvas_y) override
Handle mouse click at canvas position.
std::optional< size_t > GetSelectedIndex() const
Get selected door index.
bool IsPlacementActive() const override
Check if placement mode is active.
bool UpdateSnappedPosition(int canvas_x, int canvas_y)
Update snapped position based on cursor.
void PlaceDoorAtSnappedPosition(int canvas_x, int canvas_y)
Place door at snapped position.
std::optional< size_t > GetEntityAtPosition(int canvas_x, int canvas_y) const override
Get entity at canvas position.
bool was_placement_blocked() const
True if the most recent PlaceDoorAtSnappedPosition was blocked.
bool HasSelection() const
Check if a door is selected.
DoorType
Door types from ALTTP.
Definition door_types.h:33
@ NormalDoor
Normal door (upper layer)
DoorDirection
Door direction on room walls.
Definition door_types.h:18
@ North
Top wall (horizontal door, 4x3 tiles)