Difference between revisions of "GSDP:GAM100/CProcessing/vec2 set()"

From Inside
Jump to: navigation, search
>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,...)
 
>Zachary.logsdon
 
Line 2: Line 2:
 
= vec2_set() =
 
= vec2_set() =
 
== Description ==
 
== Description ==
Manually create a [[GSDP:GAM100/CProcessing/Vec2|Vec2]] vector by inputting it's two values.
+
Manually create a [[GSDP:GAM100/CProcessing/Vec2|Vec2]] vector by inputting its' two values.
  
 
==== Parameters ====
 
==== Parameters ====

Latest revision as of 08:51, 1 July 2019

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:>