Implement horizontal and vertical flipping for quad brushes

This commit is contained in:
def 2014-05-17 17:47:47 +02:00
parent 0a49301eea
commit 6fe6db8954

View file

@ -148,12 +148,41 @@ void CLayerQuads::BrushPlace(CLayer *pBrush, float wx, float wy)
m_pEditor->m_Map.m_Modified = true;
}
void Swap(CPoint& a, CPoint& b)
{
CPoint tmp;
tmp.x = a.x;
tmp.y = a.y;
a.x = b.x;
a.y = b.y;
b.x = tmp.x;
b.y = tmp.y;
}
void CLayerQuads::BrushFlipX()
{
for(int i = 0; i < m_lQuads.size(); i++)
{
CQuad *q = &m_lQuads[i];
Swap(q->m_aPoints[0], q->m_aPoints[1]);
Swap(q->m_aPoints[2], q->m_aPoints[3]);
}
m_pEditor->m_Map.m_Modified = true;
}
void CLayerQuads::BrushFlipY()
{
for(int i = 0; i < m_lQuads.size(); i++)
{
CQuad *q = &m_lQuads[i];
Swap(q->m_aPoints[0], q->m_aPoints[2]);
Swap(q->m_aPoints[1], q->m_aPoints[3]);
}
m_pEditor->m_Map.m_Modified = true;
}
void Rotate(vec2 *pCenter, vec2 *pPoint, float Rotation)