Skip to content

Commit

Permalink
UI: Center preview spacing lines
Browse files Browse the repository at this point in the history
Currently, the spacing lines begin in the middle of the box and then are
their width wide towards one direction. This means that the larger they
are, the more off-center their middle is.
This commit changes them to start at half their width left/top of the
center and end half the width to the right/bottom of the center, putting
the middle in the center.
  • Loading branch information
gxalpha authored and RytoEX committed May 12, 2024
1 parent 67e4853 commit 4165047
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions UI/window-basic-preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1758,13 +1758,16 @@ static void DrawLine(float x1, float y1, float x2, float y2, float thickness,

gs_render_start(true);

gs_vertex2f(x1, y1);
gs_vertex2f(x1 + (xSide * (thickness / scale.x)),
y1 + (ySide * (thickness / scale.y)));
gs_vertex2f(x2 + (xSide * (thickness / scale.x)),
y2 + (ySide * (thickness / scale.y)));
gs_vertex2f(x2, y2);
gs_vertex2f(x1, y1);
gs_vertex2f(x1 - (xSide * (thickness / scale.x) / 2),
y1 + (ySide * (thickness / scale.y) / 2));
gs_vertex2f(x1 + (xSide * (thickness / scale.x) / 2),
y1 - (ySide * (thickness / scale.y) / 2));
gs_vertex2f(x2 + (xSide * (thickness / scale.x) / 2),
y2 + (ySide * (thickness / scale.y) / 2));
gs_vertex2f(x2 - (xSide * (thickness / scale.x) / 2),
y2 - (ySide * (thickness / scale.y) / 2));
gs_vertex2f(x1 - (xSide * (thickness / scale.x) / 2),
y1 + (ySide * (thickness / scale.y) / 2));

gs_vertbuffer_t *line = gs_render_save();

Expand Down

0 comments on commit 4165047

Please sign in to comment.