Giter VIP home page Giter VIP logo

Comments (4)

dellis1972 avatar dellis1972 commented on May 19, 2024

Just found this it might be useful
http://developer.android.com/resources/articles/faster-screen-orientation-change.html

from monogame.

KonajuGames avatar KonajuGames commented on May 19, 2024

Use the following attribute to prevent the activity being recreated on an
orientation change.

[Activity(ConfigurationChanges=Orientation)]

This will then call Activity.OnConfigurationChanged when the orientation
changes. All other configuration changes will go through the standard
activity re-creation. It may also help to add Keyboard and KeyboardHidden
to prevent the activity being recreated when a keyboard is slid open or
shut. See the "Configuration Changes" section on this page
http://api.xamarin.com/index.aspx?link=T%3aAndroid.App.Activity

Sly

On 15 December 2011 05:32, Dean Ellis <
[email protected]

wrote:

There seems to be a big problem with the Orientation change stuff on
Android. After reading the documentation the Activity is re-created each
time the Orientation/Configuration changes. The means the Game object is
being re-created each time, so all the assets are loaded again and again
and again each time the orientation changes.

We need to figure out a way to detect this and keep the same game object/
content manager around and just swap out the Activity/ AndroidGameView.

This will not effect people who just use a fixed screen orientation for
games as the orientation will not change. however this might be the cause
of the Resume issue we have been seeing as well.


Reply to this email directly or view it on GitHub:
#170

from monogame.

dellis1972 avatar dellis1972 commented on May 19, 2024

Good find, ill give that a go today
On Dec 15, 2011 10:44 AM, "Steve 'Sly' Williams" <
[email protected]>
wrote:

Use the following attribute to prevent the activity being recreated on an
orientation change.

[Activity(ConfigurationChanges=Orientation)]

This will then call Activity.OnConfigurationChanged when the orientation
changes. All other configuration changes will go through the standard
activity re-creation. It may also help to add Keyboard and KeyboardHidden
to prevent the activity being recreated when a keyboard is slid open or
shut. See the "Configuration Changes" section on this page
http://api.xamarin.com/index.aspx?link=T%3aAndroid.App.Activity

Sly

On 15 December 2011 05:32, Dean Ellis <
[email protected]

wrote:

There seems to be a big problem with the Orientation change stuff on
Android. After reading the documentation the Activity is re-created each
time the Orientation/Configuration changes. The means the Game object is
being re-created each time, so all the assets are loaded again and again
and again each time the orientation changes.

We need to figure out a way to detect this and keep the same game object/
content manager around and just swap out the Activity/ AndroidGameView.

This will not effect people who just use a fixed screen orientation for
games as the orientation will not change. however this might be the cause
of the Resume issue we have been seeing as well.


Reply to this email directly or view it on GitHub:
#170


Reply to this email directly or view it on GitHub:
#170 (comment)

from monogame.

dellis1972 avatar dellis1972 commented on May 19, 2024

that seems to work, but we now have to update the Viewport manually with the new width and height because the game is not being re-created each time. Looking at sorting that out now.

from monogame.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.