1#ifndef YAZE_APP_EDITOR_DUNGEON_INTERACTION_TILE_OBJECT_HANDLER_H
2#define YAZE_APP_EDITOR_DUNGEON_INTERACTION_TILE_OBJECT_HANDLER_H
51 bool HandleClick(
int canvas_x,
int canvas_y)
override;
52 void HandleDrag(ImVec2 current_pos, ImVec2 delta)
override;
59 void InitDrag(
const ImVec2& start_pos);
70 bool mouse_left_released,
bool shift_down,
71 bool toggle_down,
bool alt_down,
72 bool draw_box =
true);
75 int canvas_y)
const override;
80 void MoveObjects(
int room_id,
const std::vector<size_t>& indices,
int delta_x,
81 int delta_y,
bool notify_mutation =
true);
88 const std::vector<size_t>& indices,
89 int delta_x,
int delta_y,
90 bool notify_mutation =
true);
105 void SendToFront(
int room_id,
const std::vector<size_t>& indices);
106 void SendToBack(
int room_id,
const std::vector<size_t>& indices);
107 void MoveForward(
int room_id,
const std::vector<size_t>& indices);
108 void MoveBackward(
int room_id,
const std::vector<size_t>& indices);
113 void ResizeObjects(
int room_id,
const std::vector<size_t>& indices,
216 void DrawSmartGuides(
const std::vector<zelda3::RoomObject>& objects)
const;
Abstract base class for entity interaction handlers.
void SetContext(InteractionContext *ctx)
Set the interaction context.
Handles functional mutations and queries for tile objects.
zelda3::RoomObject preview_object_
void DrawGhostPreview() override
Draw ghost preview during placement.
void DrawSmartGuides(const std::vector< zelda3::RoomObject > &objects) const
std::vector< zelda3::RoomObject > clipboard_
bool was_placement_blocked() const
True if the most recent PlaceObjectAt was blocked.
bool ghost_preview_bitmap_ready_
void HandleMarqueeSelection(const ImVec2 &mouse_pos, bool mouse_left_down, bool mouse_left_released, bool shift_down, bool toggle_down, bool alt_down, bool draw_box=true)
void BeginPlacement() override
Begin placement mode.
bool HandleMouseWheel(float delta) override
std::unique_ptr< gfx::BackgroundBuffer > ghost_preview_buffer_
void ClearClipboard()
Clear the clipboard.
bool HasClipboardData() const
Check if clipboard has data.
void UpdateObjectsSize(int room_id, const std::vector< size_t > &indices, uint8_t new_size)
void SendToFront(int room_id, const std::vector< size_t > &indices)
Reorder objects.
void RenderGhostPreviewBitmap()
const gfx::BackgroundBuffer * ghost_preview_buffer_for_testing() const
std::vector< size_t > DuplicateObjects(int room_id, const std::vector< size_t > &indices, int delta_x, int delta_y, bool notify_mutation=true)
Clone a set of objects and move them by a tile delta.
void clear_placement_blocked()
void DeleteAllObjects(int room_id)
Delete all objects in a room.
void MoveBackward(int room_id, const std::vector< size_t > &indices)
ImVec2 ApplyDragModifiers(const ImVec2 &delta) const
void HandleRelease() override
Handle mouse release.
void CopyObjectsToClipboard(int room_id, const std::vector< size_t > &indices)
Copy objects to internal clipboard.
bool drag_has_duplicated_
void HandleDrag(ImVec2 current_pos, ImVec2 delta) override
Handle mouse drag.
std::vector< size_t > PasteFromClipboardAt(int room_id, int target_x, int target_y)
Paste objects from clipboard at target location. Use first clipboard item as origin.
void DrawSelectionHighlight() override
Draw selection highlight for selected entities.
bool IsPlacementActive() const override
Check if placement mode is active.
bool UpdateObjectsLayer(int room_id, const std::vector< size_t > &indices, int new_layer)
bool PlaceObjectAt(int room_id, const zelda3::RoomObject &object, int x, int y)
Place a new object. Returns false if blocked by ROM limits.
void SendToBack(int room_id, const std::vector< size_t > &indices)
std::vector< size_t > PasteFromClipboard(int room_id, int offset_x, int offset_y)
Paste objects from clipboard with offset.
bool HandleClick(int canvas_x, int canvas_y) override
Handle mouse click at canvas position.
bool object_placement_mode_
void SetPreviewObject(const zelda3::RoomObject &object)
Set object for placement.
PlacementBlockReason placement_block_reason() const
void BeginMarqueeSelection(const ImVec2 &start_pos)
void MoveForward(int room_id, const std::vector< size_t > &indices)
void MoveObjects(int room_id, const std::vector< size_t > &indices, int delta_x, int delta_y, bool notify_mutation=true)
Move a set of objects by a tile delta.
void CancelPlacement() override
Cancel current placement.
bool ghost_preview_create_queued_
PlacementBlockReason placement_block_reason_
void DeleteObjects(int room_id, std::vector< size_t > indices)
Delete objects by indices.
bool drag_mutation_started_
TileObjectHandler(InteractionContext *ctx)
static GhostPreviewGeometry CalculateGhostPreviewGeometry(const zelda3::RoomObject &object)
Resolve the render anchor and visual extent used by placement previews.
void UpdateObjectsId(int room_id, const std::vector< size_t > &indices, int16_t new_id)
zelda3::Room * GetRoom(int room_id)
PlacementCapacityState GhostCapacityState
void NotifyChange(zelda3::Room *room)
GhostCapacityState GetPlacementGhostCapacityState() const
void ResizeObjects(int room_id, const std::vector< size_t > &indices, int delta)
Resize objects by a delta.
std::optional< size_t > GetEntityAtPosition(int canvas_x, int canvas_y) const override
Get entity at canvas position.
void InitDrag(const ImVec2 &start_pos)
Editors are the view controllers for the application.
Shared context for all interaction handlers.
int render_anchor_x_tiles
int render_anchor_y_tiles