diff --git a/src/main/kotlin/glm_/vec2/Vec2i.kt b/src/main/kotlin/glm_/vec2/Vec2i.kt index 4e27c85c..74b8910c 100644 --- a/src/main/kotlin/glm_/vec2/Vec2i.kt +++ b/src/main/kotlin/glm_/vec2/Vec2i.kt @@ -252,6 +252,7 @@ class Vec2i(@JvmField var ofs: Int, @JvmField var array: IntArray) : Vec2t, infix operator fun times(b: Int) = times(Vec2i(), this, b, b) + infix operator fun times(b: Float) = times(Vec2i(), this, b, b) infix operator fun times(b: Vec2i) = times(Vec2i(), this, b.x, b.y) @JvmOverloads @@ -350,6 +351,7 @@ class Vec2i(@JvmField var ofs: Int, @JvmField var array: IntArray) : Vec2t, infix operator fun times(b: Number) = times(Vec2i(), this, b.i, b.i) infix operator fun times(b: Vec2t) = times(Vec2i(), this, b._x.i, b._y.i) + infix operator fun times(b: Vec2) = times(Vec2i(), this, b.x, b.y) @JvmOverloads fun times(bX: Number, bY: Number, res: Vec2i = Vec2i()) = times(res, this, bX.i, bY.i) diff --git a/src/main/kotlin/glm_/vec2/operators/opVec2i.kt b/src/main/kotlin/glm_/vec2/operators/opVec2i.kt index be3ea51e..4c779b2d 100644 --- a/src/main/kotlin/glm_/vec2/operators/opVec2i.kt +++ b/src/main/kotlin/glm_/vec2/operators/opVec2i.kt @@ -37,6 +37,12 @@ interface opVec2i { return res } + fun times(res: Vec2i, a: Vec2i, bX: Float, bY: Float): Vec2i { + res.x = (a.x * bX).toInt() + res.y = (a.y * bY).toInt() + return res + } + fun div(res: Vec2i, a: Vec2i, bX: Int, bY: Int): Vec2i { res.x = a.x / bX res.y = a.y / bY @@ -149,4 +155,4 @@ infix fun Number.divAssign(b: Vec2i) = div(b, this.i, this.i, b) infix operator fun Number.rem(b: Vec2i) = rem(Vec2i(), this.i, this.i, b) fun Number.rem(b: Vec2i, res: Vec2i) = rem(res, b, this.i, this.i) -infix fun Number.remAssign(b: Vec2i) = rem(b, this.i, this.i, b) \ No newline at end of file +infix fun Number.remAssign(b: Vec2i) = rem(b, this.i, this.i, b)