yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::OverworldEntityInteraction Class Reference

Handles entity interaction logic for the Overworld Editor. More...

#include <overworld_entity_interaction.h>

Public Member Functions

 OverworldEntityInteraction (Rom *rom)
 
void SetRom (Rom *rom)
 
void SetEntityRenderer (OverworldEntityRenderer *renderer)
 
void HandleContextMenus (zelda3::GameEntity *hovered_entity)
 Handle entity context menus on right-click.
 
int HandleDoubleClick (zelda3::GameEntity *hovered_entity)
 Handle double-click actions on entities.
 
bool HandleDragDrop (zelda3::GameEntity *hovered_entity, ImVec2 mouse_delta)
 Handle entity drag-and-drop operations.
 
void FinishDrag ()
 Finish an active drag operation.
 
zelda3::GameEntitycurrent_entity () const
 
zelda3::OverworldExitcurrent_exit ()
 
zelda3::OverworldEntrancecurrent_entrance ()
 
zelda3::OverworldItemcurrent_item ()
 
zelda3::Spritecurrent_sprite ()
 
bool is_dragging () const
 
zelda3::GameEntitydragged_entity () const
 

Private Attributes

Romrom_ = nullptr
 
OverworldEntityRendererentity_renderer_ = nullptr
 
zelda3::GameEntitycurrent_entity_ = nullptr
 
zelda3::OverworldExit current_exit_
 
zelda3::OverworldEntrance current_entrance_
 
zelda3::OverworldItem current_item_
 
zelda3::Sprite current_sprite_
 
bool is_dragging_ = false
 
bool free_movement_ = false
 
zelda3::GameEntitydragged_entity_ = nullptr
 

Detailed Description

Handles entity interaction logic for the Overworld Editor.

This class centralizes all entity interaction logic including:

  • Right-click context menus for entity editing
  • Double-click actions for navigation
  • Entity popup drawing and updates
  • Drag-and-drop entity manipulation

Extracted from OverworldEditor to reduce cognitive complexity and improve separation of concerns.

Definition at line 30 of file overworld_entity_interaction.h.

Constructor & Destructor Documentation

◆ OverworldEntityInteraction()

yaze::editor::OverworldEntityInteraction::OverworldEntityInteraction ( Rom * rom)
inlineexplicit

Definition at line 32 of file overworld_entity_interaction.h.

Member Function Documentation

◆ SetRom()

void yaze::editor::OverworldEntityInteraction::SetRom ( Rom * rom)
inline

Definition at line 34 of file overworld_entity_interaction.h.

References rom_.

◆ SetEntityRenderer()

void yaze::editor::OverworldEntityInteraction::SetEntityRenderer ( OverworldEntityRenderer * renderer)
inline

Definition at line 35 of file overworld_entity_interaction.h.

References entity_renderer_.

◆ HandleContextMenus()

void yaze::editor::OverworldEntityInteraction::HandleContextMenus ( zelda3::GameEntity * hovered_entity)

◆ HandleDoubleClick()

int yaze::editor::OverworldEntityInteraction::HandleDoubleClick ( zelda3::GameEntity * hovered_entity)

Handle double-click actions on entities.

Parameters
hovered_entityThe entity currently under the cursor
Returns
Jump tab target ID, or -1 if no navigation

Definition at line 52 of file overworld_entity_interaction.cc.

References yaze::zelda3::GameEntity::entity_type_, yaze::zelda3::GameEntity::kEntrance, and yaze::zelda3::GameEntity::kExit.

◆ HandleDragDrop()

bool yaze::editor::OverworldEntityInteraction::HandleDragDrop ( zelda3::GameEntity * hovered_entity,
ImVec2 mouse_delta )

Handle entity drag-and-drop operations.

Parameters
hovered_entityThe entity currently under the cursor
mouse_deltaThe mouse movement delta for dragging
Returns
True if an entity was being dragged this frame

Definition at line 68 of file overworld_entity_interaction.cc.

References dragged_entity_, yaze::zelda3::GameEntity::entity_type_, FinishDrag(), free_movement_, is_dragging_, yaze::zelda3::GameEntity::kExit, rom_, yaze::Rom::set_dirty(), yaze::zelda3::GameEntity::x_, and yaze::zelda3::GameEntity::y_.

