GSDP:GAM100/CProcessing/vec2()
From Inside
< GSDP:GAM100 | CProcessing
vec2()
Description
Create a Vec2 default vector. This is the same as the Vec2 zero vector that you get from calling vec2_zero().
Example
Vec2 default_v;
Vec2 zero_v;
void init()
{
textFont(defaultFont, 30.0f);
fill(color(0, 0, 0, 255));
default_v = vec2();
zero_v = vec2_zero();
}
void update()
{
background(color(255, 255, 255, 255));
// Print out the default vector
text("Default: ", 0, 30);
char matrix[128] = {0};
sprintf_s(matrix, 128, "[%.0f]\n[%.0f]\n",
default_v.x, default_v.y);
textBox(matrix, 175, 30, 200);
// Print out the zero vector
text("Zero: ", 0, 150);
sprintf_s(matrix, 128, "[%.0f]\n[%.0f]\n",
zero_v.x, zero_v.y);
textBox(matrix, 175, 150, 200);
text("They are the same!", 0, 300);
}