Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap show/resize in KtxGame? #494

Open
Quillraven opened this issue Jan 2, 2025 · 1 comment
Open

Swap show/resize in KtxGame? #494

Quillraven opened this issue Jan 2, 2025 · 1 comment
Labels
app Issues of the ktx-app module

Comments

@Quillraven
Copy link
Contributor

Quillraven commented Jan 2, 2025

Is there a reason why resize and show in KtxGame are called differently than in LibGDX's Game class? Imo it makes more sense to call show first and then resize. Why? At least in my games I usually setup some things in show like listeners, scene2d, etc.. Some of them react to resizing and therefore it makes more sense to call show first before resize.

original LibGDX Game class:

public void setScreen (Screen screen) {
		if (this.screen != null) this.screen.hide();
		this.screen = screen;
		if (this.screen != null) {
			this.screen.show();
			this.screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		}
	}

KtxGame class:

open fun <Type : ScreenType> setScreen(type: Class<Type>) {
    currentScreen.hide()
    currentScreen = getScreen(type)
    currentScreen.resize(Gdx.graphics.width, Gdx.graphics.height)
    currentScreen.show()
  }
@czyzby czyzby added the app Issues of the ktx-app module label Jan 2, 2025
@czyzby
Copy link
Member

czyzby commented Jan 2, 2025

Makes sense, might have missed that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app Issues of the ktx-app module
Projects
None yet
Development

No branches or pull requests

2 participants