changed Color struct to 4 floats

GetRandomValue returns floats
added GetRandomInt
added Color4ub rgba 0-255
edited examples to work
colour palette values could bare a double check!
This commit is contained in:
Chris 2019-10-21 20:17:48 +01:00
commit b4d8f0b5d1

View file

@ -34,7 +34,7 @@ int main(void)
SetTextureFilter(target.texture, FILTER_BILINEAR); // Texture scale filter to use
Color colors[10] = { 0 };
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(.5, .95), GetRandomValue(.2, .6), GetRandomValue(.05, .4), 1 };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@ -50,7 +50,7 @@ int main(void)
if (IsKeyPressed(KEY_SPACE))
{
// Recalculate random colors for the bars
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(.5, .95), GetRandomValue(.2, .6), GetRandomValue(.05, .4), 1 };
}
//----------------------------------------------------------------------------------