Manages interaction mode state and transitions. More...
#include <interaction_mode.h>

Public Member Functions | |
| InteractionMode | GetMode () const |
| Get current interaction mode. | |
| InteractionMode | GetPreviousMode () const |
| Get previous mode (for undo/escape handling) | |
| void | SetMode (InteractionMode mode) |
| Set interaction mode. | |
| void | CancelCurrentMode () |
| Cancel current mode and return to Select. | |
| bool | IsPlacementActive () const |
| Check if any placement mode is active. | |
| bool | IsSelectMode () const |
| Check if in normal selection mode. | |
| bool | IsDragging () const |
| Check if any dragging operation is in progress. | |
| bool | IsRectangleSelecting () const |
| Check if rectangle selection is in progress. | |
| bool | IsObjectPlacementActive () const |
| Check if object placement mode is active. | |
| bool | IsDoorPlacementActive () const |
| Check if door placement mode is active. | |
| bool | IsSpritePlacementActive () const |
| Check if sprite placement mode is active. | |
| bool | IsItemPlacementActive () const |
| Check if item placement mode is active. | |
| bool | IsEntityPlacementActive () const |
| Check if entity (non-object) placement is active. | |
| ModeState & | GetModeState () |
| Get mutable reference to mode state. | |
| const ModeState & | GetModeState () const |
| Get const reference to mode state. | |
| const char * | GetModeName () const |
| Get mode name for debugging/UI. | |
Private Attributes | |
| InteractionMode | current_mode_ = InteractionMode::Select |
| InteractionMode | previous_mode_ = InteractionMode::Select |
| ModeState | mode_state_ |
Manages interaction mode state and transitions.
Provides a unified interface for mode management, replacing scattered boolean flags with explicit state machine semantics.
Usage: InteractionModeManager mode_manager;
// Enter placement mode mode_manager.SetMode(InteractionMode::PlaceObject); mode_manager.GetModeState().preview_object = some_object;
// Query mode if (mode_manager.IsPlacementActive()) { ... }
// Cancel and return to select mode_manager.CancelCurrentMode();
Definition at line 143 of file interaction_mode.h.
|
inline |
Get current interaction mode.
Definition at line 148 of file interaction_mode.h.
References current_mode_.
Referenced by yaze::editor::DungeonObjectInteraction::CancelDoorPlacement(), yaze::editor::DungeonObjectInteraction::CancelItemPlacement(), yaze::editor::DungeonObjectInteraction::CancelSpritePlacement(), yaze::editor::DungeonObjectInteraction::ClearEntitySelection(), yaze::editor::DungeonObjectInteraction::ClearSelection(), yaze::editor::DungeonObjectInteraction::DrawDoorGhostPreview(), yaze::editor::DungeonObjectInteraction::DrawDoorSnapIndicators(), yaze::editor::DungeonObjectInteraction::DrawDragPreview(), yaze::editor::DungeonObjectInteraction::DrawEntitySelectionHighlights(), yaze::editor::DungeonObjectInteraction::DrawGhostPreview(), yaze::editor::DungeonObjectInteraction::DrawItemGhostPreview(), yaze::editor::DungeonObjectInteraction::DrawSpriteGhostPreview(), yaze::editor::DungeonObjectInteraction::HandleCanvasMouseInput(), yaze::editor::DungeonObjectInteraction::HandleEntityDrag(), yaze::editor::DungeonObjectInteraction::IsDoorPlacementActive(), yaze::editor::DungeonObjectInteraction::IsItemPlacementActive(), yaze::editor::DungeonObjectInteraction::IsObjectLoaded(), yaze::editor::DungeonObjectInteraction::IsSpritePlacementActive(), yaze::editor::DungeonObjectInteraction::PlaceDoorAtPosition(), yaze::editor::DungeonObjectInteraction::PlaceItemAtPosition(), yaze::editor::DungeonObjectInteraction::PlaceSpriteAtPosition(), yaze::editor::DungeonObjectInteraction::SetDoorPlacementMode(), yaze::editor::DungeonObjectInteraction::SetItemPlacementMode(), yaze::editor::DungeonObjectInteraction::SetPreviewObject(), and yaze::editor::DungeonObjectInteraction::SetSpritePlacementMode().
|
inline |
Get previous mode (for undo/escape handling)
Definition at line 153 of file interaction_mode.h.
References previous_mode_.
| void yaze::editor::InteractionModeManager::SetMode | ( | InteractionMode | mode | ) |
Set interaction mode.
Clears appropriate state data when transitioning between modes.
| mode | The new mode to enter |
Definition at line 6 of file interaction_mode.cc.
References yaze::editor::ModeState::ClearDragData(), yaze::editor::ModeState::ClearPlacementData(), yaze::editor::ModeState::ClearRectangleData(), current_mode_, yaze::editor::DraggingEntity, yaze::editor::DraggingObjects, mode_state_, yaze::editor::PlaceDoor, yaze::editor::PlaceItem, yaze::editor::PlaceObject, yaze::editor::PlaceSprite, previous_mode_, yaze::editor::RectangleSelect, and yaze::editor::Select.
Referenced by yaze::editor::DungeonObjectInteraction::ClearEntitySelection(), yaze::editor::DungeonObjectInteraction::ClearSelection(), yaze::editor::DungeonObjectInteraction::HandleCanvasMouseInput(), yaze::editor::DungeonObjectInteraction::HandleEntityDrag(), yaze::editor::DungeonObjectInteraction::SetDoorPlacementMode(), yaze::editor::DungeonObjectInteraction::SetItemPlacementMode(), yaze::editor::DungeonObjectInteraction::SetPreviewObject(), yaze::editor::DungeonObjectInteraction::SetSpritePlacementMode(), and yaze::editor::DungeonObjectInteraction::TrySelectEntityAtCursor().

