Initial commit
This commit is contained in:
44
nclock.c
Normal file
44
nclock.c
Normal 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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user