littlekt: update to version 0.3.0

kotlin: update to version 1.7.0
This commit is contained in:
LeHaine 2022-07-20 11:58:48 -04:00
parent 05d2689c72
commit 1f0def0f1c
No known key found for this signature in database
GPG key ID: 8AEC4F9B9F33E9AC
2 changed files with 21 additions and 6 deletions

View file

@ -4,24 +4,39 @@ import com.lehaine.littlekt.Context
import com.lehaine.littlekt.ContextListener
import com.lehaine.littlekt.graphics.*
import com.lehaine.littlekt.graphics.gl.ClearBufferMask
import com.lehaine.littlekt.graphics.shape.ShapeRenderer
import com.lehaine.littlekt.math.geom.degrees
import com.lehaine.littlekt.math.geom.radians
import com.lehaine.littlekt.util.viewport.ExtendViewport
import kotlin.time.Duration.Companion.milliseconds
class Game(context: Context) : ContextListener(context) {
override suspend fun Context.start() {
val batch = SpriteBatch(this)
val camera = OrthographicCamera(graphics.width, graphics.height)
val shapeRenderer = ShapeRenderer(batch)
val viewport = ExtendViewport(960, 540)
val camera = viewport.camera
var rotation = 0.radians
var rotationTimer = 0.milliseconds
onResize { width, height ->
camera.update(width, height, context)
viewport.update(width, height, context)
}
onRender {
onRender { dt ->
gl.clearColor(Color.DARK_GRAY)
gl.clear(ClearBufferMask.COLOR_BUFFER_BIT)
batch.use(camera.viewProjection) {
Fonts.default.draw(it, "Hello LittleKt!", 0f, 0f)
shapeRenderer.filledRectangle(-50f, 50f, 100f, 50f, rotation, color = Color.RED.toFloatBits())
}
rotationTimer += dt
if (rotationTimer > 10.milliseconds) {
rotationTimer = 0.milliseconds
rotation += 1.degrees
}
}
}

View file

@ -1,11 +1,11 @@
[versions]
plugin-android = "7.0.4"
plugin-kotlin = "1.6.10"
plugin-kotlin = "1.7.0"
kotlinx-html = "0.7.2"
kotlinx-coroutines = "1.6.0-native-mt"
kotlinx-coroutines = "1.6.4"
littlekt = "0.2.0"
littlekt = "0.3.0"
[libraries]
plugin-android = { module = "com.android.tools.build:gradle", version.ref = "plugin-android" }