载入中...
搜索中...
未找到
FieldTargets.cpp
浏览该文件的文档.
2
4#include <utility>
5
6namespace eve::level_editing {
7
9 : id_(std::move(id)), buffer_(buffer) {}
10int TileBufferTarget::width() const { return buffer_ ? buffer_->getWidth() : 0; }
11int TileBufferTarget::height() const { return buffer_ ? buffer_->getHeight() : 0; }
12bool TileBufferTarget::containsCell(int x, int y) const { return buffer_ && buffer_->containsCell(x, y); }
13int TileBufferTarget::readInt(int x, int y) const { return containsCell(x, y) ? buffer_->getGid(x, y) : 0; }
14FieldWriteStatus TileBufferTarget::writeInt(int x, int y, int value) {
15 if (!containsCell(x, y)) return FieldWriteStatus::Rejected;
16 if (buffer_->getGid(x, y) == value) return FieldWriteStatus::Unchanged;
17 buffer_->setGid(x, y, value);
19 widenDirty(x, y);
20 return FieldWriteStatus::Applied;
21}
22
23} // namespace eve::level_editing
double value
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
std::unique_ptr< gpgpu::GpuBuffer > buffer
Definition OnnxGpgpu.cpp:26
std::string id
Definition PlayHost.cpp:108
void bumpRevision()
Advance the revision without touching the dirty region.
void widenDirty()
Mark an unknown area dirty without advancing the revision.
int readInt(int x, int y) const override
Reads int.
bool containsCell(int x, int y) const override
True if cell.
FieldWriteStatus writeInt(int x, int y, int value) override
Writes int.
int height() const override
Height.
int width() const override
Width.
TileBufferTarget(std::string id, TileBuffer *buffer)
Adapt a borrowed buffer that must outlive this target. @thread Owner-thread only.
Independent GID grid for map brushes (no hard dependency on map.TileLayer).
Definition TileBuffer.h:11
void setGid(int x, int y, int gid)
Sets the gid.
int getWidth() const
Returns the width.
Definition TileBuffer.h:17
bool containsCell(int x, int y) const
Return whether a cell belongs to this buffer.
int getHeight() const
Returns the height.
Definition TileBuffer.h:19
int getGid(int x, int y) const
Returns the gid.