hc.c 525 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <ncurses.h>
  2. #include <stdio.h>
  3. int main(){
  4. initscr();
  5. noecho();
  6. cbreak();
  7. keypad(stdscr, TRUE);
  8. curs_set(1);
  9. if(has_colors() == FALSE ) {
  10. endwin();
  11. puts("no colors");
  12. return 1;
  13. }
  14. start_color();
  15. init_pair(1, COLOR_WHITE, COLOR_BLUE);
  16. attron(COLOR_PAIR(1));
  17. int y,x;
  18. getmaxyx(stdscr, y,x);
  19. y=y*0.5;
  20. x=(x*0.5) -6;
  21. mvwprintw(stdscr, y, x, "Hello World");
  22. mvwprintw(stdscr, 2, 2, "Hellow World1");
  23. refresh();
  24. attroff(COLOR_PAIR(1));
  25. getch();
  26. endwin();
  27. return 0;
  28. }