diff --git a/spark_ncurses.c b/spark_ncurses.c index 7044fb9..15bddf2 100644 --- a/spark_ncurses.c +++ b/spark_ncurses.c @@ -60,12 +60,12 @@ void sig_handler(int sig) { exit(0); } -void print(int y, int x, char *str, int val) { +void print(int y, int x, char *str, int val, int j) { if (val < 0) - mvprintw(y, x, "%s", str); + mvprintw(y + j, x, "%s", str); else - mvprintw(y, x, "%s", str); + mvprintw(y - j, x, "%s", str); } int main(void) { @@ -100,13 +100,8 @@ int main(void) { max = val; int lvl = (val - min) * (ws.ws_row / 5) / ((max - min) + 1); - for (int j = 0; j < lvl; j++) { - print(middle - j, i, "$", values[i]); - print(middle + j, i, "$", values[i]); - } - - print(middle - lvl, i, ".", values[i]); - print(middle + lvl, i, "'", values[i]); + for (int j = 0; j < lvl; j++) + print(middle, i, "$", values[i], j); } refresh();