Vectors

Retro Gadgets has vec2 and vec3 vector object types which are used for coordinate systems such as drawing images in a VideoChip.

The individual components of each of these types cannot be modified (e.g. setting X or Y individually), they can only be created or read. It can be more useful to store your values separately and only turn them into vector types when necessary.

However, it's useful to note you can apply certain matrix operations to these types like so:

vec2(1,2) * 2 -- returns vec2(2,4)
vec2(1,2) * vec2(2,1) -- returns vec2(2,2)

vec2(1,2) - vec2(1,0) -- returns vec2(0,2)
vec2(1,2) - 1 -- causes RuntimeException

vec2

Global methods

vec2( x number, y number ) vec2

Creates and returns a vec2 vector.

Properties

X number read only

The X component of this vec2 object.

Y number read only

The Y component of this vec2 object.

vec3

Global methods

vec3( x number, y number, z number ) vec3

Creates and returns a vec3 vector.

Properties

X number read only

The X component of this vec3 object.

Y number read only

The Y component of this vec3 object.

Z number read only

The Z component of this vec3 object.