mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-20 02:28:10 +08:00
Automerge feature. (#313)
Add the `automerge` attribute to the Pixel bit field. It controls whether two pixels must be automerged. Defining this allows two mergeable characters not to be merged. This was requested by: https://github.com/ArthurSonzogni/FTXUI/issues/285
This commit is contained in:
@@ -89,13 +89,22 @@ class Border : public Node {
|
||||
screen.at(box_.x_max, box_.y_min) = charset[1];
|
||||
screen.at(box_.x_min, box_.y_max) = charset[2];
|
||||
screen.at(box_.x_max, box_.y_max) = charset[3];
|
||||
|
||||
for (float x = box_.x_min + 1; x < box_.x_max; ++x) {
|
||||
screen.at(x, box_.y_min) = charset[4];
|
||||
screen.at(x, box_.y_max) = charset[4];
|
||||
Pixel& p1 = screen.PixelAt(x, box_.y_min);
|
||||
Pixel& p2 = screen.PixelAt(x, box_.y_max);
|
||||
p1.character = charset[4];
|
||||
p2.character = charset[4];
|
||||
p1.automerge = true;
|
||||
p2.automerge = true;
|
||||
}
|
||||
for (float y = box_.y_min + 1; y < box_.y_max; ++y) {
|
||||
screen.at(box_.x_min, y) = charset[5];
|
||||
screen.at(box_.x_max, y) = charset[5];
|
||||
Pixel& p3 = screen.PixelAt(box_.x_min, y);
|
||||
Pixel& p4 = screen.PixelAt(box_.x_max, y);
|
||||
p3.character = charset[5];
|
||||
p4.character = charset[5];
|
||||
p3.automerge = true;
|
||||
p4.automerge = true;
|
||||
}
|
||||
|
||||
// Draw title.
|
||||
@@ -109,12 +118,20 @@ class Border : public Node {
|
||||
screen.PixelAt(box_.x_min, box_.y_max) = charset_pixel[2];
|
||||
screen.PixelAt(box_.x_max, box_.y_max) = charset_pixel[3];
|
||||
for (float x = box_.x_min + 1; x < box_.x_max; ++x) {
|
||||
screen.PixelAt(x, box_.y_min) = charset_pixel[4];
|
||||
screen.PixelAt(x, box_.y_max) = charset_pixel[4];
|
||||
Pixel& p1 = screen.PixelAt(x, box_.y_min);
|
||||
Pixel& p2 = screen.PixelAt(x, box_.y_max);
|
||||
p1 = charset_pixel[5];
|
||||
p2 = charset_pixel[5];
|
||||
p1.automerge = true;
|
||||
p2.automerge = true;
|
||||
}
|
||||
for (float y = box_.y_min + 1; y < box_.y_max; ++y) {
|
||||
screen.PixelAt(box_.x_min, y) = charset_pixel[5];
|
||||
screen.PixelAt(box_.x_max, y) = charset_pixel[5];
|
||||
Pixel& p3 = screen.PixelAt(box_.x_min, y);
|
||||
Pixel& p4 = screen.PixelAt(box_.x_max, y);
|
||||
p3 = charset_pixel[5];
|
||||
p4 = charset_pixel[5];
|
||||
p3.automerge = true;
|
||||
p4.automerge = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user