diff --git a/src/main.c b/src/main.c index c015213..df15d7b 100644 --- a/src/main.c +++ b/src/main.c @@ -1,10 +1,22 @@ #include +#include #include -void update(WINDOW *win) +void get_data(int *speed, int *capacity) +{ + *speed = rand() % 201; + *capacity = rand() % 101; +} + +void update(WINDOW *win, int data) { int win_y, win_x; - char message[] = "test"; + char message[64]; + snprintf(message, sizeof(message), "%d", data); + + werase(win); + box(win, 0, 0); + getmaxyx(win, win_y, win_x); mvwprintw(win, win_y/2, win_x/2 - strlen(message)/2, "%s", message); wrefresh(win); @@ -16,6 +28,7 @@ int main() noecho(); cbreak(); curs_set(0); + nodelay(stdscr, true); int y,x; getmaxyx(stdscr, y, x); @@ -33,11 +46,13 @@ int main() wrefresh(top_win); wrefresh(bottom_win); + int speed, capacity; int ch = ERR; while(ch == ERR) { - update(top_win); - update(bottom_win); + get_data(&speed, &capacity); + update(top_win, speed); + update(bottom_win, capacity); ch = getch(); };