diff --git a/src/main/kotlin/Colin.kt b/src/main/kotlin/Colin.kt index 03232ad..079e192 100644 --- a/src/main/kotlin/Colin.kt +++ b/src/main/kotlin/Colin.kt @@ -46,6 +46,12 @@ class Colin cam.update() } + fun resize(width: Int, height: Int) + { + cam.viewportWidth = width.toFloat() + cam.viewportHeight = height.toFloat() + } + fun update(deltaTime: Float) { val stick = Controllers.getCurrent()?.let { pad -> diff --git a/src/main/kotlin/Game.kt b/src/main/kotlin/Game.kt index 1d6de77..1878012 100644 --- a/src/main/kotlin/Game.kt +++ b/src/main/kotlin/Game.kt @@ -116,6 +116,14 @@ class Game: ApplicationAdapter() suzanneInstance.transform = Matrix4().translate(3.0f, 1.0f, -3.5f) } + override fun resize(width: Int, height: Int) + { + colin.resize(width, height) + spriteBatch.projectionMatrix.setToOrtho2D(0.0f, 0.0f, + Gdx.graphics.getWidth().toFloat(), + Gdx.graphics.getHeight().toFloat()); + } + private fun update(deltaTime: Float) { colin.update(deltaTime) diff --git a/src/main/kotlin/Program.kt b/src/main/kotlin/Program.kt index 0be1989..9fa929c 100644 --- a/src/main/kotlin/Program.kt +++ b/src/main/kotlin/Program.kt @@ -14,6 +14,6 @@ fun main() //conf.useVsync(false) //conf.setForegroundFPS(300) conf.setWindowedMode(1280, 720) - conf.setResizable(false) + conf.setResizable(true) Lwjgl3Application(Game(), conf) }