Settings - Polkm105/DesignPatternPractice GitHub Wiki
PARTIAL
This section contains all functions relating to CP_Settings
Table Of Contents
- CP_Settings_Fill
- CP_Settings_NoFill
- CP_Settings_Stroke
- CP_Settings_NoStroke
- CP_Settings_StrokeWeight
- CP_Settings_Tint NEW
- CP_Settings_NoTint NEW
- CP_Settings_AntiAlias NEW
- CP_Settings_LineCapMode NEW
- CP_Settings_LineJointMode NEW
- CP_Settings_RectMode
- CP_Settings_EllipseMode
- CP_Settings_ImageMode
- CP_Settings_BlendMode
- CP_Settings_ImageFilterMode
- CP_Settings_ImageWrapMode
- CP_Settings_TextSize
- CP_Settings_TextAlignment
- CP_Settings_Scale
- CP_Settings_Rotate
- CP_Settings_Translate
- CP_Settings_ApplyMatrix
- CP_Settings_ResetMatrix
- CP_Settings_Save
- CP_Settings_Restore
CP_Settings_Fill
This function sets the color of the next drawn shape or text.
Function
void CP_Settings_Fill(CP_Color c);
Parameters
- c - (CP_Color) the color of the next shape
Return
This function does not return anything.
Example
void update()
{
// Create the color blue
CP_Color myColor = CP_Color_Create(0, 0, 255, 255);
// Set the shape color to blue
CP_Settings_Fill(myColor);
// Draw a rectangle at the origin
CP_Graphics_DrawRect(0, 0, 10.0f, 10.0f);
}
Related
CP_Settings_NoFill
This function draws the next shape without a fill color.
Function
void CP_Settings_NoFill(void);
Parameters
This function has no parameters.
Return
This function does not return anything.
Example
void update()
{
// Do not fill the shape
CP_Settings_NoFill();
// Draw a rectangle at the cursor position
CP_Graphics_DrawRect(mouseX, mouseY, 10.0f, 10.0f);
}
Related
CP_Settings_Stroke
This function sets the color of the stroke for the next drawn shape.
Function
void CP_Settings_Stroke(CP_Color c);
Parameters
- c - (CP_Color) the color to set the stroke to
Return
This function does not return anything.
Example
void update()
{
// Create the color red
CP_Color myColor = CP_Color_Create(255, 0, 0, 255);
// Set the stroke color to red
CP_Settings_Stroke(myColor);
// Draw a circle at the cursor position
CP_Graphics_DrawCircle(CP_Input_GetMouseX(), CP_Input_GetMouseY(), 10.0f);
}
Related
CP_Settings_NoStroke
This function draws the next shape without a stroke.
Function
void CP_Settings_NoStroke(void);
Parameters
This function has no parameters.
Return
This function does not return anything.
Example
void update()
{
// Do not draw a stroke around the next shape
CP_Settings_NoStroke();
// Draw a circle at the cursor position
CP_Graphics_DrawCircle(CP_Input_GetMouseX(), CP_Input_GetMouseY(), 10.0f);
}
Related
CP_Settings_StrokeWeight
This function modifies the thickness of the next drawn shape's stroke.
Function
void CP_Settings_StrokeWeight(float weight);
Parameters
- width - (float) the thickness to set the stroke to
Return
This function does not return anything.
Example
void update()
{
// Sets the stroke of the next drawn shape to 1
CP_Settings_StrokeWeight(1.0f);
// Draw a circle at the origin
CP_Graphics_DrawCircle(0, 0, 10.0f);
}
Related
CP_Settings_Tint
CP_Settings_NoTint
CP_Settings_AntiAlias
CP_Settings_LineCapMode
CP_Settings_LineJointMode
CP_Settings_RectMode
Lets you set the way rectangles will be drawn. Check CP_POSITION_MODE for options on which modes you can set. Defaults to CP_POSITION_CORNER.
Function
void CP_Settings_RectMode(CP_POSITION_MODE mode);
Parameters
mode - This is one of the CP_POSITION_MODE values.
Return
This function does not return anything.
Example
void update()
{
// set the background color to gray
CP_Graphics_ClearBackground(CP_Color_Create(200, 200, 200, 255));
// set the rectangle drawing mode to CENTER
CP_Settings_RectMode(CP_POSITION_CENTER);
// draw a rectangle at the center of the screen, half the size of the screen
CP_Graphics_DrawRect(CP_System_GetWindowWidth() / 2.0f, CP_System_GetWindowHeight() / 2.0f,
CP_System_GetWindowWidth() / 2.0f, CP_System_GetWindowHeight() / 2.0f);
}
Related
- CP_POSITION_MODE
- CP_Graphics_ClearBackground
- CP_Graphics_DrawRect
- CP_Color_Create
- CP_System_GetWindowWidth
- CP_System_GetWindowHeight
CP_Settings_EllipseMode
Lets you set the way ellipses and circles will be drawn. Check CP_POSITION_MODE for options on which modes you can set. Defaults to CP_POSITION_CENTER.
Function
void CP_Settings_EllipseMode(CP_POSITION_MODE mode);
Parameters
mode - This is one of the CP_POSITION_MODE values.
Return
This function does not return anything.
Example
void update()
{
// set the background color to gray
CP_Graphics_ClearBackground(CP_Color_Create(200, 200, 200, 255));
// set the rectangle drawing mode to CENTER
CP_Settings_EllipseMode(CP_POSITION_CENTER);
// draw a rectangle at the center of the screen, half the size of the screen
CP_Graphics_DrawRect(CP_System_GetWindowWidth() / 2.0f, CP_System_GetWindowHeight() / 2.0f,
CP_System_GetWindowWidth() / 2.0f, CP_System_GetWindowHeight() / 2.0f);
}
Related
- CP_POSITION_MODE
- CP_Graphics_ClearBackground
- CP_Graphics_DrawRect
- CP_Color_Create
- CP_System_GetWindowWidth
- CP_System_GetWindowHeight
CP_Settings_ImageMode
Sets the mode to draw an image (similar to a rectangle) with a CP_POSITION_MODE. Defaults to CP_POSITION_CENTER.
Function
void CP_Settings_ImageMode(CP_POSITION_MODE mode);
Parameters
- mode - (CP_POSITION_MODE) The mode to draw images with.
Return
This function does not return anything.
Example
CP_Image justin_face;
void init()
{
justin_face = CP_Image_Load("./Assets/justin1.png");
CP_Settings_ImageMode(CP_POSITION_CORNER);
}
float rotation = 0;
void update()
{
CP_Graphics_ClearBackground(CP_Color_Create(255, 255, 255, 255));
CP_Image_DrawAdvanced(justin_face, CP_Input_GetMouseX(), CP_Input_GetMouseY(), 100, 150, 255, rotation);
rotation++;
}
Related
- CP_Graphics_ClearBackground
- CP_Color_Create
- CP_Image_Load
- CP_Image_DrawAdvanced
- CP_Input_GetMouseX
- CP_Input_GetMouseY