diff options
Diffstat (limited to 'frontend/shared_cpp')
-rw-r--r-- | frontend/shared_cpp/WebglHelper.h | 6 | ||||
-rw-r--r-- | frontend/shared_cpp/mathlib.h | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/frontend/shared_cpp/WebglHelper.h b/frontend/shared_cpp/WebglHelper.h new file mode 100644 index 0000000..dbdb23f --- /dev/null +++ b/frontend/shared_cpp/WebglHelper.h @@ -0,0 +1,6 @@ +#pragma once +#include "mathlib.h" + +struct OrthographicRenderer; + +void render2DArrow(Vector2 start, Vector2 end, OrthographicRenderer* renderer); diff --git a/frontend/shared_cpp/mathlib.h b/frontend/shared_cpp/mathlib.h index 383c880..b9f3fee 100644 --- a/frontend/shared_cpp/mathlib.h +++ b/frontend/shared_cpp/mathlib.h @@ -57,6 +57,13 @@ struct Vector2 { return { -y, x }; } + Vector2 rotate(float angle) { + return { + x * cosf(angle) - y * sinf(angle), + x * sinf(angle) + y * cosf(angle) + }; + } + void printDebug(const char* name) { printf("%s=Vector2(%f, %f)\n", name, x, y); } |