yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
custom_collision_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_PANELS_CUSTOM_COLLISION_PANEL_H
2#define YAZE_APP_EDITOR_DUNGEON_PANELS_CUSTOM_COLLISION_PANEL_H
3
4#include <string>
5#include <string_view>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "absl/status/statusor.h"
14#include "app/gui/core/icons.h"
16
17namespace yaze::editor {
18
20 public:
22 DungeonObjectInteraction* interaction)
23 : viewer_(viewer), interaction_(interaction) {}
24
25 std::string GetId() const override { return "dungeon.custom_collision"; }
26 std::string GetWorkflowGroup() const override { return "Editors"; }
27 std::string GetDisplayName() const override { return "Custom Collision"; }
28 std::string GetIcon() const override { return ICON_MD_GRID_ON; }
29 std::string GetEditorCategory() const override { return "Dungeon"; }
30
31 void SetCanvasViewer(DungeonCanvasViewer* viewer) { viewer_ = viewer; }
33 interaction_ = interaction;
34 }
35
36 void Draw(bool* p_open) override;
37
38 static absl::StatusOr<std::vector<zelda3::CustomCollisionRoomEntry>>
40 static void ApplyRoomEntry(const zelda3::CustomCollisionRoomEntry& entry,
41 zelda3::Room* room);
42
43 absl::Status ImportCollisionRooms(
44 const std::vector<zelda3::CustomCollisionRoomEntry>& entries,
45 std::string_view source_label = "import");
46 absl::Status ImportCollisionJson(std::string_view json_content,
47 std::string_view source_label = "import");
48 absl::Status ExportCollisionToFile(const DungeonRoomStore& rooms,
49 const std::string& path);
50
51 const std::string& last_io_status() const { return last_io_status_; }
52 const std::string& last_io_error() const { return last_io_error_; }
53
54 private:
57
58 std::string last_io_status_;
59 std::string last_io_error_;
60};
61
62} // namespace yaze::editor
63
64#endif // YAZE_APP_EDITOR_DUNGEON_PANELS_CUSTOM_COLLISION_PANEL_H
std::string GetWorkflowGroup() const override
Optional workflow group for hack-centric actions.
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
void SetCanvasViewer(DungeonCanvasViewer *viewer)
std::string GetIcon() const override
Material Design icon for this panel.
const std::string & last_io_status() const
static absl::StatusOr< std::vector< zelda3::CustomCollisionRoomEntry > > CollectRoomEntries(const DungeonRoomStore &rooms)
DungeonObjectInteraction * interaction_
std::string GetEditorCategory() const override
Editor category this panel belongs to.
absl::Status ImportCollisionRooms(const std::vector< zelda3::CustomCollisionRoomEntry > &entries, std::string_view source_label="import")
absl::Status ExportCollisionToFile(const DungeonRoomStore &rooms, const std::string &path)
void SetInteraction(DungeonObjectInteraction *interaction)
const std::string & last_io_error() const
CustomCollisionPanel(DungeonCanvasViewer *viewer, DungeonObjectInteraction *interaction)
absl::Status ImportCollisionJson(std::string_view json_content, std::string_view source_label="import")
static void ApplyRoomEntry(const zelda3::CustomCollisionRoomEntry &entry, zelda3::Room *room)
void Draw(bool *p_open) override
Draw the panel content.
std::string GetId() const override
Unique identifier for this panel.
Handles object selection, placement, and interaction within the dungeon canvas.
Base interface for all logical window content components.
#define ICON_MD_GRID_ON
Definition icons.h:896
Editors are the view controllers for the application.