-Anem a usar ncurses
This commit is contained in:
51
curses_test.c
Normal file
51
curses_test.c
Normal file
@@ -0,0 +1,51 @@
|
||||
#include <ncurses.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
initscr();
|
||||
|
||||
if (has_colors() == FALSE) {
|
||||
endwin();
|
||||
printf("Your terminal does not support color\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int w, h;
|
||||
getmaxyx(stdscr, h, w);
|
||||
|
||||
start_color();
|
||||
//init_pair(1, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(1, COLOR_YELLOW, COLOR_BLUE);
|
||||
|
||||
WINDOW *win_regs = newwin(10,20,0,0);
|
||||
WINDOW *win_mem = newwin(10,w-20,0,20);
|
||||
WINDOW *win_code = newwin(h-10,w,10,0);
|
||||
refresh();
|
||||
|
||||
box(win_mem,0,0);
|
||||
mvwprintw(win_mem, 0, 2, " MEMORY: ");
|
||||
mvwprintw(win_mem, 1, 2, "%ix%i", w, h);
|
||||
wrefresh(win_mem);
|
||||
|
||||
box(win_regs,0,0);
|
||||
mvwprintw(win_regs, 0, 2, " REGISTERS: ");
|
||||
mvwprintw(win_regs, 1, 2, "AF: 00");
|
||||
mvwprintw(win_regs, 2, 2, "BC: 00");
|
||||
mvwprintw(win_regs, 3, 2, "DE: 00");
|
||||
mvwprintw(win_regs, 4, 2, "HL: 00");
|
||||
wrefresh(win_regs);
|
||||
|
||||
box(win_code,0,0);
|
||||
wattron(win_code, COLOR_PAIR(1));
|
||||
mvwprintw(win_code, 1, 1, "Hello world %s !!!", "hola");
|
||||
wattroff(win_code, COLOR_PAIR(1));
|
||||
wrefresh(win_code);
|
||||
|
||||
refresh();
|
||||
|
||||
getch();
|
||||
endwin();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user