I'm trying to draw and pivot a rectangle.
How to get the new coordinates if I turn it 90 degree for example?
From this:
To this:
This is not good because it will reduce it in size but this is just to give you an idea.
Code:
int size = 50;
if(b) // draw rectangle
{
POINT points[4] =
{{xCoord, yCoord},
{xCoord, yCoord-size},
{xCoord+size, yCoord-size},
{xCoord+size, yCoord}
};
Polygon(hdc, points, 4);
}
else // turn rectangle
{
POINT points[4] =
{{xCoord+(size/2), yCoord-(size/2)},
{xCoord+(size), yCoord-size},
{xCoord+size+(size/2), yCoord-size+(size/2)},
{xCoord+size, yCoord}
};
Polygon(hdc, points, 4);
}