Code Monkey home page Code Monkey logo

Comments (3)

ArtiomCiumac avatar ArtiomCiumac commented on July 27, 2024

In the case of WinRT - the issue is caused by the fact that the Toolkit subscribes to SizeChagned event of the SwapChainBackgroundPanel before it is loaded. When the control is loaded and positioned during the layout pass - its size changes and the SizeChanged event is fired, leading to a backbuffer resize even when the game was not displayed yet.

For WinRT we can check if the control is loaded (by checking that either of ActualWidth or ActualHeight are not zero?) and if not - subscribe to the Loaded event and initialize the game in its handler, or load it immediately otherwise.

WP8 platform has also issues with what and when gets loaded - discussed here: http://www.sharpdx.org/forum/5-api-usage/3401-drawingsurfacebackgroundgrid-vs-drawingsurface-on-windows-phone-8-wp8#3953

On WP8 this behavior causes incorrect sizing of the game - as the control size is not known during the initialization - the image gets stretched (for example, the backbuffer size is 800x480, while the WP8 surface size is 480x800).

from sharpdx.

xoofx avatar xoofx commented on July 27, 2024

Back to requirements:

  • We want to render to whatever is the resolution of the device: We should specify a PreferedBackBufferWidth/Height to 0 and let the system pick a valid resolution for the container surface.
  • We want to specify a specific resolution, and let the rendering be stretched by the container surface. In case the container surface is resize, we should update the specific resolution according to the ratio of the resize

Currently this is not really the case: it is half of both with an invalid mix between fixed size and variable size.

Are these requirements fine? Any other ideas?

If we settle on some behavior before 2.5, I will try to look if It can be fixed for this version.

from sharpdx.

ArtiomCiumac avatar ArtiomCiumac commented on July 27, 2024

I am not sure about the second requirement - I suppose if developer has specified some fixed backbuffer size - it should not be changed. For example, it may be required to save backbuffer contents to a image - so the size should not be changed unexpectedly. Is it worth to have some flag that can enable or disable the automatic resizing behavior? (this is now implemented in SharpDXElement for WPF platform).
What do you think?

from sharpdx.

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.