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

Forums

OverviewFelgo 3 Support (Qt 5) › getting entities and items in scene to line up under scaling…

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #20299

    Jeff

    I’m making a scene where there is a grid at the bottom of the screen:

    Scene
    {
    id: board

    width: iwinwidth  //640
    height: iwinheight  //960

    Rectangle
    {
    id: gridback
    width: iwinwidth
    height: width
    y:iwinheight-iwinwidth
    color: “#666666”
    radius: 5

    }

    etc

     

    So, gridback is just setting the y position to pop it down to the bottom on the screen (in portrait mode).  Now, if I’m in iphone 4 mode, and I place runtime created elements on top of this grid using (iwinheight-iwinwidth) as the offset – everything works great, but if I set iphone X mode, everything is WAY off.

    I thought the whole point of a gamewindow is that I just set screenWidth and screenHeight of the GameWindow, and then everything is virtualized to this coordinate system?  Are entities on a different coordinate system?

    Can I just query where gridback ended up, and then then use that offset to relatively position the entities?

     

    #20304

    Günther
    Felgo Team
    #20308

    Jeff

    No, I read all that – I mean, I don’t see how something as simple as a scale and bias can turn into all this nonsense, but whatever.

    My point is why do *some* elements go through the scaling and some don’t?  That’s the silly thing – the runtime created entities should go through the same scaling as everything else, sigh.

    But whatever, I just turned off all scaling – I can do that myself in a much more rational way.  However, how do you get the bias (the offset) of the base screen, on the iphone X.  I just want to query the constant to find the 0,0 of the screen so I can create the runtime elements with this same offset…

    #20314

    Günther
    Felgo Team

    All elements within a scene, including runtime created entities, scale along with the scene. To control alignment of UI items in respect to the iPhone X safe zones, you can use e.g. the Scene::gameWindowAnchorItem or fullWindowAnchorItem.

    The pixel value of iPhone X screen insets is available with NativeUtils::safeAreaInsets.

    #20320

    Jeff

    OK, so if I add (-board.gameWindowAnchorItem.x, -board.gameWindowAnchorItem.y ) to the position that I dynamically position things with, then everything aligns on Windows.

    But on iOS, the numbers are wildly off.

    On Windows, the values are (-131,0) with emulating an iphone X.

    On an actual iphone X, the values are (+295,0).

     

    #20321

    Jeff

    But on iOS, the numbers are wildly off.

    OK, it looks like this is because in the onCompleted() callback, the gameWindowAnchorItem() data is not set.  It snaps in later.

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