mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 14:41:49 +01:00
Added Buildings
Fixed rendering bugs with edges
This commit is contained in:
@@ -232,15 +232,16 @@ void utils::FillPolygon(const std::vector<Vector2f>& vertices) {
|
||||
}
|
||||
void utils::DrawArrow(const Vector2f& start, const Vector2f& end, float lineWidth, float arrowSize) {
|
||||
// Origin is bottom left
|
||||
|
||||
utils::DrawLine(start, end);
|
||||
Vector2f arrowEnd = end - start;
|
||||
Vector2f dir = end - start;
|
||||
const float arrowAngle = atan2f(end.y - start.y, end.x - start.x);
|
||||
const float arrowAngle1 = arrowAngle + g_Pi + 0.4f;
|
||||
const float arrowAngle2 = arrowAngle + g_Pi - 0.4f;
|
||||
|
||||
utils::SetColor(Colors::RED);
|
||||
utils::DrawLine(end, end + Vector2f{ dir.y, -dir.x }.Normalized() * arrowSize);
|
||||
utils::DrawLine(end, end + Vector2f{ -dir.y, dir.x }.Normalized() * arrowSize);
|
||||
|
||||
|
||||
const Vector2f arrow1 { end.x + arrowSize * cosf(arrowAngle1), end.y + arrowSize * sinf(arrowAngle1) };
|
||||
const Vector2f arrow2 { end.x + arrowSize * cosf(arrowAngle2), end.y + arrowSize * sinf(arrowAngle2) };
|
||||
utils::DrawLine(end, arrow1);
|
||||
utils::DrawLine(end, arrow2);
|
||||
}
|
||||
|
||||
void utils::FillPolygon(const Vector2f* pVertices, size_t nrVertices) {
|
||||
|
||||
Reference in New Issue
Block a user