fix calls to GetRandomValue
This commit is contained in:
parent
9057c47904
commit
0bfc37450c
2 changed files with 58 additions and 58 deletions
|
|
@ -60,9 +60,9 @@ int main(void)
|
|||
// Translate and rotate cubes randomly
|
||||
for (int i = 0; i < MAX_INSTANCES; i++)
|
||||
{
|
||||
Matrix translation = MatrixTranslate((float)GetRandomValue(-50, 50), (float)GetRandomValue(-50, 50), (float)GetRandomValue(-50, 50));
|
||||
Vector3 axis = Vector3Normalize((Vector3){ (float)GetRandomValue(0, 360), (float)GetRandomValue(0, 360), (float)GetRandomValue(0, 360) });
|
||||
float angle = (float)GetRandomValue(0, 180)*DEG2RAD;
|
||||
Matrix translation = MatrixTranslate((float)GetRandomRangeInt(-50, 50), (float)GetRandomRangeInt(-50, 50), (float)GetRandomRangeInt(-50, 50));
|
||||
Vector3 axis = Vector3Normalize((Vector3){ (float)GetRandomRangeInt(0, 360), (float)GetRandomRangeInt(0, 360), (float)GetRandomRangeInt(0, 360) });
|
||||
float angle = (float)GetRandomRangeInt(0, 180)*DEG2RAD;
|
||||
Matrix rotation = MatrixRotate(axis, angle);
|
||||
|
||||
transforms[i] = MatrixMultiply(rotation, translation);
|
||||
|
|
|
|||
|
|
@ -124,14 +124,14 @@ int main(void)
|
|||
// and initialize the shader locations
|
||||
for (int i = 0; i < MAX_SPOTS; i++)
|
||||
{
|
||||
spots[i].position.x = (float)GetRandomValue(64, screenWidth - 64);
|
||||
spots[i].position.y = (float)GetRandomValue(64, screenHeight - 64);
|
||||
spots[i].position.x = (float)GetRandomRangeInt(64, screenWidth - 64);
|
||||
spots[i].position.y = (float)GetRandomRangeInt(64, screenHeight - 64);
|
||||
spots[i].speed = (Vector2){ 0, 0 };
|
||||
|
||||
while ((fabs(spots[i].speed.x) + fabs(spots[i].speed.y)) < 2)
|
||||
{
|
||||
spots[i].speed.x = GetRandomValue(-400, 40) / 10.0f;
|
||||
spots[i].speed.y = GetRandomValue(-400, 40) / 10.0f;
|
||||
spots[i].speed.x = GetRandomRangeInt(-400, 40) / 10.0f;
|
||||
spots[i].speed.y = GetRandomRangeInt(-400, 40) / 10.0f;
|
||||
}
|
||||
|
||||
spots[i].inner = 28.0f * (i + 1);
|
||||
|
|
@ -235,8 +235,8 @@ static void ResetStar(Star *s)
|
|||
|
||||
do
|
||||
{
|
||||
s->speed.x = (float)GetRandomValue(-1000, 1000)/100.0f;
|
||||
s->speed.y = (float)GetRandomValue(-1000, 1000)/100.0f;
|
||||
s->speed.x = (float)GetRandomRangeInt(-1000, 1000)/100.0f;
|
||||
s->speed.y = (float)GetRandomRangeInt(-1000, 1000)/100.0f;
|
||||
|
||||
} while (!(fabs(s->speed.x) + (fabs(s->speed.y) > 1)));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue