delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/11/19:32:04

From: Nicolas Blais <eletech AT netrover DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Area of square problem, different.
Date: Thu, 11 Jun 1998 19:12:17 -0400
Organization: Elemental Technologies
Lines: 29
Message-ID: <35806450.B3F694CD@netrover.com>
NNTP-Posting-Host: 198.168.87.16
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".  Can this be fixed?

#define RGB makecol15
 int min_x, min_y, max_x, max_y;
 min_x = min_y = 20;
 max_x = max_y = 40;
 rectfill(screen,20,20,60,60,RGB(255,0,0));
 show_mouse(screen);
 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());

Thank you for any help,
Nicolas Blais

- Raw text -


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