GSDP:GAM100/CProcessing/rect()
From Inside
< GSDP:GAM100 | CProcessing
rect()
Description
This is a function that draws a rectangle on the screen at a specified point with a specified width and height.
Parameters
rect(x, y, w, h)
- x - (float) the horizontal position of the rectangle
- y - (float) the vertical position of the rectangle
- w - (float) the width of the rectangle
- h - (float) the height of the rectangle
Example
void update()
{
// Clear the background to a blue color
background(color(20, 200, 255, 255));
// Draw a rectangle at the point (100, 100)
rect(100.0f, 100.0f, 50.0f, 50.0f);
// Draw a rectangle at the mouse position
rect(mouseX, mouseY, 25.0f, 25.0f);
}