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

Forums

OverviewFelgo 3 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://felgo.com/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 8 years, 4 months ago by  benlau.
    #11867

    Alex
    Felgo Team

    Hey Ben,

    Please see following demo code:

    import Felgo 3.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.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded