GSDP:GAM100/CProcessing/vec2 set()
From Inside
< GSDP:GAM100 | CProcessing
Revision as of 08:51, 1 July 2019 by >Zachary.logsdon (New page: {{GSDP:GAM100API.css}} = vec2_set() = == Description == Manually create a Vec2 vector by inputting it's two values. ==== Parameters ==== vec2_set(float x,...)
vec2_set()
Description
Manually create a Vec2 vector by inputting it's 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);
}