summary refs log tree commit diff
path: root/src/Common/Lambda.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-11-21 02:28:00 +0100
committerMel <einebeere@gmail.com>2023-11-21 02:28:00 +0100
commitca8b16620ec207f2b32edd1f5d46f7b0bfb0a14c (patch)
tree02746322c4229431e36b892f11f07a81ce21e439 /src/Common/Lambda.hpp
parent272e6a63df7369e5afcb16c5a6c14f7dd6a75893 (diff)
downloadmeowcraft-ca8b16620ec207f2b32edd1f5d46f7b0bfb0a14c.tar.zst
meowcraft-ca8b16620ec207f2b32edd1f5d46f7b0bfb0a14c.zip
Clumsy non-swept AABB collision system for Player
Diffstat (limited to 'src/Common/Lambda.hpp')
-rw-r--r--src/Common/Lambda.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Common/Lambda.hpp b/src/Common/Lambda.hpp
new file mode 100644
index 0000000..8bcfd89
--- /dev/null
+++ b/src/Common/Lambda.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+#define _LAMBDA_ARG1 auto a
+#define _LAMBDA_ARG2 auto a, auto b
+#define _LAMBDA_ARG3 auto a, auto b, auto c
+
+#define _LAMBDA_PARAM1 a
+#define _LAMBDA_PARAM2 a, b
+#define _LAMBDA_PARAM3 a, b, c
+
+// A macro to create a lambda function around a (usually std) function,
+// where the template arguments aren't properly deduced.
+// Up to 3 arguments are supported.
+#define LAMBDA(f, n) [](_LAMBDA_ARG##n) { return f(_LAMBDA_PARAM##n); }