GSDP:GAM100/CProcessing/CP Vector Set()
From Inside
< GSDP:GAM100 | CProcessing
CP_Vector_Set()
Description
Manually create a CP_Vector by inputting its two values
Parameters
CP_Vector_Set(float x, float y)
- x - (float) - x-value of vector
- y - (float) - y-value of vector
Example
CP_Vector random_v;
void init()
{
CP_Font_Set(CP_Font_GetDefault());
CP_Settings_Fill(CP_Color_Create(0, 0, 0, 255));
random_v = CP_Vector_Set(CP_Random_RangeFloat(0, 50), CP_Random_RangeFloat(0, 50));
}
void update()
{
CP_Settings_Background(CP_Color_Create(255, 255, 255, 255));
// Print out the random vector
CP_Font_DrawText("Random: ", 0, 30);
char matrix[128] = { 0 };
sprintf_s(matrix, 128, "[%.0f]\n[%.0f]\n",
random_v.x, random_v.y);
CP_Font_DrawTextBox(matrix, 175, 30, 200);
}
Related
- Main Page
- CP_Vector_Set()
- CP_Vector_Zero()
- CP_Vector_Negate()
- CP_Vector_Add()
- CP_Vector_Subtract()
- CP_Vector_Normalize()
- CP_Vector_Scale()
- CP_Vector_MatrixMultiply()
- CP_Vector_Length()
- CP_Vector_Distance()
- CP_Vector_DotProduct()
- CP_Vector_CrossProduct()
- CP_Vector_Angle()
- CP_Settings_Fill()
- CP_Settings_Background()
- CP_Color_Create()
- CP_Font_Set()
- CP_Font_GetDefault()
- CP_Font_DrawTextBox()
- CP_Font_DrawText()