Forums

OverviewV-Play 2 Support (Qt 5) › Not using GameWindow as root item

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11865

    Ben

     

    According to the document of GameWindow:

    http://v-play.net/doc/vplay-gamewindow/

     

    “Use this component as your root QML item. If you want to use another root QML item and still use content scaling, use GameWindowItem.”

     

    I would like to try to not use GameWindow as root item. But content scaling do not works. That is my code:

    ApplicationWindow {
      id: gameWindow
      visible: true;
    
      width: 960
      height: 640
    
      GameWindowItem {
          anchors.fill: parent
    
          GameScene {
            id: gameScene
          }
      }
    }

     

    Did I missed anything?

     

    Thanks for any advise.

     

     

    • This topic was modified 2 years, 11 months ago.
    #11867

    Alex
    V-Play Team

    Hey Ben,

    Please see following demo code:

    import VPlay 2.0
    import QtQuick 2.0
    import QtQuick.Controls 1.4
    
    ApplicationWindow {
      id: window
    
      visible: true;
      width: 960
      height: 640
    
      GameWindowItem {
        id: gameWindow
        anchors.fill: parent
      }
    
      Scene {
        id: scene
    
        width: 480
        height: 320
    
        Rectangle {
          anchors.fill: parent
          color: "red"
        }
    
        Rectangle {
          anchors.centerIn: parent
          width: 400
          height: 300
          color: "blue"
        }
      }
    }
    

    There are two important things:

    1. GameWindowItem & Scenes are siblings, so in that case you don’t need to wrap Scenes into the GameWindowItem (it’s just an item and not a window, as the name implies)

    2. The GameWindowItem needs the id “gameWindow”, otherwise scenes can’t reference it the correct way as of now.

    We will add that information to the corresponding documentation part, thanks for pointing that out!

    Best,

    Alex

    #11869

    Ben

    Hi Alex,

     

    It works! Thanks a lot!

Viewing 3 posts - 1 through 3 (of 3 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