yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
map_properties.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_OVERWORLD_MAP_PROPERTIES_H
2#define YAZE_APP_EDITOR_OVERWORLD_MAP_PROPERTIES_H
3
4#include <functional>
5
7#include "rom/rom.h"
10
11// Forward declaration
12namespace yaze {
13namespace editor {
14class OverworldEditor;
15}
16} // namespace yaze
17
18namespace yaze {
19namespace editor {
20
22 public:
23 // Callback types for refresh operations
24 using RefreshCallback = std::function<void()>;
25 using RefreshPaletteCallback = std::function<absl::Status()>;
26 using ForceRefreshGraphicsCallback = std::function<void(int)>;
27
29 zelda3::Overworld* overworld, Rom* rom,
30 std::array<gfx::Bitmap, zelda3::kNumOverworldMaps>* maps_bmp = nullptr,
31 gui::Canvas* canvas = nullptr)
32 : overworld_(overworld),
33 rom_(rom),
34 maps_bmp_(maps_bmp),
35 canvas_(canvas) {}
36
37 // Set callbacks for refresh operations
39 RefreshCallback refresh_map_properties,
40 RefreshCallback refresh_overworld_map,
41 RefreshPaletteCallback refresh_map_palette,
42 RefreshPaletteCallback refresh_tile16_blockset = nullptr,
43 ForceRefreshGraphicsCallback force_refresh_graphics = nullptr) {
44 refresh_map_properties_ = std::move(refresh_map_properties);
45 refresh_overworld_map_ = std::move(refresh_overworld_map);
46 refresh_map_palette_ = std::move(refresh_map_palette);
47 refresh_tile16_blockset_ = std::move(refresh_tile16_blockset);
48 force_refresh_graphics_ = std::move(force_refresh_graphics);
49 }
50
51 // Set callbacks for entity operations
53 std::function<void(const std::string&)> insert_callback) {
54 entity_insert_callback_ = std::move(insert_callback);
55 }
56
57 // Set callback for tile16 editing from context menu
58 void SetTile16EditCallback(std::function<void()> callback) {
59 edit_tile16_callback_ = std::move(callback);
60 }
61
62 // Main interface methods
63 void DrawCanvasToolbar(int& current_world, int& current_map,
64 bool& current_map_lock,
65 bool& show_map_properties_panel,
66 bool& show_custom_bg_color_editor,
67 bool& show_overlay_editor, bool& show_overlay_preview,
68 int& game_state, EditingMode& current_mode,
69 EntityEditMode& entity_edit_mode);
70
71 void DrawMapPropertiesPanel(int current_map, bool& show_map_properties_panel);
72
73 void DrawCustomBackgroundColorEditor(int current_map,
74 bool& show_custom_bg_color_editor);
75
76 void DrawOverlayEditor(int current_map, bool& show_overlay_editor);
77
78 // Overlay preview functionality
79 void DrawOverlayPreviewOnMap(int current_map, int current_world,
80 bool show_overlay_preview);
81
82 // Context menu integration
83 void SetupCanvasContextMenu(gui::Canvas& canvas, int current_map,
84 bool current_map_lock,
85 bool& show_map_properties_panel,
86 bool& show_custom_bg_color_editor,
87 bool& show_overlay_editor, int current_mode = 0);
88
89 // Utility methods - now call the callbacks
92 absl::Status RefreshMapPalette();
93 absl::Status RefreshTile16Blockset();
94 void ForceRefreshGraphics(int map_index);
95
96 // Helper to refresh sibling map graphics for multi-area maps
97 void RefreshSiblingMapGraphics(int map_index, bool include_self = false);
98
99 private:
100 // Property category drawers
101 void DrawGraphicsPopup(int current_map, int game_state);
102 void DrawPalettesPopup(int current_map, int game_state,
103 bool& show_custom_bg_color_editor);
104 void DrawPropertiesPopup(int current_map, bool& show_map_properties_panel,
105 bool& show_overlay_preview, int& game_state);
106
107 // Overlay and mosaic functionality
108 void DrawMosaicControls(int current_map);
109 void DrawOverlayControls(int current_map, bool& show_overlay_preview);
110 std::string GetOverlayDescription(uint16_t overlay_id);
111
112 // Integrated toolset popup functions
113 void DrawToolsPopup(int& current_mode);
114 void DrawViewPopup();
116
117 // Tab content drawers
118 void DrawBasicPropertiesTab(int current_map);
119 void DrawSpritePropertiesTab(int current_map);
120 void DrawCustomFeaturesTab(int current_map);
121 void DrawTileGraphicsTab(int current_map);
122 void DrawMusicTab(int current_map);
123
126 std::array<gfx::Bitmap, zelda3::kNumOverworldMaps>* maps_bmp_;
128
129 // Callbacks for refresh operations
135
136 // Callback for entity insertion (generic, editor handles entity types)
137 std::function<void(const std::string&)> entity_insert_callback_;
138
139 // Callback for tile16 editing from context menu
140 std::function<void()> edit_tile16_callback_;
141
142 // Using centralized UI constants from ui_constants.h
143};
144
145} // namespace editor
146} // namespace yaze
147
148#endif // YAZE_APP_EDITOR_OVERWORLD_MAP_PROPERTIES_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
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > * maps_bmp_
std::function< void()> RefreshCallback
std::function< void()> edit_tile16_callback_
void SetupCanvasContextMenu(gui::Canvas &canvas, int current_map, bool current_map_lock, bool &show_map_properties_panel, bool &show_custom_bg_color_editor, bool &show_overlay_editor, int current_mode=0)
void DrawOverlayEditor(int current_map, bool &show_overlay_editor)
void DrawPropertiesPopup(int current_map, bool &show_map_properties_panel, bool &show_overlay_preview, int &game_state)
void SetTile16EditCallback(std::function< void()> callback)
MapPropertiesSystem(zelda3::Overworld *overworld, Rom *rom, std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > *maps_bmp=nullptr, gui::Canvas *canvas=nullptr)
RefreshPaletteCallback refresh_tile16_blockset_
void DrawOverlayPreviewOnMap(int current_map, int current_world, bool show_overlay_preview)
void SetEntityCallbacks(std::function< void(const std::string &)> insert_callback)
void DrawMosaicControls(int current_map)
void DrawMapPropertiesPanel(int current_map, bool &show_map_properties_panel)
std::function< void(int)> ForceRefreshGraphicsCallback
void SetRefreshCallbacks(RefreshCallback refresh_map_properties, RefreshCallback refresh_overworld_map, RefreshPaletteCallback refresh_map_palette, RefreshPaletteCallback refresh_tile16_blockset=nullptr, ForceRefreshGraphicsCallback force_refresh_graphics=nullptr)
std::function< void(const std::string &) entity_insert_callback_)
void DrawSpritePropertiesTab(int current_map)
void DrawToolsPopup(int &current_mode)
RefreshPaletteCallback refresh_map_palette_
void DrawBasicPropertiesTab(int current_map)
void DrawCustomFeaturesTab(int current_map)
void DrawPalettesPopup(int current_map, int game_state, bool &show_custom_bg_color_editor)
void DrawCustomBackgroundColorEditor(int current_map, bool &show_custom_bg_color_editor)
void DrawCanvasToolbar(int &current_world, int &current_map, bool &current_map_lock, bool &show_map_properties_panel, bool &show_custom_bg_color_editor, bool &show_overlay_editor, bool &show_overlay_preview, int &game_state, EditingMode &current_mode, EntityEditMode &entity_edit_mode)
std::function< absl::Status()> RefreshPaletteCallback
void RefreshSiblingMapGraphics(int map_index, bool include_self=false)
void DrawTileGraphicsTab(int current_map)
ForceRefreshGraphicsCallback force_refresh_graphics_
std::string GetOverlayDescription(uint16_t overlay_id)
void DrawOverlayControls(int current_map, bool &show_overlay_preview)
void DrawGraphicsPopup(int current_map, int game_state)
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:150
Represents the full Overworld data, light and dark world.
Definition overworld.h:217