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

Android render measuring problem #1305

Closed
mancj opened this issue Jan 8, 2022 · 0 comments · Fixed by #1337
Closed

Android render measuring problem #1305

mancj opened this issue Jan 8, 2022 · 0 comments · Fixed by #1337
Labels

Comments

@mancj
Copy link

mancj commented Jan 8, 2022

Current bug behaviour

When i run my game for the first time or in the release build, some images are rendered in wrong size.
This happens because of system animation rotating the screen from the portrait mode to landscape when the app is open. onGameResize called several times and it seems that components do not handle this resize. So at the first resize, components are measured for the portrait mode, but when the screen rotated, the game do not change it's measuring. If i set some delay before launching the game widget, everything is ok.

Steps to reproduce

Run the app for the first time or in the release mode. Here is a little working example

Log output

game resized to [360.0,785.0] // onGameResize of the flame game
parallax component resized: [360.0,785.0] // onGameResize of the parallax component
parallax onLoad size: [360.0,785.0] // onLoad of the parallax component
game resized to [773.3333333333334,345.0] // onGameResize of the parallax component
// as we see, the component didn't get the last onGameResized, so maybe this is the reason

Flutter doctor output

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale ru)
    • Flutter version 2.8.1 at /Users/mancj/fvm/versions/2.8.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (3 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mancj/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2021.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 63.3.3
    • Dart plugin version 212.5632

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.29.0

[✓] Connected device (3 available)
    • SM G991B (mobile) • R5CRA1J2VWH • android-arm64  • Android 12 (API 31)
    • macOS (desktop)   • macos       • darwin-x64     • macOS 12.1 21C52 darwin-x64
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 97.0.4692.71

! Doctor found issues in 1 category.

More environment information

  • Flame version: 1.0.0
  • Platform affected: android
  • Platform version affected: android 12

More information

Sample code to reproduce the bug
Discord discussion of the bug with videos and some production code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant