Xref: news2.mv.net comp.os.msdos.djgpp:5216 From: Jonathan Markland Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro's Grabber Date: Thu, 20 Jun 1996 16:38:33 +0100 Organization: The University of York, UK Lines: 42 Message-ID: <31C97079.5CD3@tower.york.ac.uk> References: <835267355snz AT flag DOT demon DOT co DOT uk> NNTP-Posting-Host: cst124.york.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp > In article > slh100 AT york DOT ac DOT uk "Shawn Hargreaves" writes: > > > [stuff snipped] > > If you want to remove the grid, edit grabber.c and in the function: > > > > void grab_bitmap(BITMAP *bmp) > > { > > ... stuff deleted ... > > > > while (!mouse_b) { > > x = mouse_x & 0xFFF0; <----- delete this line! > > if (x + bmp->w > graphic->w) > > x = (graphic->w - bmp->w) & 0xFFF0; > > if (x < 0) > > x = 0; > > y = mouse_y & 0xFFF0; <----- delete this line! [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? This would explain why the grabbing box never moves, as the variables X and Y are never updated (they probably get fixed at zero)! Hope this helps. Jonathan.