Fix indices for screen code example and create call (#53)

PixelAt(10,10) was outside of the Screen and there is no c'tor for
Dimensions but a static Create method.
This commit is contained in:
Stephan Roslen 2020-10-16 18:37:52 +02:00 committed by GitHub
parent e34dc1606e
commit 5d140845ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,12 +90,13 @@ The screen can be printed as a string using ftxui::Screen::ToString().
~~~cpp ~~~cpp
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream>
int main(void) { int main(void) {
using namespace ftxui; using namespace ftxui;
auto screen = Screen(Dimension::Fixed(32), Dimension::Fixed(10)); auto screen = Screen::Create(Dimension::Fixed(32), Dimension::Fixed(10));
auto& pixel = screen.PixelAt(10,10); auto& pixel = screen.PixelAt(9,9);
pixel.character = U'A'; pixel.character = U'A';
pixel.bold = true; pixel.bold = true;
pixel.foreground_color = Color::Blue; pixel.foreground_color = Color::Blue;