Hi !
To represent the bullets in my game (2D), I was thinking that a line was enough and I've true. The problem is the rotation of my line, currently I'm using this code to render my bullets:
D3DXVECTOR2 vertices[3];
vertices[0] = D3DXVECTOR2(m_Position.x, m_Position.y);
vertices[1] = D3DXVECTOR2(m_Position.x+6, m_Position.y+6);
m_BulletView->Begin();
m_BulletView->Draw(vertices, 2, D3DCOLOR_XRGB(0, 255, 0));
m_BulletView->End();
If I want a rotation, the docs say "before calling Draw, transform your vertices". I don't know how.
So I tried DrawTransform() with this code:
D3DXVECTOR3 vertices[3];
vertices[0] = D3DXVECTOR3(m_Position.x, m_Position.y, 0.0f);
vertices[1] = D3DXVECTOR3(m_Position.x+6, m_Position.y+6, 0.0f);
D3DXVECTOR2 rot_center;
rot_center.x = (m_Position.x + 16);
rot_center.y = (m_Position.y + 16);
D3DXMATRIX rot_mat;
D3DXMatrixTransformation2D(&rot_mat, NULL, 0, NULL, &rot_center, m_Angle, NULL);
m_BulletView->Begin();
m_BulletView->DrawTransform(vertices, 2, &rot_mat, D3DCOLOR_XRGB(0, 255, 0));
m_BulletView->End();
Didn't work. Help please !
Thanks for all