Forums

OverviewFelgo 2 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support