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

Forums

OverviewFelgo 1 Support › position of objects with different aspect ratios

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4559

    hener.stephan

    hey,

    i am currently having problems with the position of objects with different aspect ratios,

    lets take for example i want to place a rectangle and the top left of the screen:

    import VPlay 1.0
    import QtQuick 1.1
    
    GameWindow {
        activeScene: scene
    
        width: 640
        height: 960
        
        Scene {
            id: scene
    
            width: 320
            height: 480
    
            Rectangle {
            width:50
            height:50
            color: "red"
            x:0
            y:0
            }
    
        }
    }
    
    

    the result is this for different aspect ratios:

    http://i.imgur.com/23CpPiY.png

    in the second picture the rectangle isn’t in the top right,

    i presume it’s because how vplay handles different aspect ratios,

    but is there a way to have it at the same position regardless of the aspect ratio?

     

    cheers

    stephan

     

     

     

     

    #4563

    Christian
    Felgo Team

    Hi Stephan,

    yes there is a way: where the Scene is placed in the (possibly bigger) GameWindow, depends on the sceneAlignmentX and sceneAlignmentY properties. By default, they are set to center which is why your logical scene is put in the center, when the GameWindow is bigger. If you want to position you scene always to the top, you can set sceneAlignmentY to “top”. If you want to position elements in the scene always relative to the GameWindow, use the gameWindowAnchorItem for that, as we have done it in our sample games.

    Cheers, Chris

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