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

Reimplement GameConfigController window sizing and centering #48

Open
miketvo opened this issue Aug 23, 2024 · 0 comments
Open

Reimplement GameConfigController window sizing and centering #48

miketvo opened this issue Aug 23, 2024 · 0 comments
Labels
feature New feature or request low priority This is not essential

Comments

@miketvo
Copy link
Owner

miketvo commented Aug 23, 2024

Will be possible when this proposal goes through and its PR gets merged: godotengine/godot-proposals#6247

Current workaround:

func _ready() -> void:
    # Set window size and center window for desktop devices.
    if Global.os_platform == "Desktop":
        # Workaround for:
        # https://github.com/godotengine/godot-proposals/issues/6247.
        # TODO: Reimplement this when there is better support for the above
        # issue in future Godot 4.x versions.
        var window: Window = get_window()
        window.size = GameConfig.RESOLUTIONS[GameConfig.config.graphics.resolution]
        @warning_ignore("integer_division")
        window.position = Vector2i(
                int(get_viewport_rect().size.x / 2) - window.size.x / 2,
                int(get_viewport_rect().size.y / 2) - window.size.y / 2
        )

Affects all projects in the repository.

@miketvo miketvo added feature New feature or request low priority This is not essential labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request low priority This is not essential
Projects
None yet
Development

No branches or pull requests

1 participant