Warning, /education/gcompris/external/qml-box2d/examples/filtering/filtering.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.0
0002 import Box2D 2.0
0003 import "../shared"
0004 
0005 Item {
0006     id: screen
0007     width: 800
0008     height: 600
0009 
0010     World { id: physicsWorld }
0011 
0012     Repeater {
0013         model: 5
0014         delegate: RectangleBoxBody {
0015             x: index * 150 + 10
0016             y: Math.random() * (screen.height / 3)
0017             width: 50
0018             height: 50
0019 
0020             world: physicsWorld
0021             sleepingAllowed: false
0022                         bodyType: Body.Dynamic
0023 
0024             density: 1
0025             friction: 0.3
0026             restitution: 0.5
0027             categories: Box.Category2
0028             collidesWith: Box.Category1 | Box.Category3 | Box.Category4
0029 
0030             rotation: Math.random() * 90
0031 
0032             color: "blue"
0033             opacity: 0.5
0034         }
0035     }
0036 
0037     Repeater {
0038         model: 5
0039         delegate: RectangleBoxBody {
0040             x: index * 150 + 10
0041             y: Math.random() * (screen.height / 3)
0042             width: 50
0043             height: 50
0044 
0045             world: physicsWorld
0046             sleepingAllowed: false
0047                         bodyType: Body.Dynamic
0048 
0049             density: 1
0050             friction: 0.3
0051             restitution: 0.5
0052             categories: Box.Category3
0053             collidesWith: Box.Category1 | Box.Category2 | Box.Category4
0054 
0055             rotation: Math.random() * 90;
0056 
0057             color: "red"
0058             opacity: 0.5
0059         }
0060     }
0061 
0062     Repeater {
0063         model: 5
0064         delegate: RectangleBoxBody {
0065             x: index * 150 + 10
0066             y: Math.random() * (screen.height / 3)
0067             width: 50
0068             height: 50
0069 
0070             world: physicsWorld
0071             sleepingAllowed: false
0072             fixedRotation: true
0073 
0074                         bodyType: Body.Dynamic
0075 
0076             density: 1
0077             friction: 0.3
0078             restitution: 0.5
0079             categories: Box.Category4
0080             collidesWith: Box.All
0081 
0082             rotation: Math.random() * 90;
0083 
0084             color: "green"
0085             opacity: 0.5
0086         }
0087     }
0088 
0089     ScreenBoundaries {}
0090 }