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 174 of file interaction_mode.h.
|
inline |
Get current interaction mode.
Definition at line 179 of file interaction_mode.h.
References current_mode_.
Referenced by yaze::editor::DungeonObjectInteraction::CancelDoorPlacement(), yaze::editor::DungeonObjectInteraction::CancelItemPlacement(), yaze::editor::DungeonObjectInteraction::CancelSpritePlacement(), yaze::editor::CustomCollisionPanel::Draw(), yaze::editor::WaterFillPanel::Draw(), yaze::editor::DungeonObjectInteraction::HandleCanvasMouseInput(), yaze::editor::DungeonObjectInteraction::IsDoorPlacementActive(), yaze::editor::DungeonObjectInteraction::IsItemPlacementActive(), yaze::editor::DungeonObjectInteraction::IsObjectLoaded(), and yaze::editor::DungeonObjectInteraction::IsSpritePlacementActive().
|
inline |
Get previous mode (for undo/escape handling)
Definition at line 184 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, yaze::editor::ModeState::is_painting, mode_state_, yaze::editor::ModeState::paint_last_tile_x, yaze::editor::ModeState::paint_last_tile_y, yaze::editor::ModeState::paint_mutation_started, yaze::editor::PaintCollision, yaze::editor::PaintWaterFill, 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::CustomCollisionPanel::Draw(), and yaze::editor::WaterFillPanel::Draw().

| 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 52 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(), and yaze::editor::DungeonObjectInteraction::CancelSpritePlacement().

|
inline |
Check if any placement mode is active.
Definition at line 204 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::DungeonWorkbenchPanel::DrawInspectorShelfRoom().
|
inline |
Check if in normal selection mode.
Definition at line 214 of file interaction_mode.h.
References current_mode_, and yaze::editor::Select.
|
inline |
Check if any dragging operation is in progress.
Definition at line 219 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 227 of file interaction_mode.h.
References current_mode_, and yaze::editor::RectangleSelect.
|
inline |
Check if object placement mode is active.
Definition at line 234 of file interaction_mode.h.
References current_mode_, and yaze::editor::PlaceObject.
|
inline |
Check if door placement mode is active.
Definition at line 241 of file interaction_mode.h.
References current_mode_, and yaze::editor::PlaceDoor.
|
inline |
Check if sprite placement mode is active.
Definition at line 248 of file interaction_mode.h.
References current_mode_, and yaze::editor::PlaceSprite.
|
inline |
Check if item placement mode is active.
Definition at line 255 of file interaction_mode.h.
References current_mode_, and yaze::editor::PlaceItem.
|
inline |
Check if entity (non-object) placement is active.
Definition at line 262 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 271 of file interaction_mode.h.
References mode_state_.
Referenced by yaze::editor::CustomCollisionPanel::Draw(), yaze::editor::WaterFillPanel::Draw(), yaze::editor::DungeonObjectInteraction::GetPreviewDoorType(), yaze::editor::DungeonObjectInteraction::GetPreviewItemId(), yaze::editor::DungeonObjectInteraction::GetPreviewSpriteId(), yaze::editor::DungeonObjectInteraction::SetPreviewDoorType(), yaze::editor::DungeonObjectInteraction::SetPreviewItemId(), yaze::editor::DungeonObjectInteraction::SetPreviewSpriteId(), and yaze::editor::DungeonObjectInteraction::UpdateCollisionPainting().
|
inline |
Get const reference to mode state.
Definition at line 276 of file interaction_mode.h.
References mode_state_.
| const char * yaze::editor::InteractionModeManager::GetModeName | ( | ) | const |
Get mode name for debugging/UI.
Definition at line 59 of file interaction_mode.cc.
References current_mode_, yaze::editor::DraggingEntity, yaze::editor::DraggingObjects, yaze::editor::PaintCollision, yaze::editor::PaintWaterFill, yaze::editor::PlaceDoor, yaze::editor::PlaceItem, yaze::editor::PlaceObject, yaze::editor::PlaceSprite, yaze::editor::RectangleSelect, and yaze::editor::Select.
|
private |
Definition at line 284 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 285 of file interaction_mode.h.
Referenced by CancelCurrentMode(), GetPreviousMode(), and SetMode().
|
private |
Definition at line 286 of file interaction_mode.h.
Referenced by CancelCurrentMode(), GetModeState(), GetModeState(), and SetMode().