diff --git a/src/main.cpp b/src/main.cpp index f343902..0b2f598 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #ifndef CONFIG_AUTOSCALE constexpr @@ -184,8 +185,8 @@ int main() { const float vector_lenght = (speed_pph / 60) * CONFIG_TIME_BASED_VECTOR_LENGHT; draw::line(x_center, y_center, - x_center + (vector_lenght * std::cos(track_rad)), - y_center + (vector_lenght * std::sin(track_rad)), color); + std::clamp(x_center + (vector_lenght * std::cos(track_rad)),0.0f, static_cast(UINT16_MAX)), + std::clamp(y_center + (vector_lenght * std::sin(track_rad)),0.0f,static_cast(UINT16_MAX)), color); #endif draw::rhombus(x_center, y_center, 8 /*TODO: remove magic*/, color);