Added 'C_C++/strategiless.c'
This commit is contained in:
parent
4fa4818f98
commit
f2168d594c
29
C_C++/strategiless.c
Normal file
29
C_C++/strategiless.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* @BAKE gcc $@ -o $*.out $(pkg-config --cflags --libs ncurses) && ./$*.out
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
signed main() {
|
||||
/* Irrelevant */
|
||||
initscr();
|
||||
cbreak();
|
||||
curs_set(0);
|
||||
noecho();
|
||||
nodelay(stdscr, true);
|
||||
scrollok(stdscr, true);
|
||||
/* ---------- */
|
||||
bool is_blocking = false;
|
||||
|
||||
while (1) {
|
||||
char c = wgetch(stdscr);
|
||||
if (c != EOF) {
|
||||
is_blocking = !is_blocking;
|
||||
}
|
||||
if (!is_blocking) {
|
||||
addstr("Recieved a message.\n");
|
||||
} else {
|
||||
addstr("A message was blocked.\n");
|
||||
}
|
||||
napms(500);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user