diff --git a/nclock.c b/nclock.c index 1435c52..a393cf7 100644 --- a/nclock.c +++ b/nclock.c @@ -1,16 +1,15 @@ #include //ncurses windows #include //atexit -#include -#include +#include //memset +#include //time #include "nclock.h" #include "numbers.h" -#include #include //sleep -#include +#include //sigaction void handle_winch(int sig) { + /* This function handles the console resizing */ endwin(); - clear(); refresh(); } @@ -29,13 +28,12 @@ int main(int argc, char **argv) { sa.sa_handler = handle_winch; sigaction(SIGWINCH, &sa, NULL); + //Define the state struct state s = {0}; - initState(&s); - //mvprintw(s.centery, s.centerx, number[5][0]); - //mvprintw(20, 30, number[0][3]); + //start the clock draw(&s); - getch(); + return 0; } void quitProgram(void) { @@ -71,8 +69,6 @@ void drawColon(int starty, int startx) { } void drawTime(state *s, int hour, int min, int sec) { - //int countx = 0, i; - int newcenty = s->centery - 3; //start above the center /* center X: */ /* (3 Nuberpairs + 2 colons) / 2 */ diff --git a/numbers.h b/numbers.h index faa44c2..2334d7a 100644 --- a/numbers.h +++ b/numbers.h @@ -1,13 +1,13 @@ -const char number[10][5][6] = \ - {\ - { \ +const char number[10][5][6] = \ + { \ + { \ "#####", \ "# #", \ "# #", \ "# #", \ "#####", \ }, \ - { \ + { \ " #", \ " #", \ " #", \ @@ -15,69 +15,69 @@ const char number[10][5][6] = \ " #", }, \ { \ - "#####",\ - " #",\ - "#####",\ - "# ",\ - "#####"\ - }, \ - {\ - "#####",\ - " #",\ - " ####",\ - " #",\ - "#####"\ - }, \ - {\ - "# #",\ + "#####", \ + " #", \ + "#####", \ + "# ", \ + "#####" \ + }, \ + { \ + "#####", \ + " #", \ + " ####", \ + " #", \ + "#####" \ + }, \ + { \ "# #", \ - "#####",\ - " #",\ - " #"\ - },\ - {\ - "#####",\ - "# ",\ - "#####",\ - " #",\ - "#####"\ - },\ - {\ - "#####",\ - "# ",\ - "#####",\ - "# #",\ - "#####"\ - },\ - {\ - "#####",\ - " #",\ - " #",\ - " #",\ - " #"\ - }, \ - {\ - "#####",\ - "# #",\ - "#####",\ - "# #",\ - "#####"\ - },\ - {\ - "#####",\ - "# #",\ - "#####",\ - " #",\ - "#####"\ - }\ + "# #", \ + "#####", \ + " #", \ + " #" \ + }, \ + { \ + "#####", \ + "# ", \ + "#####", \ + " #", \ + "#####" \ + }, \ + { \ + "#####", \ + "# ", \ + "#####", \ + "# #", \ + "#####" \ + }, \ + { \ + "#####", \ + " #", \ + " #", \ + " #", \ + " #" \ + }, \ + { \ + "#####", \ + "# #", \ + "#####", \ + "# #", \ + "#####" \ + }, \ + { \ + "#####", \ + "# #", \ + "#####", \ + " #", \ + "#####" \ + } \ }; -const char colon[5][6] = \ - {\ - " ",\ - " # ",\ - " ",\ - " # ",\ - " "\ +const char colon[5][6] = \ + { \ + " ", \ + " # ", \ + " ", \ + " # ", \ + " " \ };