support window resizing correctly
This commit is contained in:
@ -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 ->
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user