mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 14:41:49 +01:00
Fix digging
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include <iostream>
|
||||
#include "utils.h"
|
||||
|
||||
#include "colors.h"
|
||||
|
||||
#pragma region OpenGLDrawFunctionality
|
||||
void utils::SetColor(const Color4f& color) {
|
||||
glColor4f(color.r, color.g, color.b, color.a);
|
||||
@@ -228,6 +230,18 @@ void utils::DrawPolygon(const Vector2f* pVertices, size_t nrVertices, bool close
|
||||
void utils::FillPolygon(const std::vector<Vector2f>& vertices) {
|
||||
FillPolygon(vertices.data(), vertices.size());
|
||||
}
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void utils::FillPolygon(const Vector2f* pVertices, size_t nrVertices) {
|
||||
glBegin(GL_POLYGON);
|
||||
|
||||
Reference in New Issue
Block a user