We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thank you for the buffering.
There's one thing I did with the code here!
Since it's intended to run on Linux only. I added extra functions.
void hide_caret() { printf("\e[?25l"); } void show_caret() { printf("\e[?25h"); } int kbhit(void) { struct termios oldt, newt; int ch; int oldf; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); oldf = fcntl(STDIN_FILENO, F_GETFL, 0); fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); fcntl(STDIN_FILENO, F_SETFL, oldf); if(ch != EOF) { ungetc(ch, stdin); return 1; } return 0; }
The funcitons hide_caret() and show_caret() area called before and after the while loop.
hide_caret()
show_caret()
Also I added one function to detect keyboard pressing to exit the while loop. It's annoying to press "Ctrl+C" to exit the TUI Screen saver!
while
The kbhit() function requires the headers down below:
kbhit()
#include <termios.h> #include <fcntl.h>
The kbhit() can be changed to return the keycode. Let's say we want to exit if it's ESC.
Just one more thing! This single line functions could be replaced by a DEFINE directive!
But I got what I wanted, so...
@WillianBR
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Thank you for the buffering.
There's one thing I did with the code here!
Since it's intended to run on Linux only. I added extra functions.
The funcitons
hide_caret()
andshow_caret()
area called before and after the while loop.Also I added one function to detect keyboard pressing to exit the
while
loop. It's annoying to press "Ctrl+C" to exit the TUI Screen saver!The
kbhit()
function requires the headers down below:The
kbhit()
can be changed to return the keycode. Let's say we want to exit if it's ESC.Just one more thing! This single line functions could be replaced by a DEFINE directive!
But I got what I wanted, so...
@WillianBR
The text was updated successfully, but these errors were encountered: