This repository has been archived on 2024-12-13. You can view files and clone it, but cannot push or open issues or pull requests.
progress/progress.cpp

18 lines
417 B
C++
Raw Normal View History

2021-12-11 23:45:15 +01:00
#include <iostream>
#include <libscterm.hpp>
#include <ctime>
int main() {
2021-12-12 00:08:54 +01:00
sc::term term {STDERR_FILENO};
2021-12-11 23:45:15 +01:00
std::cout << term.rows() << " rows, " << term.cols() << " cols\n";
sleep(1);
struct timespec tm;
tm.tv_nsec = 20000000;
tm.tv_sec = 0;
2021-12-12 00:08:54 +01:00
sc::cursor_hider ch {STDERR_FILENO};
2021-12-11 23:45:15 +01:00
for (int i = 0; i < 1000; ++i) {
term.progress(i, 1000);
nanosleep(&tm, nullptr);
}
}