aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index c757489..2c43f90 100644
--- a/src/common.h
+++ b/src/common.h
@@ -24,9 +24,23 @@ typedef int_least32_t i32;
#define FORCE_GRAVITY_DEFAULT 1000.0f
#define FORCE_LINEAR_DAMPING_DEFAULT 0.995f;
+#define ARR_LEN(arr) (sizeof(arr)/sizeof(arr[0]))
+
typedef enum {
SHAPE_CIRCLE,
SHAPE_SQUARE,
SHAPE_RECTANGLE
} shape_t;
+
+shape_t get_random_shape(void)
+{
+ shape_t valid_shapes[] = {
+ SHAPE_CIRCLE,
+ SHAPE_SQUARE,
+ SHAPE_RECTANGLE
+ };
+
+ return valid_shapes(GetRandomValue(0, ARR(valid_shapes)));
+}
+
#endif // COMMON_H