yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
overworld_canvas_renderer.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_OVERWORLD_OVERWORLD_CANVAS_RENDERER_H
2#define YAZE_APP_EDITOR_OVERWORLD_OVERWORLD_CANVAS_RENDERER_H
3
4#include <cstdint>
5#include <optional>
6#include <string>
7#include <unordered_map>
8#include <vector>
9
10#include "absl/status/status.h"
11#include "app/gfx/core/bitmap.h"
13#include "imgui/imgui.h"
15
16namespace yaze {
17namespace editor {
18
19class OverworldEditor;
20
21void DrawSheetScaleControl(const char* id, gui::AdaptiveSheetScaleMode* mode);
22
39 public:
41
42 // =========================================================================
43 // Main Canvas Drawing
44 // =========================================================================
45
49
50 // =========================================================================
51 // Panel Drawing Methods
52 // =========================================================================
53
55 absl::Status DrawTile16Selector();
56
58 void DrawTile8Selector();
59
61 absl::Status DrawAreaGraphics();
62
64 void DrawV3Settings();
65
67 void DrawMapProperties();
68
71
72 const std::vector<int>& tile16_usage_counts() const {
74 }
75 int tile16_usage_count(int tile_id) const {
76 if (tile_id >= 0 &&
77 tile_id < static_cast<int>(tile16_usage_counts_.size())) {
78 return tile16_usage_counts_[tile_id];
79 }
80 return 0;
81 }
82 std::string Tile16ScopeLabel() const;
83
84 private:
85 // =========================================================================
86 // Internal Canvas Drawing Helpers
87 // =========================================================================
88
90 void DrawOverworldMaps();
91 void DrawMapWithAreaLayers(int map_index, int map_x, int map_y, float scale);
92
93 // Subscreen overlay layer per map (sky, fog, lava, canopy, rain), built in
94 // the map's palette and refreshed when the map's pixels change.
95 struct OverlayLayer {
97 uint64_t bitmap_serial = 0;
98 bool background = false;
99 bool has_overlay = false;
100 };
101 OverlayLayer* EnsureOverlayLayer(int map_index);
102 std::unordered_map<int, OverlayLayer> overlay_layers_;
103 bool PrepareContextMenu(const ImVec2& screen_position);
107
111 std::vector<int> Tile16ScopeMaps() const;
114 void RefreshTile16Order(bool grid_hovered);
116 void ResetTile16Order();
117
118 // =========================================================================
119 // Data
120 // =========================================================================
121
123 std::optional<ImVec2> entity_drag_origin_;
128
136 // Scope inputs the cached counts were built for.
139 std::vector<int> tile16_usage_counts_;
140 char tile16_area_search_[64] = {};
141};
142
143} // namespace editor
144} // namespace yaze
145
146#endif // YAZE_APP_EDITOR_OVERWORLD_OVERWORLD_CANVAS_RENDERER_H
Handles all canvas drawing and panel rendering for the overworld editor.
absl::Status DrawTile16Selector()
Draw the tile16 selector panel.
gui::AdaptiveSheetScaleMode area_graphics_scale_mode_
void ResetTile16Order()
Shows every tile in ID order and forces a recount on the next refresh.
absl::Status DrawAreaGraphics()
Draw the area graphics panel.
void DrawMapProperties()
Draw the map properties panel (sidebar-based)
void DrawOverworldProperties()
Draw the overworld properties grid (debug/info view)
void FilterHoveredEntityByMode()
In an entity mode only that entity type responds to hover/drag/menu.
OverworldEditor * editor_
Non-owning pointer to the parent editor.
const std::vector< int > & tile16_usage_counts() const
void DrawOverworldCanvas()
Draw the main overworld canvas with toolbar, maps, and entities. This is the primary entry point call...
bool PrepareContextMenu(const ImVec2 &screen_position)
void DrawV3Settings()
Draw the v3 settings panel.
void DrawMapWithAreaLayers(int map_index, int map_x, int map_y, float scale)
std::unordered_map< int, OverlayLayer > overlay_layers_
void DrawTile8Selector()
Draw the tile8 selector panel (graphics bin)
void DrawOverworldMaps()
Render the 64 overworld map bitmaps to the canvas.
Main UI class for editing overworld maps in A Link to the Past.
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:70
void DrawSheetScaleControl(const char *id, gui::AdaptiveSheetScaleMode *mode)