Comments and formatting
This commit is contained in:
18
nclock.c
18
nclock.c
@@ -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 */
|
||||||
|
Reference in New Issue
Block a user