Comments and formatting

This commit is contained in:
2017-11-27 19:43:08 +01:00
parent 689b1129f5
commit e221c3f046
2 changed files with 72 additions and 76 deletions

View File

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

116
numbers.h
View File

@@ -1,5 +1,5 @@
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] = \
{\ { \
" ",\ " ", \
" # ",\ " # ", \
" ",\ " ", \
" # ",\ " # ", \
" "\ " " \
}; };