Look into using override fun resize and override fun create? method

This commit is contained in:
2026-03-11 13:00:17 +00:00
parent 4de5a8f88b
commit 1cc46a94fe

View File

@@ -46,17 +46,20 @@ class MainMenu : KtxScreen {
addActor(hostButton)
addActor(joinButton)
}
val lobbyContainer = Container<Actor>(hostOrJoinVerticalGroup).apply {
table.add(this)
}
val lobbyContainer = Container<Actor>(hostOrJoinVerticalGroup)
//region Play
val casualButton = TextButton("Casual", defaultTextButtonStyle).apply {
table.row()
table.add(this)
}
val casualButton = TextButton("Casual", defaultTextButtonStyle)
//endregion
val everythingVerticalGroup = VerticalGroup().apply {
addActor(lobbyContainer)
addActor(casualButton)
table.add(this)
Gdx.app.log("MainMenu", stage.width.toString())
//Gdx.app.log("MainMenu", table.width.toString())
}
private fun update(delta: Float) {
if (hostButton.isPressed) {
Gdx.app.log("MainMenu", "Host button pressed")
@@ -78,6 +81,11 @@ class MainMenu : KtxScreen {
stage.draw()
}
override fun resize(width: Int, height: Int) {
Gdx.app.log("MainMenu", "resize called! New width: $width, new height $height")
everythingVerticalGroup.setSize(width.toFloat(), height.toFloat())
}
override fun dispose() {
stage.dispose()
}