From: a DOT gillett AT virgin DOT net (Andrew R. Gillett) Newsgroups: comp.os.msdos.djgpp Subject: Re: [ALLEGRO] Mouse problem ||PLEASE HLP|| Date: Sat, 13 Jun 1998 21:06:47 +0100 Organization: Virgin Net Usenet Service Lines: 35 Message-ID: References: <35808F82 DOT 538C6AB8 AT netrover DOT com> NNTP-Posting-Host: 194.168.120.13 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk [This followup was posted to comp.os.msdos.djgpp and a copy was sent to the cited author.] In comp.os.msdos.djgpp, article <35808F82 DOT 538C6AB8 AT netrover DOT com>, Nicolas Blais (eletech AT netrover DOT com) wrote: > 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? Well, I think the reason it is saying 'Yep' a million times is that that is what the program does. If you make it so the text is always printed in the same place, you will only see one 'Yep'. If you want the text to be in a random position, as it is at the moment, but only one 'Yep', you can use a flag, i.e. showing_yep = FALSE; do { if(((mouse_x >= min_x) && (mouse_x <= max_x)) && ((mouse_y >= min_y ) && (mouse_y <= max_y))) { if ( (mouse_b & 1) && (!showing_yep) ) { showing_yep = TRUE; show_mouse(NULL); textout(screen,font,"Yep", random() % 800,random() % 600,RGB(0,255,0)); show_mouse(screen); } } } while (!keypressed());