Загрузить файлы в «/»

This commit is contained in:
8nlight 2023-10-07 17:15:37 +03:00
parent 2d1ffc23d5
commit b201477146
2 changed files with 9 additions and 4 deletions

View File

@ -1,10 +1,13 @@
quit - q quit - q
change cursor pos - w q change cursor pos - w s
add - space add - space
pause - p pause - p
Need libncurses and c compiler

8
main.c
View File

@ -34,7 +34,6 @@ void keyboard(clock_t sec, clock_t mcsec) {
if (key < 0) if (key < 0)
return; return;
clear();
switch (key) { switch (key) {
case ' ': case ' ':
add_value(sec, mcsec / 10000); add_value(sec, mcsec / 10000);
@ -65,12 +64,14 @@ void keyboard(clock_t sec, clock_t mcsec) {
default: default:
break; break;
} }
clear();
} }
void print_timer(void) { void print_timer(void) {
if (timer_size > 0) { if (timer_size > 0) {
/* Start y */ /* Start y */
unsigned int y = 3; unsigned int y = 4;
mvprintw(y, 0, ">"); mvprintw(y, 0, ">");
for (size_t i = cursor; i < cursor + 10; i++) { for (size_t i = cursor; i < cursor + 10; i++) {
@ -105,7 +106,8 @@ int main(void) {
clock_t sec = mcsec / 1000000; clock_t sec = mcsec / 1000000;
clock_t msec = (mcsec / 100000) % 10; clock_t msec = (mcsec / 100000) % 10;
mvprintw(1, 2, "%ld.%ld", sec, msec); mvprintw(1, 2, "[q - quit] [' ' - add mark] [w/s - control] [p - pause]");
mvprintw(3, 2, "%ld.%ld", sec, msec);
print_timer(); print_timer();
keyboard(sec, mcsec); keyboard(sec, mcsec);