File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ _See also: [the official libGDX changelog](https://github.com/libgdx/libgdx/blob
55- ** [ UPDATE] ** Updated to libGDX 1.13.1.
66- ** [ UPDATE] ** Updated to Kotlin 2.1.10.
77- ** [ UPDATE] ** Updated to Kotlin Coroutines 1.10.1.
8+ - ** [ CHANGE] ** (` ktx-app ` ) ` KtxGame ` now calls ` resize ` _ after_ ` show ` when ` create ` or ` setScreen ` are called.
9+ This behavior now matches the official ` Game ` implementation.
810
911#### 1.12.1-rc2
1012
Original file line number Diff line number Diff line change @@ -41,13 +41,13 @@ open class KtxGame<ScreenType : Screen>(
4141 get() = currentScreen as ScreenType
4242
4343 /* *
44- * By default, this method resizes ([Screen.resize ]) and shows ([Screen.show]) initial view. You do not have to call
44+ * By default, this method shows ([Screen.show ]) and resizes ([Screen.resize]) the initial view. You do not have to call
4545 * super if you used [setScreen] in the overridden [create] method or the selected first view does not need to be
4646 * resized and showed before usage.
4747 */
4848 override fun create () {
49- currentScreen.resize(Gdx .graphics.width, Gdx .graphics.height)
5049 currentScreen.show()
50+ currentScreen.resize(Gdx .graphics.width, Gdx .graphics.height)
5151 }
5252
5353 override fun render () {
@@ -118,8 +118,8 @@ open class KtxGame<ScreenType : Screen>(
118118 open fun <Type : ScreenType > setScreen (type : Class <Type >) {
119119 currentScreen.hide()
120120 currentScreen = getScreen(type)
121- currentScreen.resize(Gdx .graphics.width, Gdx .graphics.height)
122121 currentScreen.show()
122+ currentScreen.resize(Gdx .graphics.width, Gdx .graphics.height)
123123 }
124124
125125 /* *
Original file line number Diff line number Diff line change @@ -43,8 +43,8 @@ class KtxGameTest {
4343 game.create()
4444
4545 assertSame(screen, game.shownScreen)
46- verify(screen).resize(800 , 600 )
4746 verify(screen).show()
47+ verify(screen).resize(800 , 600 )
4848 // addScreen must be called manually to keep firstScreen in context - should not contain initial Screen:
4949 assertFalse(game.containsScreen<Screen >())
5050 }
@@ -180,8 +180,8 @@ class KtxGameTest {
180180
181181 assertSame(secondScreen, game.shownScreen)
182182 verify(firstScreen).hide()
183- verify(secondScreen).resize(800 , 600 )
184183 verify(secondScreen).show()
184+ verify(secondScreen).resize(800 , 600 )
185185 }
186186
187187 @Test(expected = GdxRuntimeException ::class )
You can’t perform that action at this time.
0 commit comments