mirror of
https://github.com/littlektframework/littlekt-game-template.git
synced 2025-03-19 05:40:29 -06:00
game: update to truly center text and rect
This commit is contained in:
parent
511b1fb9db
commit
6ed7d19c96
1 changed files with 5 additions and 3 deletions
|
@ -2,10 +2,12 @@ package com.game.template
|
||||||
|
|
||||||
import com.lehaine.littlekt.Context
|
import com.lehaine.littlekt.Context
|
||||||
import com.lehaine.littlekt.ContextListener
|
import com.lehaine.littlekt.ContextListener
|
||||||
|
import com.lehaine.littlekt.graph.node.resource.HAlign
|
||||||
import com.lehaine.littlekt.graphics.Color
|
import com.lehaine.littlekt.graphics.Color
|
||||||
import com.lehaine.littlekt.graphics.Fonts
|
import com.lehaine.littlekt.graphics.Fonts
|
||||||
import com.lehaine.littlekt.graphics.g2d.*
|
import com.lehaine.littlekt.graphics.g2d.SpriteBatch
|
||||||
import com.lehaine.littlekt.graphics.g2d.shape.ShapeRenderer
|
import com.lehaine.littlekt.graphics.g2d.shape.ShapeRenderer
|
||||||
|
import com.lehaine.littlekt.graphics.g2d.use
|
||||||
import com.lehaine.littlekt.graphics.gl.ClearBufferMask
|
import com.lehaine.littlekt.graphics.gl.ClearBufferMask
|
||||||
import com.lehaine.littlekt.graphics.toFloatBits
|
import com.lehaine.littlekt.graphics.toFloatBits
|
||||||
import com.lehaine.littlekt.math.geom.degrees
|
import com.lehaine.littlekt.math.geom.degrees
|
||||||
|
@ -33,8 +35,8 @@ class Game(context: Context) : ContextListener(context) {
|
||||||
gl.clear(ClearBufferMask.COLOR_BUFFER_BIT)
|
gl.clear(ClearBufferMask.COLOR_BUFFER_BIT)
|
||||||
|
|
||||||
batch.use(camera.viewProjection) {
|
batch.use(camera.viewProjection) {
|
||||||
Fonts.default.draw(it, "Hello LittleKt!", -15f, 0f)
|
Fonts.default.draw(it, "Hello LittleKt!", 0f, 0f, align = HAlign.CENTER)
|
||||||
shapeRenderer.filledRectangle(-25f, 50f, 100f, 50f, rotation, color = Color.RED.toFloatBits())
|
shapeRenderer.filledRectangle(-50f, 50f, 100f, 50f, rotation, color = Color.RED.toFloatBits())
|
||||||
}
|
}
|
||||||
rotationTimer += dt
|
rotationTimer += dt
|
||||||
if (rotationTimer > 10.milliseconds) {
|
if (rotationTimer > 10.milliseconds) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue