Hello, I had a problem to draw a line so I made a function with convex and I thought maybe you coul add this feature, here is the code :
// a = x1 ; b = y1 ; c = x2 ; d = y2 ; e = thickness
void line(float a, float b, float c, float d, float e){
ConvexShape convex;
convex.setPointCount(4);
if(c-a == 0){
convex.setPoint(0, Vector2f(a-e/2, b));
convex.setPoint(1, Vector2f(a+e/2, b));
convex.setPoint(2, Vector2f(c+e/2, d));
convex.setPoint(3, Vector2f(c-e/2, d));
}
else{
float alpha = atan((d-b)/(c-a));
convex.setPoint(0, Vector2f(a-(e/2)*sin(alpha), b+(e/2)*cos(alpha)));
convex.setPoint(1, Vector2f(a+(e/2)*sin(alpha), b-(e/2)*cos(alpha)));
convex.setPoint(2, Vector2f(c+(e/2)*sin(alpha), d-(e/2)*cos(alpha)));
convex.setPoint(3, Vector2f(c-(e/2)*sin(alpha), d+(e/2)*cos(alpha)));
}
window.draw(convex);
}