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

CarChallenge 3D Demo

 import QtQuick 2.0
 import Felgo 3.0

 Item {
   id: menu

   property alias itemEditor: menuSettings.itemEditor
   property bool miniMapOn: true

   state: "intro"

   // adding a MouseArea here is needed, otherwise you could fire a weapon if in the menu and control the car while in the menu
   MouseArea {
     anchors.fill: parent
     enabled: menu.state !== "game"
   }

   MenuOverview {
     id: menuOverview
     onClickedAbout: {
       menu.state = "about"
       menuButton.toArrow()
     }
     onClickedCamera: {
       menu.state = "camera"
       menuButton.toArrow()
     }
     onClickedSettings: {
       menu.state = "settings"
       menuButton.toArrow()
     }
     onClickedMinimap: menu.miniMapOn = !menu.miniMapOn
   }

   MenuAbout {
     id: menuAbout
   }

   MenuSettings {
     id: menuSettings
     // contains the ItemEditor!
   }

   // with custom sliders, but ItemEditor is easier to use - thus use MenuSettings instead
 //  MenuCamera {
 //    id: menuCamera
 //    onZoomChanged: console.debug("zoom changed to " + zoom.toFixed(2))
 //    onAngleChanged: console.debug("angle changed to " + angle.toFixed(2))
 //  }

   StartButton {
     id: startButton
     anchors.horizontalCenter: parent.horizontalCenter
     anchors.bottom: parent.bottom
     anchors.bottomMargin: 10
     onClicked: {
       menu.state = "game"
     }
   }

   MenuButton {
     id: menuButton
     anchors.right: parent.right
     anchors.rightMargin: 5
     anchors.top: parent.top
     anchors.topMargin: 5
     visible: menu.state != "intro"
     onClicked: {
       if(menu.state == "game") {
         menu.state = "menu"
         toCross()
       } else if(menu.state == "menu") {
         menu.state = "game"
         toDefault()
       } else if(menu.state == "about" || menu.state == "camera" || menu.state == "settings") {
         menu.state = "menu"
         toCross()
       }
     }
   }

   states: [
       State {
         name: "intro"
         PropertyChanges {target: menuAbout; opacity: 1}
         PropertyChanges {target: startButton; opacity: 1}
       },
       State {
         name: "game"
       },
       State {
         name: "menu"
         PropertyChanges {target: menuOverview; opacity: 1}
       },
       State {
         name: "about"
         PropertyChanges {target: menuAbout; opacity: 1}
       },
       State {
         name: "camera"
         PropertyChanges {target: menuCamera; opacity: 1}
       },
       State {
         name: "settings"
         PropertyChanges {target: menuSettings; opacity: 1}
       }
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded