mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-26 04:31:34 +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
|
||||
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 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:
|
||||
SeparatorWithPixel(Pixel pixel) : pixel_(pixel) {}
|
||||
~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:
|
||||
Pixel pixel_;
|
||||
|
Loading…
Reference in New Issue
Block a user