gnomemm r1682 - in clutter-box2dmm/trunk: . clutter-box2d/src examples examples/distance_joint examples/revolute_joint
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1682 - in clutter-box2dmm/trunk: . clutter-box2d/src examples examples/distance_joint examples/revolute_joint
- Date: Mon, 11 Aug 2008 08:40:16 +0000 (UTC)
Author: murrayc
Date: Mon Aug 11 08:40:16 2008
New Revision: 1682
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1682&view=rev
Log:
2008-08-11 Murray Cumming <murrayc murrayc com>
* clutter-box2d/src/box2d.hg: add_distance_joint(): Added default values.
* configure.in:
* examples/Makefile.am:
* examples/distance_joint/: Added a simple example of a distance joint.
Added:
clutter-box2dmm/trunk/examples/distance_joint/
- copied from r1681, /clutter-box2dmm/trunk/examples/revolute_joint/
Removed:
clutter-box2dmm/trunk/examples/revolute_joint/
Modified:
clutter-box2dmm/trunk/ChangeLog
clutter-box2dmm/trunk/clutter-box2d/src/box2d.hg
clutter-box2dmm/trunk/configure.in
clutter-box2dmm/trunk/examples/Makefile.am
clutter-box2dmm/trunk/examples/distance_joint/main.cc
Modified: clutter-box2dmm/trunk/clutter-box2d/src/box2d.hg
==============================================================================
--- clutter-box2dmm/trunk/clutter-box2d/src/box2d.hg (original)
+++ clutter-box2dmm/trunk/clutter-box2d/src/box2d.hg Mon Aug 11 08:40:16 2008
@@ -60,7 +60,7 @@
const Glib::RefPtr<Clutter::Actor>& actor2,
const Clutter::Vertex& anchor1,
const Clutter::Vertex& anchor2,
- double length, double frequency, double damping_ratio), clutter_box2d_add_distance_joint)
+ double length, double frequency = 0.0, double damping_ratio = 0.0), clutter_box2d_add_distance_joint)
_WRAP_METHOD(ClutterBox2DJoint* add_prismatic_joint(const Glib::RefPtr<Clutter::Actor>& actor1,
Modified: clutter-box2dmm/trunk/configure.in
==============================================================================
--- clutter-box2dmm/trunk/configure.in (original)
+++ clutter-box2dmm/trunk/configure.in Mon Aug 11 08:40:16 2008
@@ -123,5 +123,6 @@
examples/pyramid/Makefile
examples/slides/Makefile
examples/table/Makefile
+ examples/distance_joint/Makefile
])
:
Modified: clutter-box2dmm/trunk/examples/Makefile.am
==============================================================================
--- clutter-box2dmm/trunk/examples/Makefile.am (original)
+++ clutter-box2dmm/trunk/examples/Makefile.am Mon Aug 11 08:40:16 2008
@@ -1,3 +1,3 @@
-SUBDIRS = bridge chain pyramid slides table revolute_joint
+SUBDIRS = bridge chain pyramid slides table distance_joint
Modified: clutter-box2dmm/trunk/examples/distance_joint/main.cc
==============================================================================
--- /clutter-box2dmm/trunk/examples/revolute_joint/main.cc (original)
+++ clutter-box2dmm/trunk/examples/distance_joint/main.cc Mon Aug 11 08:40:16 2008
@@ -41,15 +41,18 @@
texture->set_from_file("gnome_logo.png");
box2d->add_actor(texture);
texture->set_opacity(1.0 * 255);
- texture->set_position(50, 50);
+ texture->set_position(stage->get_width() / 2, 0); //It will be placed closer to the rect by the distance joint.
box2d->set_child_mode(texture, Clutter::Box2D::BOX2D_DYNAMIC); //It moves.
box2d->set_child_manipulatable(texture); //It can be moved with the mouse.
- //Add a joint:
- Clutter::Vertex anchor1( CLUTTER_UNITS_FROM_FLOAT (rect->get_width()/2), CLUTTER_UNITS_FROM_FLOAT (rect->get_height()/2), 0 );
- Clutter::Vertex anchor2( CLUTTER_UNITS_FROM_FLOAT (texture->get_width()/2), CLUTTER_UNITS_FROM_FLOAT (texture->get_height()/2), 0);
- box2d->add_distance_joint(rect, texture, anchor1, anchor2, 100.0);
+ //Add a distance joint, with points in the middle of each actor.
+ //The dynamic actor will then move in a circle around the static one,
+ //when manipulated with the mouse:
+ Clutter::Vertex anchor1( CLUTTER_UNITS_FROM_FLOAT(rect->get_width()/2), CLUTTER_UNITS_FROM_FLOAT(rect->get_height()/2), 0 );
+ Clutter::Vertex anchor2( CLUTTER_UNITS_FROM_FLOAT(texture->get_width()/2), CLUTTER_UNITS_FROM_FLOAT(texture->get_height()/2), 0);
+ box2d->add_distance_joint(rect, texture, anchor1, anchor2, 200.0);
+ box2d->property_gravity() = Clutter::Vertex(0, 0, 0);
box2d->set_simulating();
stage->show();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]