home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / ibm / pc / 1072 < prev    next >
Encoding:
Text File  |  1993-01-09  |  2.7 KB  |  89 lines

  1. Xref: sparky comp.sys.ibm.pc:1072 comp.sys.ibm.pc.programmer:760 gnu.gcc.help:2888
  2. Newsgroups: comp.sys.ibm.pc,comp.sys.ibm.pc.programmer,gnu.gcc,gnu.gcc.help
  3. Path: sparky!uunet!zaphod.mps.ohio-state.edu!menudo.uh.edu!nuchat!moe
  4. From: moe@nuchat.sccsi.com (Norman C. Kluksdahl)
  5. Subject: problem with cb libgrx in djgpp
  6. Message-ID: <1993Jan9.220734.6551@nuchat.sccsi.com>
  7. Organization: South Coast Computing Services, Inc.
  8. Date: Sat, 9 Jan 1993 22:07:34 GMT
  9. Lines: 78
  10.  
  11.  
  12. Can anyone help with this?
  13. I am compiling some code with the GCC compiler from the djgpp project,
  14. but I keep running into a bug.  This problem is evident on several 
  15. different 386SX, 386, and 486 platforms, so I have discounted a problem
  16. with my specific machine.
  17.  
  18. I am attempting to use the libgrx library mouse functions; specifically,
  19. I am trying to use the queued keyboard and mouse interrupts, as directed
  20. in the documentation for libgrx.  But, my problem is that even the test
  21. program won't run, and neither will my own sample code.  If anyone can
  22. help with this, I would be greatly appreciative.
  23.  
  24. ****************  code compiled  **********************************
  25.  
  26. #include <grx.h>
  27. #include <mousex.h>
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30.  
  31. void main()
  32. {
  33.    GrSetMode(GR_width_height_color_graphics,x,y,c);
  34.    mt();
  35.    GrSetMode(GR_default_text);
  36.    exit(0);
  37. }
  38.  
  39. mt()
  40. {
  41.    MouseEvent evt;
  42.    char ii = 0;
  43.    FILE *fp, *fopen();
  44.    fp = fopen("mt_int.out", "w");
  45.  
  46.    if(MouseDetect()) 
  47.       {
  48.       MouseEventMode(1);
  49.       MouseInit();
  50.       MouseDisplayCursor();
  51.       MouseEventEnable(1,1);
  52.       MouseSetColors(GrAllocColor(255,0,0),GrBlack());
  53.       GrClearScreen(GrAllocColor(0,0,128));
  54.       while(ii != 'q') 
  55.      {
  56.      MouseGetEvent((M_KEYPRESS | M_BUTTON_CHANGE | M_POLL ),&evt);
  57.      if(evt.flags & M_KEYPRESS) 
  58.         {
  59.         fprintf(fp,"key pressed = %c\n",evt.key);
  60.         ii = evt.key;
  61.         }
  62.      if(evt.flags & M_BUTTON_CHANGE)
  63.         {
  64.         if(evt.flags & M_LEFT_DOWN)
  65.            fprintf(fp,"left button down at %d %d\n",evt.x, evt.y);
  66.         if(evt.flags & M_LEFT_UP)
  67.            fprintf(fp,"left button up at %d %d\n",evt.x, evt.y);
  68.         if(evt.flags & M_MIDDLE_DOWN)
  69.            fprintf(fp,"middle button down at %d %d\n",evt.x, evt.y);
  70.         if(evt.flags & M_MIDDLE_UP)
  71.            fprintf(fp,"middle button up at %d %d\n",evt.x, evt.y);
  72.         if(evt.flags & M_RIGHT_DOWN)
  73.            fprintf(fp,"right button down at %d %d\n",evt.x, evt.y);
  74.         if(evt.flags & M_RIGHT_UP)
  75.            fprintf(fp,"right button up at %d %d\n",evt.x, evt.y);
  76.         }
  77.      }
  78.       MouseUnInit();
  79.    }
  80. }
  81.  
  82. **********************  end of code  *************************
  83.  
  84. Thanks in advance for any help which can be provided.
  85.  
  86. =====================================================================
  87. Norman Kluksdahl  
  88.   moe@nuchat.sccsi.com
  89.