yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
minecart_track_editor_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_PANELS_MINECART_TRACK_EDITOR_PANEL_H
2#define YAZE_APP_EDITOR_DUNGEON_PANELS_MINECART_TRACK_EDITOR_PANEL_H
3
4#include <cstdint>
5#include <functional>
6#include <string>
7#include <vector>
8
9namespace yaze::editor {
10
12 int id;
16};
17
18} // namespace yaze::editor
19
21
22namespace yaze::editor {
23
25 public:
26 explicit MinecartTrackEditorPanel(const std::string& start_root = "") : project_root_(start_root) {}
27
28 // EditorPanel overrides
29 std::string GetId() const override { return "dungeon.minecart_tracks"; }
30 std::string GetDisplayName() const override { return "Minecart Tracks"; }
31 std::string GetIcon() const override { return "M"; } // Using simple string for now, should include icons header
32 std::string GetEditorCategory() const override { return "Dungeon"; }
33
34 void Draw(bool* p_open) override;
35
36 // Custom methods
37 void SetProjectRoot(const std::string& root);
38 void SaveTracks();
39
40 // Coordinate picking from dungeon canvas
41 // When picking mode is active, the next canvas click will set the coordinates
42 // for the selected track slot
43 void SetPickedCoordinates(int room_id, uint16_t camera_x, uint16_t camera_y);
44 bool IsPickingCoordinates() const { return picking_mode_; }
46
47 // Callback to navigate to a specific room for coordinate picking
48 using RoomNavigationCallback = std::function<void(int room_id)>;
50 room_navigation_callback_ = std::move(callback);
51 }
52
53 private:
54 void LoadTracks();
55 bool ParseSection(const std::string& content, const std::string& label, std::vector<int>& out_values);
56 std::string FormatSection(const std::string& label, const std::vector<int>& values);
57 void StartCoordinatePicking(int track_index);
59
60 std::vector<MinecartTrack> tracks_;
61 std::string project_root_;
62 bool loaded_ = false;
63 std::string status_message_;
64 bool show_success_ = false;
65 float success_timer_ = 0.0f;
66
67 // Coordinate picking state
68 bool picking_mode_ = false;
70
71 // Last picked coordinates (for display)
72 uint16_t last_picked_x_ = 0;
73 uint16_t last_picked_y_ = 0;
74 bool has_picked_coords_ = false;
75
77};
78
79} // namespace yaze::editor
80
81#endif
Base interface for all logical panel components.
std::string FormatSection(const std::string &label, const std::vector< int > &values)
std::string GetId() const override
Unique identifier for this panel.
std::string GetIcon() const override
Material Design icon for this panel.
std::string GetEditorCategory() const override
Editor category this panel belongs to.
void Draw(bool *p_open) override
Draw the panel content.
std::function< void(int room_id)> RoomNavigationCallback
void SetRoomNavigationCallback(RoomNavigationCallback callback)
MinecartTrackEditorPanel(const std::string &start_root="")
bool ParseSection(const std::string &content, const std::string &label, std::vector< int > &out_values)
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
void SetPickedCoordinates(int room_id, uint16_t camera_x, uint16_t camera_y)
Editors are the view controllers for the application.
Definition agent_chat.cc:23