Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo Plugins Support › nested item gameWindowAnchorItem

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

    Bas

    hi,

     

    i have a item in an item in a scene and want to fill the inner rect fullscreen  using gameWindowAnchorItem

    hoe can i do that? or is there another way?

    #13894

    Günther
    Felgo Team

    Hi Bas!

    As you probably know, it is not possible to use anchoring in this case, as anchoring is only possible to sibling items or the parent in the QML tree.

    The solution is to position and size the item manually by setting the x/y and width/height properties accordingly:

    import Felgo 3.0
    import QtQuick 2.0
    
    GameWindow {
      id: gameWindow
    
      activeScene: scene
      screenWidth: 960
      screenHeight: 640
    
      Scene {
        id: scene
    
        width: 480
        height: 320
    
        // fills scene
        Item {
          anchors.fill: parent
    
          // fills gamewindow
          Rectangle {
            x: scene.gameWindowAnchorItem.x
            y: scene.gameWindowAnchorItem.y
            width: scene.gameWindowAnchorItem.width
            height: scene.gameWindowAnchorItem.height
            color: "green"
          }
        }
      }
    }
    

     

    Cheers,

    Günther

    #13895

    Bas

    ah ok,

    thanx!

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

RSS feed for this thread

You must be logged in to reply to this topic.