yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
tile_brush.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_OVERWORLD_PAINTING_TILE_BRUSH_H_
2#define YAZE_APP_EDITOR_OVERWORLD_PAINTING_TILE_BRUSH_H_
3
4#include <algorithm>
5#include <cstddef>
6#include <vector>
7
8namespace yaze::editor {
9
10// Captured Tile16 IDs in row-major order. Source coordinates and the moving
11// destination preview are deliberately not part of the brush value.
12struct TileBrush {
13 int width = 0;
14 int height = 0;
15 std::vector<int> tile_ids;
16
17 bool valid() const {
18 return width > 0 && width <= 256 && height > 0 && height <= 256 &&
19 tile_ids.size() == static_cast<size_t>(width) * height &&
20 std::all_of(tile_ids.begin(), tile_ids.end(),
21 [](int id) { return id >= 0 && id <= 0xFFFF; });
22 }
23
24 int at(int x, int y) const { return tile_ids[y * width + x]; }
25};
26
27} // namespace yaze::editor
28
29#endif // YAZE_APP_EDITOR_OVERWORLD_PAINTING_TILE_BRUSH_H_
Editors are the view controllers for the application.
int at(int x, int y) const
Definition tile_brush.h:24
std::vector< int > tile_ids
Definition tile_brush.h:15