-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
120 lines (104 loc) · 3.34 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import Space2D 0.1
import QtQuick 2.4
import QtQuick.Controls 1.2
Item{
width: 500
height: 400
Space {
id: space
width: 500
height: 400
anchors.centerIn: parent
StaticBody{
id: topWall
color: "red"
bodyType: Space2D.staticType
width: space.width
height: 1
anchors.top: space.top
anchors.topMargin: 50
reflect: Qt.vector2d(0,1)
}
StaticBody{
id: bottomWall
color: "red"
bodyType: Space2D.staticType
width: space.width
height: 1
anchors.bottom: space.bottom
anchors.bottomMargin: 50
reflect: Qt.vector2d(0,1)
}
StaticBody{
id: rightWall
color: "red"
bodyType: Space2D.staticType
height: space.height
width: 1
anchors.right: space.right
anchors.rightMargin: 50
reflect: Qt.vector2d(1,0)
}
StaticBody{
id: leftWall
color: "red"
bodyType: Space2D.staticType
height: space.height
width: 1
anchors.left: space.left
anchors.leftMargin: 50
reflect: Qt.vector2d(1,0)
}
Row{
Button{
text: "add a body"
onClicked: {
space.addRigidBody(Space2D.circleType,
{
bodyType: Space2D.rigidType,
nextPoint:Qt.vector2d(100,100),
velocity:Space2D.createVelocity(100, 100)});
}
}
Button{
text: "add stop body"
onClicked: {
space.addRigidBody(Space2D.circleType,
{
bodyType: Space2D.rigidType,
nextPoint:Qt.vector2d(250,250),
velocity:Qt.vector2d(0, 0)});
}
}
Button{
text: "pause"
onClicked:Space2D.pause();
}
Button{
text: "start"
onClicked:Space2D.start();
}
}
Exec{
onExec: {
space.addStaticBody(topWall);
space.addStaticBody(bottomWall);
space.addStaticBody(rightWall);
space.addStaticBody(leftWall);
space.addRigidBody(Space2D.circleType,
{
bodyType: Space2D.rigidType,
nextPoint:Qt.vector2d(200,200),
velocity:Qt.vector2d(100, 100)});
space.addRigidBody(Space2D.circleType,
{
bodyType: Space2D.rigidType,
nextPoint:Qt.vector2d(100,100),
velocity:Qt.vector2d(10, 10)});
}
}
}
}
/*
QUnifiedTimer::stopAnimationDriver: driver is not running
*/