15Cell& dev_null_cell() {
21Surface::Surface(
int dimx,
int dimy)
22 : stencil{0, std::max(0, dimx) - 1, 0, std::max(0, dimy) - 1},
23 dimx_(std::max(0, dimx)),
24 dimy_(std::max(0, dimy)),
25 cells_(static_cast<size_t>(dimx_) * static_cast<size_t>(dimy_)) {}
30std::string& Surface::at(
int x,
int y) {
31 return CellAt(x, y).character;
37const std::string& Surface::at(
int x,
int y)
const {
38 return CellAt(x, y).character;
44Cell& Surface::CellAt(
int x,
int y) {
45 return stencil.Contain(x, y) ? FastCellAt(x, y) : dev_null_cell();
51const Cell& Surface::CellAt(
int x,
int y)
const {
52 return stencil.Contain(x, y) ? FastCellAt(x, y) : dev_null_cell();
58Cell& Surface::FastCellAt(
int x,
int y) {
59 return cells_[
static_cast<size_t>(
y) *
static_cast<size_t>(dimx_) +
60 static_cast<size_t>(x)];
66const Cell& Surface::FastCellAt(
int x,
int y)
const {
67 return cells_[
static_cast<size_t>(
y) *
static_cast<size_t>(dimx_) +
68 static_cast<size_t>(x)];
72void Surface::Clear() {
73 std::fill(cells_.begin(), cells_.end(), Cell());
76void Surface::Reserved1() {}
77void Surface::Reserved2() {}
78void Surface::Reserved3() {}
79void Surface::Reserved4() {}
80void Surface::Reserved5() {}
81void Surface::Reserved6() {}
82void Surface::Reserved7() {}
83void Surface::Reserved8() {}
The FTXUI ftxui:: namespace.