Here is the call graph for this function:

◆ FinishDrag()

void yaze::editor::OverworldEntityInteraction::FinishDrag ( )

Finish an active drag operation.

Definition at line 101 of file overworld_entity_interaction.cc.

References dragged_entity_, free_movement_, and is_dragging_.

Referenced by HandleDragDrop().

◆ current_entity()

zelda3::GameEntity * yaze::editor::OverworldEntityInteraction::current_entity ( ) const
inline

Definition at line 66 of file overworld_entity_interaction.h.

References current_entity_.

◆ current_exit()

zelda3::OverworldExit & yaze::editor::OverworldEntityInteraction::current_exit ( )
inline

Definition at line 67 of file overworld_entity_interaction.h.

References current_exit_.

◆ current_entrance()

zelda3::OverworldEntrance & yaze::editor::OverworldEntityInteraction::current_entrance ( )
inline

Definition at line 68 of file overworld_entity_interaction.h.

References current_entrance_.

◆ current_item()

zelda3::OverworldItem & yaze::editor::OverworldEntityInteraction::current_item ( )
inline

Definition at line 69 of file overworld_entity_interaction.h.

References current_item_.

◆ current_sprite()

zelda3::Sprite & yaze::editor::OverworldEntityInteraction::current_sprite ( )
inline

Definition at line 70 of file overworld_entity_interaction.h.

References current_sprite_.

◆ is_dragging()

bool yaze::editor::OverworldEntityInteraction::is_dragging ( ) const
inline

Definition at line 73 of file overworld_entity_interaction.h.

References is_dragging_.

◆ dragged_entity()

zelda3::GameEntity * yaze::editor::OverworldEntityInteraction::dragged_entity ( ) const
inline

Definition at line 74 of file overworld_entity_interaction.h.

References dragged_entity_.

Member Data Documentation

◆ rom_

Rom* yaze::editor::OverworldEntityInteraction::rom_ = nullptr
private

Definition at line 77 of file overworld_entity_interaction.h.

Referenced by HandleDragDrop(), and SetRom().

◆ entity_renderer_

OverworldEntityRenderer* yaze::editor::OverworldEntityInteraction::entity_renderer_ = nullptr
private

Definition at line 78 of file overworld_entity_interaction.h.

Referenced by SetEntityRenderer().

◆ current_entity_

zelda3::GameEntity* yaze::editor::OverworldEntityInteraction::current_entity_ = nullptr
private

Definition at line 81 of file overworld_entity_interaction.h.

Referenced by current_entity(), and HandleContextMenus().

◆ current_exit_

zelda3::OverworldExit yaze::editor::OverworldEntityInteraction::current_exit_
private

Definition at line 82 of file overworld_entity_interaction.h.

Referenced by current_exit(), and HandleContextMenus().

◆ current_entrance_

zelda3::OverworldEntrance yaze::editor::OverworldEntityInteraction::current_entrance_
private

Definition at line 83 of file overworld_entity_interaction.h.

Referenced by current_entrance(), and HandleContextMenus().

◆ current_item_

zelda3::OverworldItem yaze::editor::OverworldEntityInteraction::current_item_
private

Definition at line 84 of file overworld_entity_interaction.h.

Referenced by current_item(), and HandleContextMenus().

◆ current_sprite_

zelda3::Sprite yaze::editor::OverworldEntityInteraction::current_sprite_
private

Definition at line 85 of file overworld_entity_interaction.h.

Referenced by current_sprite(), and HandleContextMenus().

◆ is_dragging_

bool yaze::editor::OverworldEntityInteraction::is_dragging_ = false
private

Definition at line 88 of file overworld_entity_interaction.h.

Referenced by FinishDrag(), HandleDragDrop(), and is_dragging().

◆ free_movement_

bool yaze::editor::OverworldEntityInteraction::free_movement_ = false
private

Definition at line 89 of file overworld_entity_interaction.h.

Referenced by FinishDrag(), and HandleDragDrop().

◆ dragged_entity_

zelda3::GameEntity* yaze::editor::OverworldEntityInteraction::dragged_entity_ = nullptr
private

Definition at line 90 of file overworld_entity_interaction.h.

Referenced by dragged_entity(), FinishDrag(), and HandleDragDrop().


The documentation for this class was generated from the following files: