Improve stroke drawing on 2D collision shapes

This commit is contained in:
Danil Alexeev 2023-01-29 13:07:11 +03:00
parent d01ac9c736
commit 5195f723b9
No known key found for this signature in database
GPG key ID: 124453E157DA8DC7
6 changed files with 19 additions and 21 deletions

View file

@ -79,11 +79,7 @@ void RectangleShape2D::draw(const RID &p_to_rid, const Color &p_color) {
stroke_points.write[3] = Vector2(-size.x, size.y) * 0.5;
stroke_points.write[4] = -size * 0.5;
Vector<Color> stroke_colors;
stroke_colors.resize(5);
for (int i = 0; i < 5; i++) {
stroke_colors.write[i] = (p_color);
}
Vector<Color> stroke_colors = { Color(p_color, 1.0) };
RenderingServer::get_singleton()->canvas_item_add_polyline(p_to_rid, stroke_points, stroke_colors);
}