Vec2

value class Vec2(val value: Long)

Class that represents a 2D vector.

(revised 1.5) Vec2's are now purely syntactical sugar which are inlined and have no runtime overhead. Their representation in internal data structures has been replaced with floats instead.

Since

1.1.0

See also

Constructors

Link copied to clipboard
constructor(x: Float, y: Float)
constructor(value: Long)

Types

Link copied to clipboard
object Constants

Properties

Link copied to clipboard
Link copied to clipboard
val hex: String
Link copied to clipboard
Link copied to clipboard

Checks if the value is positive and non-zero.

Link copied to clipboard
Link copied to clipboard
val value: Long
Link copied to clipboard
val x: Float
Link copied to clipboard
val y: Float

Functions

Link copied to clipboard
@JvmName(name = "coerceAtLeast")
fun coerceAtLeast(other: Vec2): Vec2
Link copied to clipboard
@JvmName(name = "coerceAtMost")
fun coerceAtMost(other: Vec2): Vec2
Link copied to clipboard
@JvmName(name = "coerceIn")
fun coerceIn(min: Vec2, max: Vec2): Vec2
Link copied to clipboard
@JvmName(name = "compareTo")
operator fun compareTo(size: Vec2): Int
Link copied to clipboard
inline operator fun component1(): Float
Link copied to clipboard
inline operator fun component2(): Float
Link copied to clipboard
@JvmName(name = "div")
operator fun div(other: Vec2): Vec2
Link copied to clipboard
operator fun get(index: Int): Float
Link copied to clipboard
@JvmName(name = "minus")
operator fun minus(other: Vec2): Vec2
Link copied to clipboard
@JvmName(name = "plus")
operator fun plus(other: Vec2): Vec2
Link copied to clipboard
@JvmName(name = "rem")
operator fun rem(other: Vec2): Vec2
Link copied to clipboard
@JvmName(name = "simplifyRatio")
fun Vec2.simplifyRatio(): Vec2

Simplify a ratio of two integers.

Link copied to clipboard
@JvmName(name = "times")
operator fun times(other: Vec2): Vec2
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
@JvmName(name = "toVec4")
fun Vec2.toVec4(): Vec4

Create a Vec4 from a Vec2, copying the Vec2.x and Vec2.y values to Vec4.w and Vec4.h respectively.