Retourner au contenu associé (dépêche : GCompris change de moteur)
Posté par matteli le 10 février 2014 à 08:49. En réponse à la dépêche GCompris change de moteur. Évalué à 10.
Je pense aussi que Qt/Quick est un bon choix.
Pour le drag and drop que tu utilises beaucoup dans GCompris, j'avais passé un peu de temps avant d'obtenir quelque chose de totalement fonctionnelle. Je te met le code au cas où :
import QtQuick 2.0 Item { width: 800 height: 800 id: root property int cible: 0 DropArea { id: daCible1 anchors.left: root.left anchors.bottom: root.bottom width: root.width/2; height: root.height/2 onDropped: { cible = 1 console.log("Dans cible 1") } Rectangle { id: reCible1 anchors.fill: parent color: "lightgreen" } states: [ State { when: daCible1.containsDrag PropertyChanges { target: reCible1 color: "green" } } ] } DropArea { id: daCible2 width: root.width/2; height: root.height/2 anchors.right: root.right anchors.bottom: root.bottom onDropped: { cible = 2 console.log("Dans cible 2") } Rectangle { id: reCible2 anchors.fill: parent color: "lightblue" } states: [ State { when: daCible2.containsDrag PropertyChanges { target: reCible2 color: "blue" } } ] } Rectangle { id: reStart anchors.left: root.left anchors.right: root.right anchors.top: root.top height: root.height/2 color: "azure" } Rectangle { MouseArea { id: maTuile drag.target: parent onReleased: parent.Drag.drop() anchors.fill: parent } Text { id: teTuile text: "Baleine" width: parent.width; height: parent.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.pointSize: 24 } id: reTuile color: "paleturquoise" width: root.width/3; height: root.height/16 anchors.verticalCenter: undefined anchors.horizontalCenter: undefined x: (root.width - width) / 2 y: (reStart.height - height) / 2 Drag.active: maTuile.drag.active Drag.hotSpot.x: width/2 Drag.hotSpot.y: height/2 states: [ State { when: maTuile.drag.active PropertyChanges { target: reTuile opacity: 0.5 } AnchorChanges { target: reTuile anchors.verticalCenter: undefined anchors.horizontalCenter: undefined } }, State { when: !maTuile.drag.active & cible == 0 AnchorChanges { target: reTuile anchors.verticalCenter: reStart.verticalCenter anchors.horizontalCenter: reStart.horizontalCenter } }, State { when: !maTuile.drag.active & cible == 1 AnchorChanges { target: reTuile anchors.verticalCenter: daCible1.verticalCenter anchors.horizontalCenter: daCible1.horizontalCenter } }, State { when: !maTuile.drag.active & cible == 2 AnchorChanges { target: reTuile anchors.horizontalCenter: daCible2.horizontalCenter anchors.verticalCenter: daCible2.verticalCenter } } ] transitions: Transition { AnchorAnimation { duration: 500; easing.type: Easing.OutElastic } } } }
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
# Très bon choix
Posté par matteli . En réponse à la dépêche GCompris change de moteur. Évalué à 10.
Je pense aussi que Qt/Quick est un bon choix.
Pour le drag and drop que tu utilises beaucoup dans GCompris, j'avais passé un peu de temps avant d'obtenir quelque chose de totalement fonctionnelle.
Je te met le code au cas où :