mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-26 20:47:05 +08:00
Fix separator() (#100)
separator() should modify only the character, not the background color.
This commit is contained in:
parent
30a85c4c5b
commit
ab9d6feaa5
@ -29,15 +29,9 @@ class Separator : public Node {
|
|||||||
else
|
else
|
||||||
c = U'│';
|
c = U'│';
|
||||||
|
|
||||||
Pixel p;
|
|
||||||
p.character = c;
|
|
||||||
RenderWithPixel(screen, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderWithPixel(Screen& screen, Pixel pixel) {
|
|
||||||
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
||||||
for (int x = box_.x_min; x <= box_.x_max; ++x) {
|
for (int x = box_.x_min; x <= box_.x_max; ++x) {
|
||||||
screen.PixelAt(x, y) = pixel;
|
screen.PixelAt(x, y).character = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,7 +41,13 @@ class SeparatorWithPixel : public Separator {
|
|||||||
public:
|
public:
|
||||||
SeparatorWithPixel(Pixel pixel) : pixel_(pixel) {}
|
SeparatorWithPixel(Pixel pixel) : pixel_(pixel) {}
|
||||||
~SeparatorWithPixel() override {}
|
~SeparatorWithPixel() override {}
|
||||||
void Render(Screen& screen) override { RenderWithPixel(screen, pixel_); }
|
void Render(Screen& screen) override {
|
||||||
|
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
||||||
|
for (int x = box_.x_min; x <= box_.x_max; ++x) {
|
||||||
|
screen.PixelAt(x, y) = pixel_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pixel pixel_;
|
Pixel pixel_;
|
||||||
|
Loading…
Reference in New Issue
Block a user