delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/30/04:16:30

From: gautam AT interlog DOT com (Gautam N. Lad)
Newsgroups: comp.os.msdos.djgpp
Subject: Mouse polling : Giving me a headache! HELP HELP HELP (Allegro).
Date: Tue, 28 Oct 97 20:27:01 GMT
Organization: InterLog Internet Services
Lines: 56
Message-ID: <635haf$a3j$2@news.interlog.com>
NNTP-Posting-Host: ip220-102.cc.interlog.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,
Well, my previous message re: the mouse problem in Allegro, didn't really help, 
I'm going to try again.

What I want is this:
- User clicks once (let's go of the mouse button, and doesn't hold it down)
- User moves mouse around
- User clicks again (let's go of the mouse button, and doesn't hold it down)

For some reason, the two clicks don't respond right away.  

I have something like this:  ( I hope this code is better than my previous one.).
It's using XOR enabled to draw/erase circles.

for(;;)	// First forever loop
{
  if(MouseMove())	// Mouse has moved from it's previous position.  First.
    {
    if(mouse_b & 1)	// User has clicked left-button.  First.
    {
    centerx = mouse_x;	centery = mouse_y;	// Store mouse location (center of 
				// circle).
    for(;;)	// Second forever loop.  Do until mouse is pressed second time.
    {
    if(MouseMove())	// Mouse has moved from it's previous position.
        {
             circle(screen, centerx, centery, radius, WHITE); 	// Draw over previous 
					// circle (XOR).
             radius=centerx-mouse_x;			// Find radius of circle.

             circle(screen, centerx, centery, radius, WHITE);	// Draw new circle.
         }
      if(mouse_b & 1) return;	// Mouse pressed second time.  We're done.
      }
   }
}


As you can see, it should work as expected, but it doesn't.  What's going on?  I 
don't want to resort to having the user draw a circle while holding a mouse button 
down. (It works, but I don't want that.  I would however like to leave it up to the 
user to choose which mode they like - mouse up or mouse down style).

PLEASE HELP (Especially if you can Shawn).  I am really getting fed up, 
because I can't figure it out.
Bye!


-------------------------------------------------------------
Gautam N. Lad
-------------------------------------------------------------
E-Mail:	gautam AT interlog DOT com
Website:	http://www.interlog.com/~gautam

POV-Ray Software, Gallery, and Links!
-------------------------------------------------------------

- Raw text -


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