Mail Archives: djgpp/1996/06/20/16:25:52
> In article <Pine DOT SGI DOT 3 DOT 91 DOT 960618173249 DOT 174C-100000 AT tower DOT york DOT ac DOT uk>
> 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.
- Raw text -