GSDP:GAM100/CProcessing/CP Graphics DrawRect()
From Inside
< GSDP:GAM100 | CProcessing
CP_Graphics_DrawRect()
Description
This is a function that draws a rectangle on the screen at a specified point with a specified width and height.
Parameters
CP_Graphics_DrawRect(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
CP_Settings_Background(CP_Color_Create(20, 200, 255, 255));
// Draw a rectangle at the point (100, 100)
CP_Graphics_DrawRect(100.0f, 100.0f, 50.0f, 50.0f);
// Draw a rectangle at the mouse position
CP_Graphics_DrawRect(mouseX, mouseY, 25.0f, 25.0f);
}
Related
- Main Page
- CP_Graphics_DrawEllipse()
- CP_Graphics_DrawCircle()
- CP_Graphics_DrawLine()
- CP_Graphics_DrawPoint()
- CP_Graphics_DrawTriangle()
- CP_Graphics_DrawQuad()
- CP_Graphics_DrawRectAdvanced()
- CP_Graphics_DrawEllipseAdvanced()
- CP_Graphics_DrawLineAdvanced()
- CP_Graphics_DrawTriangleAdvanced()
- CP_Graphics_DrawQuadAdvanced()
- CP_Graphics_BeginShape()
- CP_Graphics_AddVertex()
- CP_Graphics_EndShape()
- CP_Settings_Background()
- CP_Color_Create()