There is a problem with the Window#clip_to rectangle. The C code does
right = x + width;
when it should be:
right = x + width - 1;
Gosu then does:
int physWidth = std::abs(left - right);
which means that clipped width will be one greater than requested. Similar with physHeight.
(Error found in Gosu::Graphics::beginClipping
I found the effect in a couple of my games, but only just realised that it was almost certainly a bug in clip_to, not my code.
Oh, although this post disappeared a bit, I worked out that it was not that there was an error in clip_to, but rather that draw_quad/draw_line was pretty much an approximation. You see, I was judging the clipping area by comparison with quads I was drawing, which I assumed were accurately plotted.
I ended up making a one-pixel image and scaling that to draw lines and rectangles and that was perfectly accurate. Sorry for muddying the waters a bit with my original complaint.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill