Forums

OverviewV-Play 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:

    https://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
    V-Play 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.

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