CoinDisplay.qml Example File

demos/ChickenOutbreak2/qml/CoinDisplay.qml
 import QtQuick 2.0

 // gets used for the text elements in the menus for the game name and score
 Item {
   width: coinText.width+coinImage.width+(displayCustomCoins ? 5 : 6.75)
   height: 20

   property bool displayBonusCoins: false
   property int bonusCoins: 0
   property bool displayCustomCoins: false
   property int customCoins: 0
   property int pixelSize: 20
   property string color: "#f5b68a"

   Image {
     id: coinImage
     source: displayCustomCoins ? "../assets/saveit_single.png" : "../assets/coin_single.png"
     width: displayCustomCoins ? 20 : 15.25
     height: 20
     anchors.verticalCenter: parent.verticalCenter
   }

   Text {
     id: coinText
     color: parent.color
     font.family: fontHUD.name
     font.pixelSize: parent.pixelSize
     text: getText()
     x: displayCustomCoins ? 25 : 22
     anchors.verticalCenter: parent.verticalCenter
   }

   function getText() {
     if(displayBonusCoins)
       return bonusCoins + qsTr(" earned")
     else if(displayCustomCoins)
       return customCoins+""
     else return store.money.balance
   }
 }

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