Initial commit

This commit is contained in:
2017-11-27 09:54:08 +00:00
commit e0aed95b7b
6 changed files with 164 additions and 0 deletions

44
nclock.c Normal file
View File

@@ -0,0 +1,44 @@
#include <curses.h> //ncurses windows
#include <stdlib.h> //atexit
#include <string.h>
#include <time.h>
#include "nclock.h"
#include "numbers.h"
#include <time.h>
int main(int argc, char **argv) {
/* enable ncurses standard screen */
initscr();
atexit(quitProgram); //cleanup at exit
state s = {0};
initState(&s);
//mvprintw(s.centery, s.centerx, number[5][0]);
//mvprintw(20, 30, number[0][3]);
drawNumber(10,10,4);
getch();
drawNumber(10,16,2);
getch();
}
void quitProgram(void) {
endwin();
}
void initState(state *s) {
getmaxyx(stdscr, s->maxy, s->maxx);
s->centery = --s->maxy / 2;
s->centerx = --s->maxx / 2;
}
void drawNumber(int starty, int startx, int num) {
int i;
for (i = 0; i < 5; i++) {
mvprintw(starty + i, startx, number[num][i]);
}
}