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"
8#include "app/gui/canvas.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 // Main interface methods
46 void DrawSimplifiedMapSettings(int& current_world, int& current_map,
47 bool& current_map_lock, bool& show_map_properties_panel,
48 bool& show_custom_bg_color_editor, bool& show_overlay_editor,
49 bool& show_overlay_preview, int& game_state, int& current_mode);
50
51 void DrawMapPropertiesPanel(int current_map, bool& show_map_properties_panel);
52
53 void DrawCustomBackgroundColorEditor(int current_map, bool& show_custom_bg_color_editor);
54
55 void DrawOverlayEditor(int current_map, bool& show_overlay_editor);
56
57 // Overlay preview functionality
58 void DrawOverlayPreviewOnMap(int current_map, int current_world, bool show_overlay_preview);
59
60 // Context menu integration
61 void SetupCanvasContextMenu(gui::Canvas& canvas, int current_map, bool current_map_lock,
62 bool& show_map_properties_panel, bool& show_custom_bg_color_editor,
63 bool& show_overlay_editor);
64
65 private:
66 // Property category drawers
67 void DrawGraphicsPopup(int current_map, int game_state);
68 void DrawPalettesPopup(int current_map, int game_state, bool& show_custom_bg_color_editor);
69 void DrawPropertiesPopup(int current_map, bool& show_map_properties_panel,
70 bool& show_overlay_preview, int& game_state);
71
72 // Overlay and mosaic functionality
73 void DrawMosaicControls(int current_map);
74 void DrawOverlayControls(int current_map, bool& show_overlay_preview);
75 std::string GetOverlayDescription(uint16_t overlay_id);
76
77 // Integrated toolset popup functions
78 void DrawToolsPopup(int& current_mode);
79 void DrawViewPopup();
81
82 // Tab content drawers
83 void DrawBasicPropertiesTab(int current_map);
84 void DrawSpritePropertiesTab(int current_map);
85 void DrawCustomFeaturesTab(int current_map);
86 void DrawTileGraphicsTab(int current_map);
87 void DrawMusicTab(int current_map);
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
101 std::array<gfx::Bitmap, zelda3::kNumOverworldMaps>* maps_bmp_;
103
104 // Callbacks for refresh operations
110
111 // Using centralized UI constants from ui_constants.h
112};
113
114} // namespace editor
115} // namespace yaze
116
117#endif // YAZE_APP_EDITOR_OVERWORLD_MAP_PROPERTIES_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
std::array< gfx::Bitmap, zelda3::kNumOverworldMaps > * maps_bmp_
std::function< void()> RefreshCallback
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 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)
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 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)
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:54
Represents the full Overworld data, light and dark world.
Definition overworld.h:135
Main namespace for the application.