delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/11/22:30:25

From: Nicolas Blais <eletech AT netrover DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: [ALLEGRO] Mouse problem ||PLEASE HLP||
Date: Thu, 11 Jun 1998 22:16:35 -0400
Organization: Elemental Technologies
Lines: 28
Message-ID: <35808F82.538C6AB8@netrover.com>
NNTP-Posting-Host: 198.168.87.29
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

The bit of code below seams to work partially or actually more than I
expect, because when I click on the rectangle, it gives me millions
(seriously) of the "Yep" string, but I only want one.  Also, sometimes,
it just doesn't print the "Yep" at all, and I have to hold the mouse
button until the million "Yep"s show!  Can this be fixed?

#define RGB makecolor15

 rect(screen,19,19,61,61,RGB(200,200,200));
 rectfill(screen,20,20,60,60,RGB(100,100,100));
 show_mouse(screen);
 min_x = min_y = 20;
 max_x = max_y = 40;
 do
   {
   if(((mouse_x >= min_x) && (mouse_x <= max_x)) && ((mouse_y >= min_y )
&& (mouse_y <= max_y)))
  {
                if (mouse_b & 1)
                   {
                   show_mouse(NULL);
                   textout(screen,font,"Yep",random() % 800,random() %
600,RGB(0,255,0));
                   show_mouse(screen);
                   }
                }
      } while (!keypressed());

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019