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

Forums

OverviewFelgo 1 Support › MultiResolutionImage: up/down button art problem

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6264

    Michael

    Hi

    I’m experimenting & learning the basics. I am trying the following code to swap the up button art with down button art. The following 2 sections show a method with MultiResolutionImage which doesn’t alternate the art (shows only up art regardless of press) but using Image works. What did I do wrong? I suppose I should use a sprite sheet, so maybe that might work better in my case.

            MultiResolutionImage {
                source: ma.pressed ? "btn/buttondown.png" : "btn/buttonup.png"
                anchors.centerIn: parent
    
                Text {
                    text: "Test MIR"
                    font.pointSize: 14
                    anchors.centerIn: parent
                }
    
                MouseArea {
                    id: ma
                    anchors.fill: parent
                    onClicked: console.log("MIR button was clicked")
                }
            }
    
            Image {
                source: ma2.pressed ? "btn/buttondown-sd.png" : "btn/buttonup-sd.png"
                anchors.bottom: parent.bottom
    
                Text {
                    text: "Test Img"
                    font.pointSize: 14
                    anchors.centerIn: parent
                }
    
                MouseArea {
                    id: ma2
                    anchors.fill: parent
                    onClicked: console.log("Regular button was clicked")
                }
            }

    Cheers,

    Michael.

    #6265

    David

    Hi Michael,

    currently it is not possible to exchange the source of the MultiResolutionImage. The best solution would be to use a MultiResolutionImage for each image and set them visible/invisible according to your needs.

    Cheers,

    David

    #6266

    Michael

    Thanks David. I think it’s a worthwhile addition (future update) to MultiResolutionImage to make this kind of art swapping an easy implementation & consistent with what’s possible with Image.

    Cheers,

    Michael.

    #6270

    Christian
    Felgo Team

    Hi Michael,

    you are right. However, I would suggest not using MultiResolutionImage in any live game, but instead use SingleSpriteFromFile as it has a better performance because only a single draw call is needed because a sprite sheet is used. Also, switching sources for SingleSpriteFromFile components is fully supported.

    Cheers, Chris

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