Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Resolving compatibility issues between VPlay Games and Apps

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16391

    Kool

    Hi All,

    Last year I posted about using VPlay App components within a VPlay Game: Mixing components

    This worked well and I’ve been using VPlay App components in my game with the following addition in the GameWindow item to resolve initial compatibility issues:

        function getApplication() {
            return window
        }
    
        function px(value) {
            return window.gameWindow.px(value)
        }

     

    I noticed in the latest VPlay update that mixing components is now starting to be officially supported. Along the above two functions, are there any other recommendations to solve compatibility issues?

    Many thanks!

    #16399

    Alex
    Felgo Team

    Hi Kool,

    there are no new recommendations from our side at the moment. If you run into any compatibility issues, let us know! 🙂

    Cheers,
    Alex

    #16500

    Kool

    In the VPlay App demos, there’s a lot of use of functions sp() and dp() which come from the App.

    When using VPlay App components in a VPlay Game, how should we account for these missing functions when setting widths and heights?

     

    #16501

    Günther
    Felgo Team

    Hi Kool!

    The Felgo GameWindow also offers the dp() and sp() functions to specify density-independent sizes. You can safely use these functions in your games.

    However, with games there is also the additional factor of the Scene, which also affects the scaling. To specify density-independent sizes for items within a Scene, the Scene’s dp() and sp() functions should be used instead of the top-level functions from GameWindow.

    This is only relevant when placing your Scenes directly into GameWindow (not into separated additional QML files). The QML interpreter will only automatically use the Scene functions if it is defined in a separated QML file.

    Hope this helps!

    Best,
    Günther

    #16502

    Kool

    Very useful explanation, thank you.

    Is there documentation that explains the functions dp() and sp(), their uses, the how and the when? I’m still new to cross-platform development and “specify density-independent sizes” doesn’t ring any bells.

    Many thanks!

    #16508

    Günther
    Felgo Team

    Hi Kool!

    We have some guides about density- and resolution-independence when creating games or apps, you can find them here.

    It might seem a bit confusing at the beginning, especially with Games that also use scene-scaling mechanism, but the essential part is:

    • Games use scene-scaling for resizing all the items within a Scene to fit into the GameWindow, which allows providing the same game experience on many different devices. For example, a SideScroller on a bigger phone won’t show more of the level and give these user’s an advantage. Instead, the Scene resizes to match the screen and always shows the same part of your level.
    • But: This also means that for bigger devices the text, buttons and other UI elements will also be scaled up along with other items in the scene. For Apps, which don’t use scenes, different screen-densities will also lead to your UI being bigger or smaller on different devices. The solution is to use the dp or sp feature for ensuring the same physical size on the screen instead of pixel values for your UI elements.

    Best,
    Günther

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded