yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
interaction_context.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_INTERACTION_INTERACTION_CONTEXT_H_
2#define YAZE_APP_EDITOR_DUNGEON_INTERACTION_INTERACTION_CONTEXT_H_
3
4#include <array>
5#include <functional>
6
10#include "rom/rom.h"
11#include "zelda3/dungeon/room.h"
12
13namespace yaze {
14namespace editor {
15
33 // Core dependencies (required)
34 gui::Canvas* canvas = nullptr;
35 Rom* rom = nullptr;
36 std::array<zelda3::Room, dungeon_coords::kRoomCount>* rooms = nullptr;
38
39 // Palette for rendering previews
41
42 // Unified callbacks
43 // Called before any state modification (for undo snapshots)
44 std::function<void()> on_mutation;
45
46 // Called after rendering changes require cache refresh
47 std::function<void()> on_invalidate_cache;
48
49 // Called when selection state changes
50 std::function<void()> on_selection_changed;
51
52 // Called when entity (door/sprite/item) changes
53 std::function<void()> on_entity_changed;
54
58 bool IsValid() const { return canvas != nullptr && rooms != nullptr; }
59
66 return nullptr;
67 }
68 return &(*rooms)[current_room_id];
69 }
70
77 return nullptr;
78 }
79 return &(*rooms)[current_room_id];
80 }
81
88 void NotifyMutation() const {
90 }
91
100
107
114};
115
116} // namespace editor
117} // namespace yaze
118
119#endif // YAZE_APP_EDITOR_DUNGEON_INTERACTION_INTERACTION_CONTEXT_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:150
bool IsValidRoomId(int room_id)
Validate room ID is within valid range.
Shared context for all interaction handlers.
std::function< void()> on_invalidate_cache
const zelda3::Room * GetCurrentRoomConst() const
Get const pointer to current room.
void NotifyEntityChanged() const
Notify that entity has changed.
std::array< zelda3::Room, dungeon_coords::kRoomCount > * rooms
bool IsValid() const
Check if context has required dependencies.
void NotifySelectionChanged() const
Notify that selection has changed.
void NotifyInvalidateCache() const
Notify that cache invalidation is needed.
zelda3::Room * GetCurrentRoom() const
Get pointer to current room.
void NotifyMutation() const
Notify that a mutation is about to happen.
std::function< void()> on_entity_changed
std::function< void()> on_selection_changed
Represents a group of palettes.