home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume6 / animal / scr.c < prev   
C/C++ Source or Header  |  1989-03-21  |  2KB  |  158 lines

  1. /*
  2.  * Animal - copyright HCR Corporation, Toronto, Canada, 1989
  3.  *
  4.  * author: Stacey Campbell
  5.  */
  6.  
  7. #include <curses.h>
  8.  
  9. #define HEAD "Animal"
  10.  
  11. static WINDOW *Header;
  12. static WINDOW *FileMsg;
  13. static WINDOW *QuestAns;
  14. static WINDOW *QuestAnsBorder;
  15.  
  16. void InitCurses()
  17.  
  18.     {
  19.     initscr();
  20. #ifdef BOGUS_ECHO
  21.     echo();
  22. #endif
  23.     werase(stdscr);
  24. #ifdef BOGUS_BOX
  25.     box(stdscr, '|', '-');
  26. #else
  27.     box(stdscr, 0, 0);
  28. #endif
  29.     wrefresh(stdscr);
  30.     Header = newwin(1, COLS - 2, 1, 1);
  31.     wstandout(Header);
  32.     mvwaddstr(Header, 0, (COLS - 2) / 2 - sizeof(HEAD) / 2 - 1, HEAD);
  33.     wstandend(Header);
  34.     wrefresh(Header);
  35.     FileMsg = newwin(3, COLS - 2, 2, 1);
  36. #ifdef BOGUS_BOX
  37.     box(FileMsg, '|', '-');
  38. #else
  39.     box(FileMsg, 0, 0);
  40. #endif
  41.     QuestAnsBorder = newwin(LINES - 6, COLS - 2, 5, 1);
  42. #ifdef BOGUS_BOX
  43.     box(QuestAnsBorder, '|', '-');
  44. #else
  45.     box(QuestAnsBorder, 0, 0);
  46. #endif
  47.     QuestAns = newwin(LINES - 8, COLS - 4, 6, 2);
  48.     wmove(QuestAns, 0, 0);
  49.     scrollok(QuestAns, TRUE);
  50.     idlok(QuestAns, TRUE);
  51.     wrefresh(FileMsg);
  52.     wrefresh(QuestAnsBorder);
  53.     wrefresh(QuestAns);
  54.     return;
  55.     }
  56.  
  57. char *FileQuestion(prompt)
  58.  
  59. char *prompt;
  60.  
  61.     {
  62.     static char answer[256];
  63.  
  64.     werase(FileMsg);
  65. #ifdef BOGUS_BOX
  66.     box(FileMsg, '|', '-');
  67. #else
  68.     box(FileMsg, 0, 0);
  69. #endif
  70.     mvwaddstr(FileMsg, 1, 1, prompt);
  71.     waddch(FileMsg, ' ');
  72. #ifdef BOGUS_GET
  73.     wrefresh(FileMsg);
  74. #endif
  75.     wgetstr(FileMsg, answer);
  76.     return answer;
  77.     }
  78.  
  79. void PutFileMsg(str)
  80.  
  81. char *str;
  82.  
  83.     {
  84.     werase(FileMsg);
  85. #ifdef BOGUS_BOX
  86.     box(FileMsg, '|', '-');
  87. #else
  88.     box(FileMsg, 0, 0);
  89. #endif
  90.     mvwaddstr(FileMsg, 1, 1, str);
  91.     wrefresh(FileMsg);
  92.     }
  93.  
  94. void EndCurses()
  95.  
  96.     {
  97.     delwin(Header);
  98.     delwin(FileMsg);
  99.     delwin(QuestAns);
  100.     delwin(QuestAnsBorder);
  101.     endwin();
  102.     }
  103.  
  104. void PutQuestion(question)
  105.  
  106. char *question;
  107.  
  108.     {
  109.     wprintw(QuestAns, "%s?", question);
  110.     }
  111.  
  112. void PutFinalQuestion(question)
  113.  
  114. char *question;
  115.  
  116.     {
  117.     char buf[256];
  118.     void PutQuestion();
  119.  
  120.     strcpy(buf, "final guess: is it ");
  121.     strcat(buf, question);
  122.     PutQuestion(buf);
  123.     }
  124.  
  125. void PutMsg(msg)
  126.  
  127. char *msg;
  128.  
  129.     {
  130.     waddstr(QuestAns, msg);
  131.     waddch(QuestAns, '\n');
  132.     }
  133.  
  134. void GetQuestLine(prompt, reply)
  135.  
  136. char *prompt;
  137. char *reply;
  138.  
  139.     {
  140.     wprintw(QuestAns, "%s ", prompt);
  141. #ifdef BOGUS_GET
  142.     wrefresh(QuestAns);
  143. #endif
  144.     wgetstr(QuestAns, reply);
  145.     }
  146.  
  147. void StartBold()
  148.  
  149.     {
  150.     wstandout(QuestAns);
  151.     }
  152.  
  153. void EndBold()
  154.  
  155.     {
  156.     wstandend(QuestAns);
  157.     }
  158.