Skip to content

Commit 2b72fe1

Browse files
committed
fix: draw velocity graph background first
1 parent 8e86e3b commit 2b72fe1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/Features/Hud/VelocityGraph.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ void VelocityGraph::Paint(int slot) {
8282
Vector2<int>(sar_velocitygraph_x.GetInt(), sar_velocitygraph_y.GetInt());
8383
if (graphPos.y < 0) graphPos.y += y;
8484

85+
if (sar_velocitygraph_background.GetBool()) {
86+
surface->DrawRect({0, 0, 0, 192}, graphPos - Vector2<int>(5, 150 + 5), graphPos + Vector2<int>(5 + 500, 5));
87+
}
88+
8589
bool should_draw_takeoff = (!last_on_ground[slot] || take_off_display_timeout[slot] > engine->GetClientTime()) && sar_velocitygraph_text_groundspeed.GetBool();
8690
int recentSpeed = velocityStamps[slot][velocityStamps[slot].size - 10].speed;
8791
Color c = Color(30, 255, 109);
@@ -127,18 +131,18 @@ void VelocityGraph::Paint(int slot) {
127131
graphPos + Vector2<int>(i, -next_speed),
128132
Color(255, 255, 255));
129133
}
130-
131-
if (sar_velocitygraph_background.GetBool())
132-
surface->DrawRect({0, 0, 0, 192}, graphPos - Vector2<int>(5, 150 + 5), graphPos + Vector2<int>(5 + 500, 5));
133134
}
135+
134136
bool VelocityGraph::GetCurrentSize(int &xSize, int &ySize) {
135137
return false;
136138
}
139+
137140
ON_EVENT(SESSION_START) {
138141
for (int slot = 0; slot < 2; slot++) {
139142
if (take_off[slot] != 0) ClearData(slot);
140143
}
141144
}
145+
142146
ON_EVENT(PROCESS_MOVEMENT) {
143147
if (!velocityGraph->ShouldDraw()) {
144148
if (take_off[event.slot] != 0) ClearData(event.slot);

0 commit comments

Comments
 (0)