GSDP:GAM100/CProcessing/PColor

From Inside
Jump to: navigation, search

PColor

Description

PColor is a type that can be used to store a color value in red, green and blue components. The function color() can be used to create a color and you can access the individual color values directly or through getter functions: alpha() , red() , green() , blue() .

Example

void update() 
{
       // Create a PColor
    PColor color1;
    color1.r = 255; // Red
    color1.g = 40;  // Green
    color1.b = 100; // Blue
    color1.a = 255; // Alpha (transparency)

    // Set the background to the given background color
    backgroundColor(color1);

    // create a new color using the color function
    PColor color2 = color(0, 200, 255, 255);

    // set the fill color for shapes to color2
    fillColor(color2);

    // set the rectangles to draw from the CENTER
    rectMode(CENTER);

    // draw a rectangle at the center of the screen, half the size of the screen
    rect(windowWidth / 2.0f, windowHeight / 2.0f, windowWidth / 2.0f, windowHeight / 2.0f);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>