PDA

View Full Version : G_DRAWRECT and negative coords


PointOfLight
10-16-2006, 10:48 PM
It appears that as long as all 4 coordinates are negative, or at least one y coordinate is positive, then the visible part of the rectangle renders fine. However, if both of the Y coordinates are negative, and at least one X coordinate is positive, it renders a rectangle that is the whole height of the screen. I realize I'm not explaining myself very well, but if you run this example: http://www.csdatasol.net/Downloads/Strategy_Game.zip and hit the Shift key a few times I think you'll see what I mean.

kornalius
10-17-2006, 12:03 AM
Hi,

I will take a look tomorrow at your code. I can add extra code to the rectangle function not to accept negative values.

PointOfLight
10-17-2006, 01:51 AM
Actually, that would not solve the problem. Per Paul's thread on SetOriginX, not allowing the rectangle to have negative coords would cause problems. If both y coordinates are negative, it just shouldn't render the rectangle to the screen at all.

kornalius
10-17-2006, 12:15 PM
Hi POL,

It is now fixed, the g_drawrect had a special piece of code in there that checked to make sure you didn't go over the height of the screen. The PocketFrog library had a bug so I made sure it would not happen. I was checking against unsigned int (no negatives allowed) and this was the problem.