summaryrefslogtreecommitdiffstats
path: root/examples/blob/blob.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/blob/blob.qml')
-rw-r--r--examples/blob/blob.qml56
1 files changed, 56 insertions, 0 deletions
diff --git a/examples/blob/blob.qml b/examples/blob/blob.qml
new file mode 100644
index 0000000..5dfdded
--- /dev/null
+++ b/examples/blob/blob.qml
@@ -0,0 +1,56 @@
+import "../../Canvas"
+import "blobsallad.js" as Blob
+import Qt 4.7
+
+Canvas {
+ width:500
+ height:500
+
+ property color color: "#ffee00"
+
+ Timer {
+ id: heartbeat;
+ interval: 25;
+ repeat: true
+ running:true
+ onTriggered: {
+ Blob.update();
+ updateCanvas();
+ }
+ }
+ MouseArea {
+ id:mousearea
+ hoverEnabled:true
+ anchors.fill: parent
+ onPressed: { Blob.mousePressed(mouseX, mouseY) }
+ onReleased: { Blob.mouseReleased(mouseX, mouseY) }
+ onPositionChanged: { Blob.mouseMoved(mouseX, mouseY) }
+ }
+
+ Row {
+ spacing:10
+ anchors.top:parent.top
+ anchors.left:parent.left
+ anchors.margins:10
+ Button {
+ id:join
+ text: "Split"
+ onClicked: Blob.blobColl.split();
+ }
+ Button {
+ anchors.margins:16
+ text: "Join"
+ onClicked: Blob.blobColl.join();
+ }
+ Button {
+ anchors.margins:16
+ text: "Gravity"
+ onClicked: Blob.toggleGravity();
+ }
+ }
+
+ onPaint: { Blob.draw(ctx) }
+
+ Component.onCompleted: Blob.init()
+}
+