-
Notifications
You must be signed in to change notification settings - Fork 0
/
random.h
39 lines (31 loc) · 826 Bytes
/
random.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _RANDOM_H
#define _RANDOM_H
#include <raylib.h>
#include <stdlib.h>
#define COLOR_COUNT 8
Color colors[] = {
(Color) {0xe3,0xd1,0x96,0xff},
(Color) {0xbf,0xb4,0x69,0xff},
(Color) {219, 188, 140, 0xff},
(Color) {195, 196, 110,0xff},
(Color) {207, 164, 145,0xff},
(Color) {143, 180, 196,0xff},
(Color) {140, 140, 219,0xff},
(Color) {141, 201, 155,0xff}
};
int RandomRange(int min, int max) {
int val = min + (rand() % (max - min + 1));
return val;
}
Vector2 RandomVector(int minX, int maxX, int minY, int maxY) {
return (Vector2) {
RandomRange(minX, maxX),
// Returns a Random vector with
// X = Random between minX and maxX
RandomRange(minY, maxY)
};
}
Color NewColor(int index) {
return colors[index % COLOR_COUNT];
}
#endif