GSDP:GAM100/CProcessing/CP Vector Set()

From Inside
Jump to: navigation, search

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

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>