home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume4 / xrobots / part01 / help.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-06-04  |  3.5 KB  |  137 lines

  1. /*
  2.  * help.c  --  xrobots v1.0
  3.  */
  4.  
  5. #include <X11/Intrinsic.h>
  6. #include <X11/StringDefs.h>
  7. #include <X11/Shell.h>
  8. #include <X11/AsciiText.h>
  9. #include <X11/Command.h>
  10. #include <X11/Box.h>
  11. #include "help.h"
  12.  
  13. /*----------------------------------------------------------------------*/
  14.  
  15. Widget help_popup;
  16.  
  17. static Arg arglist_text[] = {
  18.   {  XtNheight, (XtArgVal) 300   },
  19.   {  XtNtextOptions, (XtArgVal) scrollVertical },
  20.   {  XtNwidth, (XtArgVal) 505 },
  21.   {  XtNstring, (XtArgVal) "\
  22. xrobots -- version 1.0\n\
  23. \n\
  24. Welcome to the world of xrobots.  Where the bad guys (the robots) are \n\
  25. incredibly stupid and the good guy (the smiley face) is outnumbered.\n\
  26. You (as the good guy) can avoid death and achieve instant fame and \n\
  27. gratification by appropriate use of the mouse and/or keyboard.\n\
  28. \n\
  29. The mouse:  \n\
  30. Clicking the left mouse button moves the smiley face one step in the \n\
  31. direction of the pointer.  Clicking directly on top of the smiley face \n\
  32. takes a turn, but does not change it's position.  \n\
  33. \n\
  34. Clicking the middle mouse button causes the smiley face to run like heck. \n\
  35. Of course, the robots can run just as fast so it really doesn't matter... \n\
  36. Or does it? \n\
  37. \n\
  38. Clicking the right mouse button gives the smiley a rest.  This is the \n\
  39. same as clicking on the 'wait' button.\n\
  40. \n\
  41. \n\
  42. The keyboard: \n\
  43.     's' triggers the sonic screwdriver. \n\
  44.     't' triggers the teleportation device. \n\
  45.     'w' waits until robots are breathing down your neck. \n\
  46.     '.' waits one turn. \n\
  47. \n\
  48.      Directional control:\n\
  49. \n\
  50.          y k u \n\
  51.           \\|/  \n\
  52.          h- -l \n\
  53.           /|\\  \n\
  54.          b j n \n\
  55. \n\
  56. \n\
  57. Well, that's the low down.  If you don't like the mouse or keyboard set up,\n\
  58. see the manual to find out about changing the translations.  \n\
  59. \n\
  60. ----\n\
  61. \n\
  62. This insomnia killer was written by:\n\
  63.   Brian Warkentine (bwarkent@polyslo.CalPoly.EDU).\n\
  64. \n\ "
  65.   },
  66.   {  XtNeditType, (XtArgVal) XttextRead  },
  67. };
  68.  
  69.  
  70. static Arg arglist_popdown[] = {
  71.   {  XtNresize, (XtArgVal) False  },
  72.   {  XtNwidth, (XtArgVal) 300   },
  73.   {  XtNlabel, (XtArgVal) "Pop Down"  },
  74.   {  XtNjustify, (XtArgVal) XtJustifyCenter  },
  75. };
  76.  
  77.  
  78. /*ARGSUSED*/
  79. static XtCallbackProc 
  80. popdown_callback(w, closure, call_data)
  81.   Widget w;
  82.   caddr_t closure;
  83.   caddr_t call_data;
  84. {
  85.   XtPopdown(help_popup);
  86. }
  87.  
  88.  
  89. void
  90. create_help_popup(parent)
  91.   Widget parent;
  92. {
  93.   int i;
  94.   Widget help_box, popdown;
  95.  
  96.   help_popup = XtCreatePopupShell(
  97.                                    "help_popup",
  98.                                    transientShellWidgetClass,
  99.                                    parent, 0,0);
  100.  
  101.   help_box = XtCreateManagedWidget(
  102.                                     "help_box",
  103.                                     boxWidgetClass,
  104.                                     help_popup,
  105.                                     0,0);
  106.  
  107.   (void) XtCreateManagedWidget(
  108.                                     "message",
  109.                                     asciiStringWidgetClass,
  110.                                     help_box,
  111.                                     arglist_text,
  112.                                     XtNumber(arglist_text));
  113.  
  114.   popdown = XtCreateManagedWidget(
  115.                                     "popdown",
  116.                                     commandWidgetClass,
  117.                                     help_box,
  118.                                     arglist_popdown,
  119.                                     XtNumber(arglist_popdown));
  120.   XtAddCallback(popdown,XtNcallback,popdown_callback,0);
  121. }
  122.  
  123.  
  124.  
  125. /*ARGSUSED*/
  126. XtCallbackProc
  127. show_help_callback(widget,closure,callData)
  128.   Widget widget;
  129.   caddr_t closure;
  130.   caddr_t callData;
  131. {
  132.   XtPopup(help_popup, XtGrabNone);
  133. }
  134.  
  135.  
  136.  
  137.