home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / msdos / programm / 11539 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.9 KB

  1. Path: sparky!uunet!destroyer!cs.ubc.ca!gambier.rick.cs.ubc.ca!not-for-mail
  2. From: w5y092@rick.cs.ubc.ca (Stephen Todd Leroux)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Mouse Bug?
  5. Date: 20 Dec 1992 13:22:34 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Lines: 75
  8. Message-ID: <1h2o6qINNau3@gambier.rick.cs.ubc.ca>
  9. NNTP-Posting-Host: gambier.rick.cs.ubc.ca
  10.  
  11. Hello computing world.
  12.  
  13. I'm writing a drawing program.  I wrote the following mouse library to work
  14. in conjuction with an interface library I wrote to implement button pushes
  15. and stuff like that.
  16.  
  17. Only problem is, sometimes the mouseDown() call doesn't work!  It usually
  18. has problems after a call to lastLeftDown().  I have no
  19. idea why.  Perhaps I'm missing an interrupt somewhere or something?  BTW
  20. if you're really interested there are about a million other bugs I can lay
  21. on you -- but we'll go one at a time for now.
  22.  
  23. o /                                    o /
  24.  X ------------------------------------ X ---------------------------------
  25. O \                                    O \
  26.  
  27. int mouseDown()
  28. {
  29.     struct REGPACK r;
  30.  
  31.     r.r_ax = 3;
  32.     intr(0x33,&r);
  33.     if (r.r_bx > 0)
  34.         return 1;
  35.     return 0;
  36. }
  37. point *lastLeftUp(int *num)
  38. {
  39.     struct REGPACK r;
  40.     point *p;
  41.  
  42.     r.r_ax = 6;
  43.     r.r_bx = 0;
  44.     intr(0x33, &r);
  45.     *num = r.r_bx;
  46.     if (r.r_bx == 0) return NULL;
  47.     p = (point *)(malloc(sizeof(point)));
  48.     p->x = r.r_cx;
  49.     p->y = r.r_dx;
  50.  
  51.     return p;
  52. }
  53.  
  54. point *lastLeftDown(int *num)
  55. {
  56.     struct REGPACK r;
  57.     point *p;
  58.  
  59.     r.r_ax = 5;
  60.     r.r_bx = 0;
  61.     intr(0x33, &r);
  62.     *num = r.r_bx;
  63.     if (r.r_bx == 0) return NULL;
  64.     p = (point *)(mmalloc(sizeof(point)));
  65.     p->x = r.r_cx;
  66.     p->y = r.r_dx;
  67.  
  68.     return p;
  69. }
  70.  
  71. void initMouse()
  72. {
  73.     struct REGPACK r;
  74.  
  75.     r.r_ax = 0;
  76.     intr(0x33, &r);
  77.     showMouse();
  78.  
  79. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==- 
  80.  
  81. Please e-mail your wisdoms to w5y092@rick.cs.ubc.ca
  82. Thanks!
  83.  
  84.  
  85.  
  86.