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:
parent
ea70c47a1a
commit
b4d8f0b5d1
1 changed files with 475 additions and 359 deletions
|
|
@ -36,14 +36,14 @@ int main(void)
|
|||
int height = 480;
|
||||
|
||||
// Dynamic memory allocation to store pixels data (Color type)
|
||||
Color *pixels = (Color *)malloc(width*height*sizeof(Color));
|
||||
Color4ub *pixels = (Color4ub *)malloc(width*height*sizeof(Color4ub));
|
||||
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
if (((x/32+y/32)/1)%2 == 0) pixels[y*width + x] = ORANGE;
|
||||
else pixels[y*width + x] = GOLD;
|
||||
if (((x/32+y/32)/1)%2 == 0) pixels[y*width + x] = (Color4ub){ 255, 0.62891*255, 0.0, 255 }; // orange
|
||||
else pixels[y*width + x] = (Color4ub){ 255, 0.79297*255, 0.0, 255 };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,4 +92,4 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue