Comments and formatting
This commit is contained in:
18
nclock.c
18
nclock.c
@@ -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 */
|
||||
|
116
numbers.h
116
numbers.h
@@ -1,5 +1,5 @@
|
||||
const char number[10][5][6] = \
|
||||
{\
|
||||
{ \
|
||||
{ \
|
||||
"#####", \
|
||||
"# #", \
|
||||
@@ -15,69 +15,69 @@ const char number[10][5][6] = \
|
||||
" #",
|
||||
}, \
|
||||
{ \
|
||||
"#####",\
|
||||
" #",\
|
||||
"#####",\
|
||||
"# ",\
|
||||
"#####"\
|
||||
"#####", \
|
||||
" #", \
|
||||
"#####", \
|
||||
"# ", \
|
||||
"#####" \
|
||||
}, \
|
||||
{\
|
||||
"#####",\
|
||||
" #",\
|
||||
" ####",\
|
||||
" #",\
|
||||
"#####"\
|
||||
{ \
|
||||
"#####", \
|
||||
" #", \
|
||||
" ####", \
|
||||
" #", \
|
||||
"#####" \
|
||||
}, \
|
||||
{\
|
||||
"# #",\
|
||||
{ \
|
||||
"# #", \
|
||||
"#####",\
|
||||
" #",\
|
||||
" #"\
|
||||
},\
|
||||
{\
|
||||
"#####",\
|
||||
"# ",\
|
||||
"#####",\
|
||||
" #",\
|
||||
"#####"\
|
||||
},\
|
||||
{\
|
||||
"#####",\
|
||||
"# ",\
|
||||
"#####",\
|
||||
"# #",\
|
||||
"#####"\
|
||||
},\
|
||||
{\
|
||||
"#####",\
|
||||
" #",\
|
||||
" #",\
|
||||
" #",\
|
||||
" #"\
|
||||
"# #", \
|
||||
"#####", \
|
||||
" #", \
|
||||
" #" \
|
||||
}, \
|
||||
{\
|
||||
"#####",\
|
||||
"# #",\
|
||||
"#####",\
|
||||
"# #",\
|
||||
"#####"\
|
||||
},\
|
||||
{\
|
||||
"#####",\
|
||||
"# #",\
|
||||
"#####",\
|
||||
" #",\
|
||||
"#####"\
|
||||
}\
|
||||
{ \
|
||||
"#####", \
|
||||
"# ", \
|
||||
"#####", \
|
||||
" #", \
|
||||
"#####" \
|
||||
}, \
|
||||
{ \
|
||||
"#####", \
|
||||
"# ", \
|
||||
"#####", \
|
||||
"# #", \
|
||||
"#####" \
|
||||
}, \
|
||||
{ \
|
||||
"#####", \
|
||||
" #", \
|
||||
" #", \
|
||||
" #", \
|
||||
" #" \
|
||||
}, \
|
||||
{ \
|
||||
"#####", \
|
||||
"# #", \
|
||||
"#####", \
|
||||
"# #", \
|
||||
"#####" \
|
||||
}, \
|
||||
{ \
|
||||
"#####", \
|
||||
"# #", \
|
||||
"#####", \
|
||||
" #", \
|
||||
"#####" \
|
||||
} \
|
||||
};
|
||||
|
||||
|
||||
const char colon[5][6] = \
|
||||
{\
|
||||
" ",\
|
||||
" # ",\
|
||||
" ",\
|
||||
" # ",\
|
||||
" "\
|
||||
{ \
|
||||
" ", \
|
||||
" # ", \
|
||||
" ", \
|
||||
" # ", \
|
||||
" " \
|
||||
};
|
||||
|
Reference in New Issue
Block a user