yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
door_editor_content.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_INSPECTORS_DOOR_EDITOR_CONTENT_H_
2#define YAZE_APP_EDITOR_DUNGEON_INSPECTORS_DOOR_EDITOR_CONTENT_H_
3
4#include <functional>
5#include <string>
6
10#include "app/gui/core/icons.h"
12
13namespace yaze::editor {
14
16 public:
17 std::string GetId() const override { return "dungeon.door_editor"; }
18 std::string GetDisplayName() const override { return "Door Editor"; }
19 std::string GetIcon() const override { return ICON_MD_DOOR_FRONT; }
20 std::string GetEditorCategory() const override { return "Dungeon"; }
21 int GetPriority() const override { return 68; }
22 std::string GetWorkflowGroup() const override { return "Editors"; }
23 float GetPreferredWidth() const override { return 420.0f; }
24
25 void Draw(bool* p_open) override;
26 void DrawInWorkbench();
27 void OnClose() override;
28
29 void SetCurrentRoom(int room_id) { current_room_id_ = room_id; }
30 void SetCanvasViewerProvider(std::function<DungeonCanvasViewer*()> provider) {
31 canvas_viewer_provider_ = std::move(provider);
32 }
34 void SetRooms(DungeonRoomStore* rooms) { rooms_ = rooms; }
35 void SetOpenSelectionInspectorCallback(std::function<void()> callback) {
36 open_selection_inspector_callback_ = std::move(callback);
37 }
38
39 // Callback fired by the "Jump to Reciprocal" button. Takes the neighbor
40 // room id and the index of the paired door in that room.
42 std::function<void(int neighbor_room_id, size_t reciprocal_door_index)>
43 callback) {
44 on_jump_to_reciprocal_door_ = std::move(callback);
45 }
46
47 private:
48 void DrawContent(bool show_room_doors);
49 bool HasMatchingViewer() const;
50 bool CanEditRoom() const;
52 void CancelPlacement();
53
60 std::function<void(int, size_t)> on_jump_to_reciprocal_door_;
62};
63
64} // namespace yaze::editor
65
66#endif // YAZE_APP_EDITOR_DUNGEON_INSPECTORS_DOOR_EDITOR_CONTENT_H_
void SetOpenSelectionInspectorCallback(std::function< void()> callback)
void SetJumpToReciprocalDoorCallback(std::function< void(int neighbor_room_id, size_t reciprocal_door_index)> callback)
std::string GetId() const override
Unique identifier for this panel.
int GetPriority() const override
Get display priority for menu ordering.
DungeonCanvasViewer * ResolveCanvasViewer()
float GetPreferredWidth() const override
Get preferred width for this panel (optional)
std::string GetEditorCategory() const override
Editor category this panel belongs to.
std::function< DungeonCanvasViewer *()> canvas_viewer_provider_
void OnClose() override
Called when panel is hidden.
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
void SetCanvasViewerProvider(std::function< DungeonCanvasViewer *()> provider)
void Draw(bool *p_open) override
Draw the panel content.
void SetRooms(DungeonRoomStore *rooms)
std::function< void()> open_selection_inspector_callback_
std::function< void(int, size_t)> on_jump_to_reciprocal_door_
void SetCanvasViewer(DungeonCanvasViewer *viewer)
std::string GetWorkflowGroup() const override
Optional workflow group for hack-centric actions.
std::string GetIcon() const override
Material Design icon for this panel.
void DrawContent(bool show_room_doors)
Base interface for all logical window content components.
#define ICON_MD_DOOR_FRONT
Definition icons.h:613
Editors are the view controllers for the application.
DoorType
Door types from ALTTP.
Definition door_types.h:33
@ NormalDoor
Normal door (upper layer)