GSDP:GAM100/CProcessing/vec2 set()

From Inside
Jump to: navigation, search

vec2_set()

Description

Manually create a Vec2 vector by inputting its' two values.

Parameters

vec2_set(float x, float y)

  • x - (float) X value for the new Vec2.
  • y - (float) Y value for the new Vec2.

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);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>