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 2 Support (Qt 5) › sp() and dp() function not accessible

Tagged: 

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

    Jan

    I need to scale text via font.pixelSize; The Docs say i should use the sp() function, but the example does not work. Here’s the code.

    import Felgo 3.0
    import QtQuick 2.0
    
    GameWindow {
      id: gameWindow
    
      Rectangle {
        width: parent.width
        height: gameWindow.dp(48)
    
        Text {
          text: "20sp"
          font.pixelSize: gameWindow.sp(20)
        }
      }
    }

    Any workaround?

    Thanks,

    Drosophila

    #8439

    Christian
    Felgo Team

    Hi Jan,

    please update your SDK first to the latest version 2.2.0 – the density-independence functions were added there (see changelog).

    As mentioned in the density independence blog post, we generally recommend just using a Scene and GameWindow with the content scaling approach, especially for games. For apps that is different though – the density independent approach is better there..

    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.