1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix draw_multiline_colors usage

This commit is contained in:
Danil Alexeev
2023-05-12 07:50:58 +03:00
parent fb10f45efe
commit cc44d75cd8
6 changed files with 65 additions and 78 deletions

View File

@@ -33,19 +33,15 @@
void Marker2D::_draw_cross() {
const real_t extents = get_gizmo_extents();
// Add more points to create a "hard stop" in the color gradient.
PackedVector2Array points_x = {
PackedVector2Array points = {
Point2(+extents, 0),
Point2(),
Point2(),
Point2(-extents, 0)
};
PackedVector2Array points_y = {
Point2(-extents, 0),
Point2(0, +extents),
Point2(),
Point2(),
Point2(0, -extents)
Point2(0, -extents),
};
// Use the axis color which is brighter for the positive axis.
@@ -54,22 +50,15 @@ void Marker2D::_draw_cross() {
// (which can be important depending on how it's used).
// Axis colors are taken from `axis_x_color` and `axis_y_color` (defined in `editor/editor_themes.cpp`).
const Color color_x = Color(0.96, 0.20, 0.32);
PackedColorArray colors_x = {
color_x,
color_x,
color_x.lerp(Color(0, 0, 0), 0.5),
color_x.lerp(Color(0, 0, 0), 0.5)
};
draw_multiline_colors(points_x, colors_x);
const Color color_y = Color(0.53, 0.84, 0.01);
PackedColorArray colors_y = {
PackedColorArray colors = {
color_x,
color_x.darkened(0.5),
color_y,
color_y,
color_y.lerp(Color(0, 0, 0), 0.5),
color_y.lerp(Color(0, 0, 0), 0.5)
color_y.darkened(0.5),
};
draw_multiline_colors(points_y, colors_y);
draw_multiline_colors(points, colors);
}
#ifdef TOOLS_ENABLED