Forums

OverviewV-Play 1 SupportDaily builds 1.3.7 bugs › Reply To: Daily builds 1.3.7 bugs

OverviewV-Play 1 SupportDaily builds 1.3.7 bugs › Reply To: Daily builds 1.3.7 bugs
#5318

Heini

Hi,

1) i use the sourceSize property to determine the height or widht of an image, in relation to its real dimensions. A typical usecase is this:

height: 60
width: (sourceSize.width * height) / sourceSize.height

I like to work this way, because it is much more exactly then setting the scale-property and its not necessary to have in mind the real dimensions of the image.

2)Here is some of the relevant code of the first loaded scene, nothing special:

 

Scene{
    id: menu
        Image{
            id: background
            source: "Mainmenu/mainback-hd.png"
            width: gameWindowAnchorItem.width
            height: gameWindowAnchorItem.height
            x: gameWindowAnchorItem.x
            y: gameWindowAnchorItem.y

        }

        Image{
            id: enableSound
            source: window.settings.soundEnabled ? "Mainmenu/ton_an.png" : "Mainmenu/ton_aus.png"
            width: 50
            height: 50
            anchors.left: gameWindowAnchorItem.left
            anchors.bottom: gameWindowAnchorItem.bottom
            anchors.leftMargin: 10
            anchors.bottomMargin: 10

            MouseArea{
                anchors.fill: parent

                onClicked: {
                    window.soundEnabled = !window.soundEnabled;
                    window.settings.soundEnabled = window.soundEnabled;
                }
            }
        }


        Sound{
            id: soundexit1
            source: "Mainmenu/exit.mp3"
        }


        Sound{
            id: soundwelcome
            source :"Mainmenu/welcome.mp3"
        }


        Timer{
            id: soundTimer
            interval: 1000
            repeat: false
            running: false

            onTriggered: {
                if (window.isApplicationStarting) soundwelcome.play();
                showSchildTimer.start(); //Timer, that starts a numberanimation for the menuitems
            }
        }


        Component.onCompleted: {
            soundTimer.start()
        }
}

Thanks,

Heini

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