aboutsummaryrefslogtreecommitdiff
path: root/src/util/inc
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2021-07-03 00:49:03 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-03-30 08:20:20 +0200
commit8c10334252821b6310cf744218f7ad8bed7917f2 (patch)
treef6f11d71eac56fa834783ef54a977b80f2e5efc2 /src/util/inc
parentfc9beffe0103a80bf883f85b7ae09dc42b7af50e (diff)
downloadrts-8c10334252821b6310cf744218f7ad8bed7917f2.tar.gz
Add project source code
Diffstat (limited to 'src/util/inc')
-rw-r--r--src/util/inc/util.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/util/inc/util.h b/src/util/inc/util.h
new file mode 100644
index 0000000..e42c5b2
--- /dev/null
+++ b/src/util/inc/util.h
@@ -0,0 +1,31 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#define UTIL_STATIC_ASSERT(exp, msg) _Static_assert(exp, msg)
+#else
+#define UTIL_STATIC_ASSERT__(exp, l, msg) enum {static_assert##l##__ = 1 / !!(exp)}
+#define UTIL_STATIC_ASSERT_(exp, l, msg) UTIL_STATIC_ASSERT__(exp, l, msg)
+#define UTIL_STATIC_ASSERT(exp, msg) UTIL_STATIC_ASSERT_(exp, __LINE__, msg)
+#endif
+
+struct util_rect
+{
+ unsigned long x, y;
+ short w, h;
+};
+
+bool util_collision(const struct util_rect *a, const struct util_rect *b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* UTIL_H */