| void yaze::editor::InteractionModeManager::CancelCurrentMode | ( | ) |
Cancel current mode and return to Select.
Clears mode-specific state and returns to normal selection mode.
Definition at line 43 of file interaction_mode.cc.
References yaze::editor::ModeState::Clear(), current_mode_, mode_state_, previous_mode_, and yaze::editor::Select.
Referenced by yaze::editor::DungeonObjectInteraction::CancelDoorPlacement(), yaze::editor::DungeonObjectInteraction::CancelItemPlacement(), yaze::editor::DungeonObjectInteraction::CancelPlacement(), and yaze::editor::DungeonObjectInteraction::CancelSpritePlacement().

|
inline |
Check if any placement mode is active.
Definition at line 173 of file interaction_mode.h.
References current_mode_, yaze::editor::PlaceDoor, yaze::editor::PlaceItem, yaze::editor::PlaceObject, and yaze::editor::PlaceSprite.
Referenced by yaze::editor::DungeonObjectInteraction::HandleCanvasMouseInput(), and yaze::editor::DungeonObjectInteraction::HandleScrollWheelResize().
|
inline |
Check if in normal selection mode.
Definition at line 183 of file interaction_mode.h.
References current_mode_, and yaze::editor::Select.
|
inline |
Check if any dragging operation is in progress.
Definition at line 188 of file interaction_mode.h.
References current_mode_, yaze::editor::DraggingEntity, and yaze::editor::DraggingObjects.
|
inline |
Check if rectangle selection is in progress.
Definition at line 196 of file interaction_mode.h.
References current_mode_, and yaze::editor::RectangleSelect.
|
inline |
Check if object placement mode is active.
Definition at line 203 of file interaction_mode.h.
References current_mode_, and yaze::editor::PlaceObject.
Referenced by yaze::editor::DungeonObjectInteraction::PlaceObjectAtPosition().
|
inline |
Check if door placement mode is active.
Definition at line 210 of file interaction_mode.h.
References current_mode_, and yaze::editor::PlaceDoor.
|
inline |
Check if sprite placement mode is active.
Definition at line 217 of file interaction_mode.h.
References current_mode_, and yaze::editor::PlaceSprite.
|
inline |
Check if item placement mode is active.
Definition at line 224 of file interaction_mode.h.
References current_mode_, and yaze::editor::PlaceItem.
|
inline |
Check if entity (non-object) placement is active.
Definition at line 231 of file interaction_mode.h.
References current_mode_, yaze::editor::PlaceDoor, yaze::editor::PlaceItem, and yaze::editor::PlaceSprite.
|
inline |
Get mutable reference to mode state.
Definition at line 240 of file interaction_mode.h.
References mode_state_.
Referenced by yaze::editor::DungeonObjectInteraction::DrawDoorGhostPreview(), yaze::editor::DungeonObjectInteraction::DrawDoorSnapIndicators(), yaze::editor::DungeonObjectInteraction::DrawDragPreview(), yaze::editor::DungeonObjectInteraction::DrawEntitySelectionHighlights(), yaze::editor::DungeonObjectInteraction::GetPreviewDoorType(), yaze::editor::DungeonObjectInteraction::GetPreviewItemId(), yaze::editor::DungeonObjectInteraction::GetPreviewSpriteId(), yaze::editor::DungeonObjectInteraction::HandleCanvasMouseInput(), yaze::editor::DungeonObjectInteraction::HandleEntityDrag(), yaze::editor::DungeonObjectInteraction::SetDoorPlacementMode(), yaze::editor::DungeonObjectInteraction::SetItemPlacementMode(), yaze::editor::DungeonObjectInteraction::SetPreviewDoorType(), yaze::editor::DungeonObjectInteraction::SetPreviewItemId(), yaze::editor::DungeonObjectInteraction::SetPreviewObject(), yaze::editor::DungeonObjectInteraction::SetPreviewSpriteId(), yaze::editor::DungeonObjectInteraction::SetSpritePlacementMode(), and yaze::editor::DungeonObjectInteraction::TrySelectEntityAtCursor().
|
inline |
Get const reference to mode state.
Definition at line 245 of file interaction_mode.h.
References mode_state_.
| const char * yaze::editor::InteractionModeManager::GetModeName | ( | ) | const |
Get mode name for debugging/UI.
Definition at line 50 of file interaction_mode.cc.
References current_mode_, yaze::editor::DraggingEntity, yaze::editor::DraggingObjects, yaze::editor::PlaceDoor, yaze::editor::PlaceItem, yaze::editor::PlaceObject, yaze::editor::PlaceSprite, yaze::editor::RectangleSelect, and yaze::editor::Select.
|
private |
Definition at line 253 of file interaction_mode.h.
Referenced by CancelCurrentMode(), GetMode(), GetModeName(), IsDoorPlacementActive(), IsDragging(), IsEntityPlacementActive(), IsItemPlacementActive(), IsObjectPlacementActive(), IsPlacementActive(), IsRectangleSelecting(), IsSelectMode(), IsSpritePlacementActive(), and SetMode().
|
private |
Definition at line 254 of file interaction_mode.h.
Referenced by CancelCurrentMode(), GetPreviousMode(), and SetMode().
|
private |
Definition at line 255 of file interaction_mode.h.
Referenced by CancelCurrentMode(), GetModeState(), GetModeState(), and SetMode().