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 "app/rom.h"
9
10// Forward declaration
11namespace yaze {
12namespace editor {
13class OverworldEditor;
14}
15}
16
17namespace yaze {
18namespace editor {
19
21 public:
22 // Callback types for refresh operations
23 using RefreshCallback = std::function<void()>;
24 using RefreshPaletteCallback = std::function<absl::Status()>;
25 using ForceRefreshGraphicsCallback = std::function<void(int)>;
26
27 explicit MapPropertiesSystem(zelda3::Overworld* overworld, Rom* rom,
28 std::array<gfx::Bitmap, zelda3::kNumOverworldMaps>* maps_bmp = nullptr,
29 gui::Canvas* canvas = nullptr)
30 : overworld_(overworld), rom_(rom), maps_bmp_(maps_bmp), canvas_(canvas) {}
31
32 // Set callbacks for refresh operations
33 void SetRefreshCallbacks(RefreshCallback refresh_map_properties,
34 RefreshCallback refresh_overworld_map,
35 RefreshPaletteCallback refresh_map_palette,
36 RefreshPaletteCallback refresh_tile16_blockset = nullptr,
37 ForceRefreshGraphicsCallback force_refresh_graphics = nullptr) {
38 refresh_map_properties_ = std::move(refresh_map_properties);
39 refresh_overworld_map_ = std::move(refresh_overworld_map);
40 refresh_map_palette_ = std::move(refresh_map_palette);
41 refresh_tile16_blockset_ = std::move(refresh_tile16_blockset);
42 force_refresh_graphics_ = std::move(force_refresh_graphics);
43 }
44
45 // Set callbacks for entity operations
47 std::function<void(const std::string&)> insert_callback) {
48 entity_insert_callback_ = std::move(insert_callback);
49 }
50
51 // Main interface methods
52 void DrawSimplifiedMapSettings(int& current_world, int& current_map,
53 bool& current_map_lock, bool& show_map_properties_panel,
54 bool& show_custom_bg_color_editor, bool& show_overlay_editor,
55 bool& show_overlay_preview, int& game_state, int& current_mode);
56
57 void DrawMapPropertiesPanel(int current_map, bool& show_map_properties_panel);
58
59 void DrawCustomBackgroundColorEditor(int current_map, bool& show_custom_bg_color_editor);
60
61 void DrawOverlayEditor(int current_map, bool& show_overlay_editor);
62
63 // Overlay preview functionality
64 void DrawOverlayPreviewOnMap(int current_map, int current_world, bool show_overlay_preview);
65
66 // Context menu integration
67 void SetupCanvasContextMenu(gui::Canvas& canvas, int current_map, bool current_map_lock,
68 bool& show_map_properties_panel, bool& show_custom_bg_color_editor,
69 bool& show_overlay_editor, int current_mode = 0);
70
71 private:
72 // Property category drawers
73 void DrawGraphicsPopup(int current_map, int game_state);
74 void DrawPalettesPopup(int current_map, int game_state, bool& show_custom_bg_color_editor);
75 void DrawPropertiesPopup(int current_map, bool& show_map_properties_panel,
76 bool& show_overlay_preview, int& game_state);
77
78 // Overlay and mosaic functionality
79 void DrawMosaicControls(int current_map);
80 void DrawOverlayControls(int current_map, bool& show_overlay_preview);
81 std::string GetOverlayDescription(uint16_t overlay_id);
82
83 // Integrated toolset popup functions
84 void DrawToolsPopup(int& current_mode);
85 void DrawViewPopup();
87
88 // Tab content drawers
89 void DrawBasicPropertiesTab(int current_map);
90 void DrawSpritePropertiesTab(int current_map);
91 void DrawCustomFeaturesTab(int current_map);
92 void DrawTileGraphicsTab(int current_map);
93 void DrawMusicTab(int current_map);
94
95 // Utility methods - now call the callbacks
98 absl::Status RefreshMapPalette();
99 absl::Status RefreshTile16Blockset();
100 void ForceRefreshGraphics(int map_index);
101
102 // Helper to refresh sibling map graphics for multi-area maps
103 void RefreshSiblingMapGraphics(int map_index, bool include_self = false);
104
107 std::array<gfx::Bitmap, zelda3::kNumOverworldMaps>* maps_bmp_;
109
110 // Callbacks for refresh operations
116
117 // Callback for entity insertion (generic, editor handles entity types)
118 std::function<void(const std::string&)> entity_insert_callback_;
119
120 // Using centralized UI constants from ui_constants.h
121};
122
123} // namespace editor
124} // namespace yaze
125
126#endif // YAZE_APP_EDITOR_OVERWORLD_MAP_PROPERTIES_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:74
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > * maps_bmp_
std::function< void()> RefreshCallback
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)
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)
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 DrawSimplifiedMapSettings(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, int &current_mode)
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:59
Represents the full Overworld data, light and dark world.
Definition overworld.h:128
Main namespace for the application.
Definition controller.cc:20