Xref: news2.mv.net comp.os.msdos.djgpp:5247 From: Ben Ashley Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro's Grabber Date: Thu, 20 Jun 96 22:49:17 GMT Organization: Flag Bearers Lines: 43 Message-ID: <835310957snz@flag.demon.co.uk> References: <835267355snz AT flag DOT demon DOT co DOT uk> <31C97079 DOT 5CD3 AT tower DOT york DOT ac DOT uk> Reply-To: Ben AT flag DOT demon DOT co DOT uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <31C97079 DOT 5CD3 AT tower DOT york DOT ac DOT uk> jrm101 AT tower DOT york DOT ac DOT uk "Jonathan Markland" writes: > [stuff snipped] > > Observing the butchered version of the code reveals something a bit > suspicious. I guess that Shawn offered the solution in a moment of haste. > I know, it happens to me too! ;) > > Try this instead: > > > > while (!mouse_b) { > > > x = mouse_x; <----- I've changed this > > > if (x + bmp->w > graphic->w) > > > x = (graphic->w - bmp->w) & 0xFFF0; <--- [See below] > > > if (x < 0) > > > x = 0; > > > y = mouse_y; <----- I've changed this too > > Also, I think the line that I have indicated may also need the "& 0xFFF0" > removing? Well, it was in fact just changing the last '0' to F. That worked. > > This would explain why the grabbing box never moves, as the variables X and Y > are > never updated (they probably get fixed at zero)! I can't believe I missed that. 'x' never gets set!! Hehehe... sounds like the sort of bug that comes up in my programs... Y'know, really silly things :) -- Cheers, Ben -=Look for "Moo-Juice" on the IRC=- ---------------------====### legal notice ###====-------------------------- Microsoft Network is prohibited from redistributing this work in any form,in whole or in part. License to distribute this post is available to Microsoft for $499. Posting without permission constitutes an agreement to these terms.