1#ifndef YAZE_APP_EDITOR_DUNGEON_OBJECT_SELECTION_H
2#define YAZE_APP_EDITOR_DUNGEON_OBJECT_SELECTION_H
10#include "imgui/imgui.h"
74 const std::vector<zelda3::RoomObject>& objects,
89 void SelectAll(
const std::vector<zelda3::RoomObject>& objects);
149 const std::vector<zelda3::RoomObject>& objects,
181 gui::Canvas* canvas,
const std::vector<zelda3::RoomObject>& objects,
183 dimension_calculator);
249 case kMaskLayer:
return "Mask Mode (BG2 Overlays)";
250 case kLayer1:
return "Layer 1 (BG1)";
251 case kLayer2:
return "Layer 2 (BG2)";
252 case kLayer3:
return "Layer 3 (BG3)";
253 default:
return "All Layers";
326 int min_y,
int max_x,
int max_y)
const;
Manages object selection state and operations for the dungeon editor.
void SetSelectionChangedCallback(std::function< void()> callback)
Set callback to be invoked when selection changes.
bool IsObjectInRectangle(const zelda3::RoomObject &object, int min_x, int min_y, int max_x, int max_y) const
std::tuple< int, int, int, int > GetRectangleSelectionBounds() const
Get rectangle selection bounds in canvas coordinates.
bool IsMaskModeActive() const
Check if mask selection mode is active.
bool IsRectangleSelectionActive() const
Check if a rectangle selection is in progress.
void UpdateRectangleSelection(int canvas_x, int canvas_y)
Update rectangle selection endpoint.
bool rectangle_selection_active_
static std::pair< int, int > RoomToCanvasCoordinates(int room_x, int room_y)
Convert room tile coordinates to canvas pixel coordinates.
int GetLayerFilter() const
Get the current active layer filter.
std::function< void()> selection_changed_callback_
static constexpr int kMaskLayer
bool IsObjectSelected(size_t index) const
Check if an object is selected.
std::set< size_t > selected_indices_
static constexpr int kLayer3
std::vector< size_t > GetSelectedIndices() const
Get all selected object indices.
static std::tuple< int, int, int, int > GetObjectBounds(const zelda3::RoomObject &object)
Calculate the bounding box of an object.
bool AreLayersMerged() const
Check if layers are currently merged.
void SelectAll(size_t object_count)
Select all objects in the current room.
static std::pair< int, int > CanvasToRoomCoordinates(int canvas_x, int canvas_y)
Convert canvas pixel coordinates to room tile coordinates.
size_t GetSelectionCount() const
Get the number of selected objects.
void SelectObject(size_t index, SelectionMode mode=SelectionMode::Single)
Select a single object by index.
void ClearSelection()
Clear all selections.
void EndRectangleSelection(const std::vector< zelda3::RoomObject > &objects, SelectionMode mode=SelectionMode::Single)
Complete rectangle selection operation.
void NotifySelectionChanged()
void BeginRectangleSelection(int canvas_x, int canvas_y)
Begin a rectangle selection operation.
bool PassesLayerFilter(const zelda3::RoomObject &object) const
static constexpr int kLayer1
void DrawSelectionHighlights(gui::Canvas *canvas, const std::vector< zelda3::RoomObject > &objects, std::function< std::pair< int, int >(const zelda3::RoomObject &)> dimension_calculator)
Draw selection highlights for all selected objects.
static constexpr int kLayer2
const char * GetLayerFilterName() const
Get the name of the current layer filter for display.
ImVec4 GetLayerTypeColor(const zelda3::RoomObject &object) const
Get selection highlight color based on object layer and type.
void SetLayersMerged(bool merged)
Set whether layers are currently merged in the room.
static constexpr int kLayerAll
void SetLayerFilter(int layer)
Set the active layer filter for selection.
bool IsLayerFilterActive() const
Check if layer filtering is active.
void CancelRectangleSelection()
Cancel rectangle selection without modifying selection.
std::optional< size_t > GetPrimarySelection() const
Get the primary selected object (first in selection)
void DrawRectangleSelectionBox(gui::Canvas *canvas)
Draw the active rectangle selection box.
ObjectSelection()=default
bool IsLayerEnabled(int layer) const
Check if a specific layer is enabled for selection.
void SelectObjectsInRect(int room_min_x, int room_min_y, int room_max_x, int room_max_y, const std::vector< zelda3::RoomObject > &objects, SelectionMode mode=SelectionMode::Single)
Select multiple objects within a rectangle.
bool HasSelection() const
Check if any objects are selected.
Modern, robust canvas for drawing and manipulating graphics.