Last active
August 21, 2017 15:25
-
-
Save njlr/8fbc7161b939e14887ddd56521ff57be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned const terminalWidth = 80; | |
int main() { | |
VirtualTerminal vt; | |
auto const fancyCounter = [](auto start, auto end, auto i) -> FlowLayout<> { | |
return { | |
Text("counting from "), Text({ Font::Bold }, start), | |
Text(" to "), Text({ Font::Bold }, end), | |
Text(": i="), Text({ FgColor::Red, Font::Underline }, i) | |
MaxWidth(20, Progress(i * 0.01)), | |
}; | |
}; | |
for (int i = 0; i < 101; ++i) { | |
Component const app = StackLayout<>({ | |
fancyCounter(0, 100, i) | |
}); | |
vt = renderToTerm(vt, TerminalWidth, app); // Render to terminal | |
std::this_thread::sleep_for(200ms); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment