diff options
| author | Matthew Kosarek <mattkae@protonmail.com> | 2021-04-18 15:10:25 -0400 |
|---|---|---|
| committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-04-18 15:10:25 -0400 |
| commit | db4bcc0073fa1042e9779453af1dcdef7582fbd1 (patch) | |
| tree | 752f51d9b7e95c0c7ed3d8d5216f23f21627050c /frontend/shared_cpp/mathlib.h | |
| parent | e7c1e9cc3a90f3e5f638f43f21054a4032f9d9f8 (diff) | |
Have 2D pill collisions working pretty well now
Diffstat (limited to 'frontend/shared_cpp/mathlib.h')
| -rw-r--r-- | frontend/shared_cpp/mathlib.h | 7 |
1 files changed, 7 insertions, 0 deletions
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); } |
