GSDP:GAM100/CProcessing/vec2 set()
From Inside
< GSDP:GAM100 | CProcessing
vec2_set()
Description
Manually create a Vec2 vector by inputting its' two values.
Parameters
vec2_set(float x, float y)
Example
Vec2 random_v;
void init()
{
textFont(defaultFont, 30.0f);
fill(color(0, 0, 0, 255));
random_v = vec2_set(randomRangeFloat(0, 50), randomRangeFloat(0, 50));
}
void update()
{
background(color(255, 255, 255, 255));
// Print out the random vector
text("Random: ", 0, 30);
char matrix[128] = { 0 };
sprintf_s(matrix, 128, "[%.0f]\n[%.0f]\n",
random_v.x, random_v.y);
textBox(matrix, 175, 30, 200);
}