-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
497 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ktx.math | ||
|
||
import com.badlogic.gdx.math.Circle | ||
|
||
/** | ||
* Operator function that allows to deconstruct this circle. | ||
* @return X component. | ||
*/ | ||
operator fun Circle.component1() = this.x | ||
|
||
/** | ||
* Operator function that allows to deconstruct this circle. | ||
* @return Y component. | ||
*/ | ||
operator fun Circle.component2() = this.y | ||
|
||
/** | ||
* Operator function that allows to deconstruct this circle. | ||
* @return Radius component. | ||
*/ | ||
operator fun Circle.component3() = this.radius |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ktx.math | ||
|
||
import com.badlogic.gdx.math.Ellipse | ||
|
||
/** | ||
* Operator function that allows to deconstruct this ellipse. | ||
* @return X component. | ||
*/ | ||
operator fun Ellipse.component1() = this.x | ||
|
||
/** | ||
* Operator function that allows to deconstruct this ellipse. | ||
* @return Y component. | ||
*/ | ||
operator fun Ellipse.component2() = this.y | ||
|
||
/** | ||
* Operator function that allows to deconstruct this ellipse. | ||
* @return Width component. | ||
*/ | ||
operator fun Ellipse.component3() = this.width | ||
|
||
/** | ||
* Operator function that allows to deconstruct this ellipse. | ||
* @return Height component. | ||
*/ | ||
operator fun Ellipse.component4() = this.height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ktx.math | ||
|
||
import com.badlogic.gdx.math.Polygon | ||
|
||
/** | ||
* Operator function that allows to deconstruct this polygon. | ||
* @return X component. | ||
*/ | ||
operator fun Polygon.component1() = this.x | ||
|
||
/** | ||
* Operator function that allows to deconstruct this polygon. | ||
* @return Y component. | ||
*/ | ||
operator fun Polygon.component2() = this.y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ktx.math | ||
|
||
import com.badlogic.gdx.math.Polyline | ||
|
||
/** | ||
* Operator function that allows to deconstruct this polyline. | ||
* @return X component. | ||
*/ | ||
operator fun Polyline.component1() = this.x | ||
|
||
/** | ||
* Operator function that allows to deconstruct this polyline. | ||
* @return Y component. | ||
*/ | ||
operator fun Polyline.component2() = this.y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ktx.math | ||
|
||
import com.badlogic.gdx.math.Rectangle | ||
|
||
/** | ||
* Operator function that allows to deconstruct this rectangle. | ||
* @return X component. | ||
*/ | ||
operator fun Rectangle.component1() = this.x | ||
|
||
/** | ||
* Operator function that allows to deconstruct this rectangle. | ||
* @return Y component. | ||
*/ | ||
operator fun Rectangle.component2() = this.y | ||
|
||
/** | ||
* Operator function that allows to deconstruct this rectangle. | ||
* @return Width component. | ||
*/ | ||
operator fun Rectangle.component3() = this.width | ||
|
||
/** | ||
* Operator function that allows to deconstruct this rectangle. | ||
* @return Height component. | ||
*/ | ||
operator fun Rectangle.component4() = this.height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package ktx.math | ||
|
||
import com.badlogic.gdx.math.Circle | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class CircleTest { | ||
|
||
@Test | ||
fun `should destructure Circle`() { | ||
val circle = Circle(1f, 2f, 3f) | ||
|
||
val (x, y, radius) = circle | ||
|
||
assertEquals(1f, x) | ||
assertEquals(2f, y) | ||
assertEquals(3f, radius) | ||
} | ||
|
||
} |
Oops, something went wrong.