From 6b9f686913efc3725b2690033cd4f398e07076ba Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 3 Jul 2021 00:49:03 +0200 Subject: Add project source code --- src/util/inc/util.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/util/inc/util.h (limited to 'src/util/inc') 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 + +#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 */ -- cgit v1.2.3