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!

GameNetworkExample

 import QtQuick 2.0
 import Felgo 3.0 // for SimpleButton for closing temporarily

 Item {
   id: levelDelegate

   property alias levels: levelRepeater.model

   signal levelClicked(int levelId)

   onLevelsChanged: {
     console.debug("LevelDelegate.levels changed to", JSON.stringify(levels))
   }

   anchors.fill: parent

   Rectangle {
     anchors.fill: parent
     color: "grey"
     //opacity: 0.7
   }

   Flickable {
     id: flickable
     width: parent.width
     height: parent.height

     contentWidth: levelListColumn.width
     contentHeight: levelListColumn.height

     // otherwise it would scroll over the timeFrameRow
     clip: true

     flickableDirection: Flickable.VerticalFlick

     Column {
       id: levelListColumn
       width: parent.width

       spacing: 5

       Repeater {
         id: levelRepeater

         // the delegate must be modifiable by the user, by default show a grid with 2 columns, or just a list at first
         delegate: Rectangle {
           width: levelDelegate.width
           height: col.height
           color: "white"

           Component.onCompleted: {
             console.debug("model in level object:", JSON.stringify(modelData))
           }

           Column {
             id: col
             width: parent.width

             Text {
               text: "LevelId: " + modelData.id +
                     "\nLevelName: " + modelData.name +
                     "\nDescription: " + modelData.description +
                     "\nAuthor: " + modelData.user.name +
                     "\nQuality: " + modelData.average_quality + ", Difficulty:" + modelData.average_difficulty +
                     "\n#Favored: " + modelData.times_favored + ", #Played: " + modelData.times_played + ", #Downloaded: " + modelData.times_downloaded +
                     "\nUserRating: " + JSON.stringify(modelData.rating) +
                     "\nData: " + JSON.stringify(modelData.data)
               width: parent.width
               wrapMode: Text.Wrap
             }

           }// Column

           MouseArea {
             anchors.fill: parent
             onClicked: {
               console.debug("clicked level model with id:", modelData.id, ", complete model:", JSON.stringify(modelData))
               levelClicked(modelData.id)
             }
           }

         }//delegate
       }//Repeater
     }//Column

   }//Flickable

   // just temporariy to allow making the whole switcher invisible
   SimpleButton {
     text: "Close"
     anchors.right: parent.right
     onClicked: parent.visible = false