home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 056.lha / Four / menu.c < prev    next >
C/C++ Source or Header  |  1986-11-20  |  5KB  |  154 lines

  1. /* four in a row's structures */
  2.  
  3.  
  4. /* menu and item definitions */
  5. #define PROJECT      0
  6. #define GAME         1
  7. #define ABOUT        0
  8. #define QUIT         1
  9. #define NEWGAME      0
  10. #define PLAYER2      1
  11. #define FIRSTPLAYER  2
  12. #define INSTRUCTIONS 3
  13.  
  14.  
  15. void set_itext(), init_itexts(), set_item(), init_items();
  16. void set_menu(), init_menus();
  17.  
  18. struct IntuiText m1_text1, m1_text2,
  19.                  m2_text1, m2_text2a, m2_text2b, m2_text3a,
  20.                  m2_text3b, m2_text4,
  21.                  instr1, instr2, instr3, instr4, instr5, instr6,
  22.                  about1, about2, about3, about4, about5, about6, about7,
  23.                  address1, address2, address3, address4, address5,
  24.                  positive, negative;
  25.  
  26. struct MenuItem  m1_item1, m1_item2,
  27.                  m2_item1, m2_item2, m2_item3, m2_item4;
  28.  
  29. struct Menu      menu1, menu2;
  30.  
  31.  
  32. /* intuitext structures and routines for menus */
  33.  
  34. void set_itext(intuitext, pen, left, top, text, next)
  35. struct IntuiText *intuitext, *next;
  36. UBYTE pen, *text;
  37. SHORT left, top;
  38. {
  39.    intuitext-> FrontPen    =  pen;
  40.    intuitext-> BackPen     =  1;
  41.    intuitext-> DrawMode    =  JAM1;
  42.    intuitext-> LeftEdge    =  left;
  43.    intuitext-> TopEdge     =  top;
  44.    intuitext-> ITextFont   =  NULL;
  45.    intuitext-> IText       =  text;
  46.    intuitext-> NextText    =  next;
  47.    return;
  48. }
  49.  
  50.  
  51. void init_itexts()
  52. {
  53.    set_itext(&m1_text1, 3, 8, 1, "About", NULL);
  54.    set_itext(&m1_text2, 3, 8, 1, "Quit", NULL);
  55.    set_itext(&m2_text1, 3, 8, 1, "New Game", NULL);
  56.    set_itext(&m2_text2a, 3, 8, 1, "One Player", NULL);
  57.    set_itext(&m2_text2b, 3, 8, 1, "Two Players", NULL);
  58.    set_itext(&m2_text3a, 3, 8, 1, "I Am First", NULL);
  59.    set_itext(&m2_text3b, 3, 8, 1, "You're First", NULL);
  60.    set_itext(&m2_text4, 3, 8, 1, "Instructions", NULL);
  61.  
  62.    set_itext(&instr6, 3, 8, 54, "(no pun intended)", NULL);
  63.    set_itext(&instr5, 3, 8, 44, "plays with brown beads.", &instr6);
  64.    set_itext(&instr4, 3, 8, 34, "on the poles.  The computer", &instr5);
  65.    set_itext(&instr3, 3, 8, 24, "horizontally by stacking them", &instr4);
  66.    set_itext(&instr2, 3, 8, 14, "vertically, diagonally, or", &instr3);
  67.    set_itext(&instr1, 3, 8, 04, "Get four beads in a row", &instr2);
  68.  
  69.    set_itext(&address5, 3,  8, 154, "Chico #:  (916)343-6676", NULL);
  70.    set_itext(&address4, 3,  8, 144, "          Chico, CA  95926", &address5);
  71.    set_itext(&address3, 3,  8, 134, "     or   634 W. 2nd Ave. #2", &address4);
  72.    set_itext(&address2, 3,  8, 114, "          Modesto, CA  95350", &address3);
  73.    set_itext(&address1, 3,  8, 104, "U.Snail:  1125 Ulrich Ave.", &address2);
  74.    set_itext(&about7,   3,  8,  89, "Comments welcome:", &address1);
  75.    set_itext(&about6,   3, 13,  69, "money;  it's Public Domain.", &about7);
  76.    set_itext(&about5,   3, 13,  59, "not for commercial use or", &about6);
  77.    set_itext(&about4,   3, 13,  49, "distribute this program, but", &about5);
  78.    set_itext(&about3,   3, 13,  39, "Feel free to copy and", &about4);
  79.    set_itext(&about2,   3,  8,  24, "Copyright (C) 1987 by Pery Pearson", &about3);
  80.    set_itext(&about1,   2, 24,   4, "Four in a Row   V1.0  08/14/87", &about2);
  81.  
  82.    set_itext(&positive, 2, 6, 4, "Gotcha", NULL);
  83.    set_itext(&negative, 2, 7, 4, "Hmm...", NULL);
  84.  
  85.    return;
  86. }
  87.  
  88.  
  89. /* menu item structures */
  90.  
  91. void set_item(item, n, l, t, w, h, f)
  92. struct MenuItem *item, *n;
  93. SHORT l, t, w, h;
  94. APTR  f;
  95. {
  96.    item-> NextItem      =  n;
  97.    item-> LeftEdge      =  l;
  98.    item-> TopEdge       =  t;
  99.    item-> Width         =  w;
  100.    item-> Height        =  h;
  101.    item-> Flags         =  ITEMTEXT | HIGHCOMP | ITEMENABLED;
  102.    item-> MutualExclude =  NULL;
  103.    item-> ItemFill      =  f;
  104.    item-> SelectFill    =  NULL;
  105.    item-> Command       =  NULL;
  106.    item-> SubItem       =  NULL;
  107.  
  108.    return;
  109. }
  110.  
  111.  
  112. void init_items()
  113. {
  114.    set_item(&m1_item2, NULL, 0, 10, 9*8, 10, (APTR)&m1_text2);
  115.    set_item(&m1_item1, &m1_item2, 0, 0, 9*8, 10, (APTR)&m1_text1);
  116.    set_item(&m2_item4, NULL, 0, 30, 14*8, 10, (APTR)&m2_text4);
  117.    set_item(&m2_item3, &m2_item4, 0, 20, 14*8, 10, (APTR)&m2_text3b);
  118.    set_item(&m2_item2, &m2_item3, 0, 10, 14*8, 10, (APTR)&m2_text2a);
  119.    set_item(&m2_item1, &m2_item2, 0, 0, 14*8, 10, (APTR)&m2_text1);
  120.    return;
  121. }
  122.  
  123.  
  124. /* menu structures and routines */
  125.  
  126. void set_menu(menu, next, l, t, w, h, name, f)
  127. struct Menu *menu, *next;
  128. SHORT l, t, w, h;
  129. BYTE  *name;
  130. struct MenuItem *f;
  131. {
  132.    menu-> NextMenu      =  next;
  133.    menu-> LeftEdge      =  l;
  134.    menu-> TopEdge       =  t;
  135.    menu-> Width         =  w;
  136.    menu-> Height        =  h;
  137.    menu-> Flags         =  MENUENABLED;
  138.    menu-> MenuName      =  name;
  139.    menu-> FirstItem     =  f;
  140.  
  141.    return;
  142. }
  143.  
  144.  
  145. void init_menus()
  146. {
  147.    init_itexts();
  148.    init_items();
  149.  
  150.    set_menu(&menu2, NULL, 14*8, 0, 14*8, 10, " Game         ", &m2_item1);
  151.    set_menu(&menu1, &menu2, 2*8, 0, 9*8, 10, " Project ", &m1_item1);
  152.    return;
  153. }
  154.