summaryrefslogtreecommitdiff
path: root/frontend/shared_cpp
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2021-04-18 15:10:25 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2021-04-18 15:10:25 -0400
commitdb4bcc0073fa1042e9779453af1dcdef7582fbd1 (patch)
tree752f51d9b7e95c0c7ed3d8d5216f23f21627050c /frontend/shared_cpp
parente7c1e9cc3a90f3e5f638f43f21054a4032f9d9f8 (diff)
Have 2D pill collisions working pretty well now
Diffstat (limited to 'frontend/shared_cpp')
-rw-r--r--frontend/shared_cpp/WebglHelper.h6
-rw-r--r--frontend/shared_cpp/mathlib.h7
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);
}