Warning, /education/gcompris/external/qml-box2d/examples/impulse/impulse.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     focus: true
0010 
0011     // BOX2D WORLD
0012     World { id: physicsWorld }
0013 
0014     ScreenBoundaries {}
0015 
0016     Ball {
0017         id: ball
0018         x: parent.width / 2
0019         y: parent.height / 2
0020     }
0021 
0022     // Debug
0023     DebugDraw {
0024         id: debugDraw
0025         world: physicsWorld
0026         opacity: 0.75
0027         visible: false
0028     }
0029 
0030     MouseArea {
0031         anchors.fill: parent
0032         onClicked: {
0033             ball.body.applyLinearImpulse(
0034                         Qt.point((mouseX - ball.x),
0035                                  (mouseY - ball.y)),
0036                         Qt.point(ball.x, ball.y))
0037         }
0038     }
0039 }