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 <stdlib.h> //atexit
#include <string.h>
#include <time.h>
#include <string.h> //memset
#include <time.h> //time
#include "nclock.h"
#include "numbers.h"
#include <time.h>
#include <unistd.h> //sleep
#include <signal.h>
#include <signal.h> //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 */

130
numbers.h
View File

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