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:
20 // ========================================================================
21 // BaseEntityHandler interface
22 // ========================================================================
23
24 void BeginPlacement() override;
25 void CancelPlacement() override;
26 bool IsPlacementActive() const override { return door_placement_mode_; }
27
28 bool HandleClick(int canvas_x, int canvas_y) override;
29 void HandleDrag(ImVec2 current_pos, ImVec2 delta) override;
30 void HandleRelease() override;
31
32 void DrawGhostPreview() override;
33 void DrawSelectionHighlight() override;
34
35 std::optional<size_t> GetEntityAtPosition(int canvas_x,
36 int canvas_y) const override;
37
38 // ========================================================================
39 // Door-specific methods
40 // ========================================================================
41
46
51
57 void DrawSnapIndicators();
58
62 void SelectDoor(size_t index);
63
67 void ClearSelection();
68
72 bool HasSelection() const { return selected_door_index_.has_value(); }
73
77 std::optional<size_t> GetSelectedIndex() const { return selected_door_index_; }
78
82 void DeleteSelected();
83
84 private:
85 // Placement state
90
91 // Selection state
92 std::optional<size_t> selected_door_index_;
93 bool is_dragging_ = false;
96
100 void PlaceDoorAtSnappedPosition(int canvas_x, int canvas_y);
101
105 bool UpdateSnappedPosition(int canvas_x, int canvas_y);
106};
107
108} // namespace editor
109} // namespace yaze
110
111#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.
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 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)