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
8
namespace
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.
12
struct
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_
yaze::editor
Editors are the view controllers for the application.
Definition
patch_export_usage.cc:9
yaze::editor::TileBrush
Definition
tile_brush.h:12
yaze::editor::TileBrush::at
int at(int x, int y) const
Definition
tile_brush.h:24
yaze::editor::TileBrush::valid
bool valid() const
Definition
tile_brush.h:17
yaze::editor::TileBrush::width
int width
Definition
tile_brush.h:13
yaze::editor::TileBrush::height
int height
Definition
tile_brush.h:14
yaze::editor::TileBrush::tile_ids
std::vector< int > tile_ids
Definition
tile_brush.h:15
src
app
editor
overworld
painting
tile_brush.h
Generated by
1.10.0