Switch to C++

This commit is contained in:
2018-01-07 22:24:23 -08:00
parent efc529bec8
commit 3a10624966
7 changed files with 47 additions and 41 deletions

54
ncac.c
View File

@@ -1,54 +0,0 @@
#include "ncac.h"
#include <curses.h>
#include <stdlib.h>
#include <term.h>
#include "ui/base.h"
int main(int argc, char **argv) {
(void)argc;
(void)argv;
setup();
char input;
int curs_x = 0;
int curs_y = 0;
while(1) {
switch (input = getch()) {
case 'a':
draw_text(&curs_x, &curs_y, "Hello, world!");
break;
default:
finish(0);
break;
}
}
return 0;
}
void finish(int sig) {
(void)sig;
endwin();
exit(0);
}
void setup() {
// initialize ncurses
initscr();
cbreak();
// don't echo input
noecho();
nonl();
// install handlers
signal(SIGINT, &finish);
}