gnomemm r1680 - in clutter-box2dmm/trunk: . clutter-box2d/src examples/bridge examples/chain examples/pyramid examples/slides examples/table tools/m4



Author: murrayc
Date: Mon Aug 11 08:09:40 2008
New Revision: 1680
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1680&view=rev

Log:
2008-08-11  Murray Cumming  <murrayc murrayc com>

* tools/m4/convert_clutter-box2dmm.m4:
* clutter-box2d/src/box2d.ccg:
* clutter-box2d/src/box2d.hg: Added explicit get/set_child_*() 
methods for all the ClutterBox2D child properties.
Used Clutter::Vertex instead of ClutterVertex for all parameters.
* examples/bridge/main.cc:
* examples/chain/main.cc:
* examples/pyramid/main.cc:
* examples/slides/main.cc:
* examples/table/main.cc: Adapted.

Modified:
   clutter-box2dmm/trunk/ChangeLog
   clutter-box2dmm/trunk/clutter-box2d/src/box2d.ccg
   clutter-box2dmm/trunk/clutter-box2d/src/box2d.hg
   clutter-box2dmm/trunk/examples/bridge/main.cc
   clutter-box2dmm/trunk/examples/chain/main.cc
   clutter-box2dmm/trunk/examples/pyramid/main.cc
   clutter-box2dmm/trunk/examples/slides/main.cc
   clutter-box2dmm/trunk/examples/table/main.cc
   clutter-box2dmm/trunk/tools/m4/convert_clutter-box2dmm.m4

Modified: clutter-box2dmm/trunk/clutter-box2d/src/box2d.ccg
==============================================================================
--- clutter-box2dmm/trunk/clutter-box2d/src/box2d.ccg	(original)
+++ clutter-box2dmm/trunk/clutter-box2d/src/box2d.ccg	Mon Aug 11 08:09:40 2008
@@ -1 +1,88 @@
+/* Copyright (C) 2008 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
 #include <clutter-box2d/clutter-box2d.h>
+
+namespace Clutter
+{
+namespace Box2D
+{
+
+void Box2D::set_child_linear_velocity(const Glib::RefPtr<Clutter::Actor>& actor, const Clutter::Vertex& linear_velocity)
+{
+  set_child_property(actor, "linear-velocity", linear_velocity);
+}
+
+Clutter::Vertex Box2D::get_child_linear_velocity(const Glib::RefPtr<const Clutter::Actor>& actor) const
+{
+  Clutter::Vertex linear_velocity;
+  get_child_property(actor, "angular-velocity", linear_velocity);
+  return linear_velocity;
+}
+
+void Box2D::set_child_angular_velocity(const Glib::RefPtr<Clutter::Actor>& actor, const Clutter::Vertex& angular_velocity)
+{
+  set_child_property(actor, "angular-velocity", angular_velocity);
+}
+
+Clutter::Vertex Box2D::get_child_angular_velocity(const Glib::RefPtr<const Clutter::Actor>& actor) const
+{
+  Clutter::Vertex angular_velocity;
+  get_child_property(actor, "angular-velocity", angular_velocity);
+  return angular_velocity;
+}
+
+void Box2D::set_child_is_bullet(const Glib::RefPtr<Clutter::Actor>& actor, bool is_bullet)
+{
+  set_child_property(actor, "is-bullet", is_bullet); 
+}
+
+bool Box2D::get_child_is_bullet(const Glib::RefPtr<const Clutter::Actor>& actor) const
+{
+  bool is_bullet = false;
+  get_child_property(actor, "is-bullet", is_bullet);
+  return is_bullet;
+}
+
+void Box2D::set_child_mode(const Glib::RefPtr<Clutter::Actor>& actor, Type mode)
+{
+  set_child_property(actor, "mode", (int)mode);  //TODO: Avoid the need for the int cast. 
+}
+
+Type Box2D::get_child_mode(const Glib::RefPtr<const Clutter::Actor>& actor) const
+{
+  Type mode = BOX2D_NONE;
+  get_child_property(actor, "mode", mode);
+  return mode;
+}
+
+void Box2D::set_child_manipulatable(const Glib::RefPtr<Clutter::Actor>& actor, bool manipulatable)
+{
+  set_child_property(actor, "manipulatable", manipulatable); 
+}
+
+bool Box2D::get_child_manipulatable(const Glib::RefPtr<const Clutter::Actor>& actor) const
+{
+  bool manipulatable = false;
+  get_child_property(actor, "manipulatable", manipulatable);
+  return manipulatable;
+}
+
+} //namespace Box2D
+
+} //namespace Clutter
+

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:09:40 2008
@@ -49,16 +49,17 @@
   _WRAP_METHOD(bool get_simulating() const, clutter_box2d_get_simulating)
 
   //TODO: Wrap ClutterBox2DJoint properly - ideally it would be a registered type, with hidden implementation.
-  _WRAP_METHOD(ClutterBox2DJoint* add_revolute_joint(const Glib::RefPtr<Clutter::Actor>& actor1, const Glib::RefPtr<Clutter::Actor>& actor2, const ClutterVertex* anchor1, const ClutterVertex* anchor2, double reference_angle), clutter_box2d_add_revolute_joint)
 
+  _WRAP_METHOD(ClutterBox2DJoint* add_revolute_joint(const Glib::RefPtr<Clutter::Actor>& actor1, const Glib::RefPtr<Clutter::Actor>& actor2, const Clutter::Vertex& anchor1, const Clutter::Vertex& anchor2, double reference_angle), clutter_box2d_add_revolute_joint)
 
-  _WRAP_METHOD(ClutterBox2DJoint* add_revolute_joint(const Glib::RefPtr<Clutter::Actor>& actor1, const Glib::RefPtr<Clutter::Actor>& actor2, const ClutterVertex *anchor), clutter_box2d_add_revolute_joint2)
+
+  _WRAP_METHOD(ClutterBox2DJoint* add_revolute_joint(const Glib::RefPtr<Clutter::Actor>& actor1, const Glib::RefPtr<Clutter::Actor>& actor2, const Clutter::Vertex& anchor), clutter_box2d_add_revolute_joint2)
 
 
   _WRAP_METHOD(ClutterBox2DJoint* add_distance_joint(const Glib::RefPtr<Clutter::Actor>& actor1,
                                                      const Glib::RefPtr<Clutter::Actor>& actor2,
-                                                     const ClutterVertex* anchor1,
-                                                     const ClutterVertex* anchor2,
+                                                     const Clutter::Vertex& anchor1,
+                                                     const Clutter::Vertex& anchor2,
                                                      double length, double frequency, double damping_ratio), clutter_box2d_add_distance_joint)
 
 
@@ -66,10 +67,28 @@
                                                       const Glib::RefPtr<Clutter::Actor>& actor2,
                                                       const ClutterVertex *anchor1,
                                                       const ClutterVertex *anchor2,
-                                                      double min_length, double max_length, const ClutterVertex* axis), clutter_box2d_add_prismatic_joint)
+                                                      double min_length, double max_length,  const Clutter::Vertex& axis), clutter_box2d_add_prismatic_joint)
+
+
+//TODO: Remove this conversion when the C API has been fixed. See http://bugzilla.o-hand.com/show_bug.cgi?id=1095
+#m4 _CONVERSION(`const Clutter::Vertex&', `ClutterVertex*', `const_cast<Clutter::Vertex&>($3).gobj()')
+  _WRAP_METHOD(ClutterBox2DJoint* add_mouse_joint(const Glib::RefPtr<Clutter::Actor>& actor, const Clutter::Vertex& target), clutter_box2d_add_mouse_joint)
+
+
+  void set_child_linear_velocity(const Glib::RefPtr<Clutter::Actor>& actor, const Clutter::Vertex& linear_velocity);
+  Clutter::Vertex get_child_linear_velocity(const Glib::RefPtr<const Clutter::Actor>& actor) const;
+
+  void set_child_angular_velocity(const Glib::RefPtr<Clutter::Actor>& actor, const Clutter::Vertex& angular_velocity);
+  Clutter::Vertex get_child_angular_velocity(const Glib::RefPtr<const Clutter::Actor>& actor) const;
+
+  void set_child_is_bullet(const Glib::RefPtr<Clutter::Actor>& actor, bool is_bullet = true);
+  bool get_child_is_bullet(const Glib::RefPtr<const Clutter::Actor>& actor) const;
 
+  void set_child_mode(const Glib::RefPtr<Clutter::Actor>& actor, Type mode);
+  Type get_child_mode(const Glib::RefPtr<const Clutter::Actor>& actor) const;
 
-  _WRAP_METHOD(ClutterBox2DJoint* add_mouse_joint(const Glib::RefPtr<Clutter::Actor>& actor, ClutterVertex    *target), clutter_box2d_add_mouse_joint)
+  void set_child_manipulatable(const Glib::RefPtr<Clutter::Actor>& actor, bool manipulatable = true);
+  bool get_child_manipulatable(const Glib::RefPtr<const Clutter::Actor>& actor) const;
 
   _WRAP_PROPERTY("gravity", Clutter::Vertex)
   _WRAP_PROPERTY("simulating", bool)

Modified: clutter-box2dmm/trunk/examples/bridge/main.cc
==============================================================================
--- clutter-box2dmm/trunk/examples/bridge/main.cc	(original)
+++ clutter-box2dmm/trunk/examples/bridge/main.cc	Mon Aug 11 08:09:40 2008
@@ -3,33 +3,33 @@
 #include <iostream>
 
 static void
-add_static_box(const Glib::RefPtr<Clutter::Container>& group,
+add_static_box(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d,
                 int x, int y, int width, int height)
 {
   Glib::RefPtr<Clutter::Rectangle> rect = Clutter::Rectangle::create();
   rect->set_size(width, height);
   rect->set_position(x, y);
-  group->add_actor(rect);
 
-  group->set_child_property(rect, "mode", (int)Clutter::Box2D::BOX2D_STATIC);
+  box2d->add_actor(rect);
+  box2d->set_child_mode(rect, Clutter::Box2D::BOX2D_STATIC);
 }
 
 void
-add_cage (const Glib::RefPtr<Clutter::Container>& group, bool roof)
+add_cage(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d, bool roof)
 {
   Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default(); //TODO: There could be more than one stage.
-  int width = stage->get_width();
-  int height = stage->get_height();
+  const int width = stage->get_width();
+  const int height = stage->get_height();
 
   if(roof)
-    add_static_box(group, -100, -100, width + 200, 100);
+    add_static_box(box2d, -100, -100, width + 200, 100);
   else
-    add_static_box(group, -100, -height*(3-1)-100, width + 200, 100);
+    add_static_box(box2d, -100, -height*(3-1)-100, width + 200, 100);
  
-  add_static_box(group, -100, height, width + 200, 100);
+  add_static_box(box2d, -100, height, width + 200, 100);
 
-  add_static_box(group, -100, -(height*(5-1)) , 100, height * 5);
-  add_static_box(group, width, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, -100, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, width, -(height*(5-1)) , 100, height * 5);
 }
 
 
@@ -69,7 +69,7 @@
   rect->set_position(10, y);
   box2d->add_actor(rect);
 
-  box2d->set_child_property(rect, "mode", (int)Clutter::Box2D::BOX2D_STATIC);  //TODO: Avoid the need for the int cast.
+  box2d->set_child_mode(rect, Clutter::Box2D::BOX2D_STATIC);
 
   Glib::RefPtr<Clutter::Actor> prev_actor = rect;
 
@@ -80,11 +80,11 @@
     box->set_position(20 + 20 * i, y);
     box2d->add_actor(box);
 
-    box2d->set_child_property(box, "manipulatable", true);
-    box2d->set_child_property(box, "mode", (int)Clutter::Box2D::BOX2D_DYNAMIC);
+    box2d->set_child_manipulatable(box, true);
+    box2d->set_child_mode(box, Clutter::Box2D::BOX2D_DYNAMIC);
 
-    ClutterVertex anchor = { CLUTTER_UNITS_FROM_FLOAT (20 + 20 * i), CLUTTER_UNITS_FROM_FLOAT (y) };
-    box2d->add_revolute_joint(prev_actor, box, &anchor);
+    Clutter::Vertex anchor( CLUTTER_UNITS_FROM_FLOAT (20 + 20 * i), CLUTTER_UNITS_FROM_FLOAT (y), 0 );
+    box2d->add_revolute_joint(prev_actor, box, anchor);
    
     prev_actor = box;
   }
@@ -94,11 +94,10 @@
   box->set_position(20 + 20 * num_planks, y);
   box2d->add_actor(box);
 
-  box2d->set_child_property(box, "mode", (int)Clutter::Box2D::BOX2D_STATIC);
+  box2d->set_child_mode(box, Clutter::Box2D::BOX2D_STATIC);
 
-  ClutterVertex anchor = { CLUTTER_UNITS_FROM_FLOAT (20 + 20 * num_planks),
-             CLUTTER_UNITS_FROM_FLOAT (y) };
-  box2d->add_revolute_joint(prev_actor, box, &anchor);
+  Clutter::Vertex anchor( CLUTTER_UNITS_FROM_FLOAT (20 + 20 * num_planks), CLUTTER_UNITS_FROM_FLOAT (y), 0 );
+  box2d->add_revolute_joint(prev_actor, box, anchor);
 
   box2d->set_simulating();
 

Modified: clutter-box2dmm/trunk/examples/chain/main.cc
==============================================================================
--- clutter-box2dmm/trunk/examples/chain/main.cc	(original)
+++ clutter-box2dmm/trunk/examples/chain/main.cc	Mon Aug 11 08:09:40 2008
@@ -3,33 +3,33 @@
 #include <iostream>
 
 static void
-add_static_box(const Glib::RefPtr<Clutter::Container>& group,
+add_static_box(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d,
                 int x, int y, int width, int height)
 {
   Glib::RefPtr<Clutter::Rectangle> rect = Clutter::Rectangle::create();
   rect->set_size(width, height);
   rect->set_position(x, y);
-  group->add_actor(rect);
 
-  group->set_child_property(rect, "mode", (int)Clutter::Box2D::BOX2D_STATIC);
+  box2d->add_actor(rect);
+  box2d->set_child_mode(rect, Clutter::Box2D::BOX2D_STATIC);
 }
 
 void
-add_cage (const Glib::RefPtr<Clutter::Container>& group, bool roof)
+add_cage(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d, bool roof)
 {
   Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default(); //TODO: There could be more than one stage.
-  int width = stage->get_width();
-  int height = stage->get_height();
+  const int width = stage->get_width();
+  const int height = stage->get_height();
 
   if(roof)
-    add_static_box(group, -100, -100, width + 200, 100);
+    add_static_box(box2d, -100, -100, width + 200, 100);
   else
-    add_static_box(group, -100, -height*(3-1)-100, width + 200, 100);
+    add_static_box(box2d, -100, -height*(3-1)-100, width + 200, 100);
  
-  add_static_box(group, -100, height, width + 200, 100);
+  add_static_box(box2d, -100, height, width + 200, 100);
 
-  add_static_box(group, -100, -(height*(5-1)) , 100, height * 5);
-  add_static_box(group, width, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, -100, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, width, -(height*(5-1)) , 100, height * 5);
 }
 
 
@@ -71,7 +71,7 @@
   rect->set_position(stage->get_width() / 2, y);
   box2d->add_actor(rect);
 
-  box2d->set_child_property(rect, "mode", (int)Clutter::Box2D::BOX2D_STATIC);  //TODO: Avoid the need for the int cast.
+  box2d->set_child_mode(rect, Clutter::Box2D::BOX2D_STATIC);
 
   Glib::RefPtr<Clutter::Actor> prev_actor = rect;
 
@@ -82,12 +82,12 @@
     box->set_position(20 + 20 * i, y+=1);
     box2d->add_actor(box);
 
-    box2d->set_child_property(box, "manipulatable", true);
-    box2d->set_child_property(box, "mode", (int)Clutter::Box2D::BOX2D_DYNAMIC);
+    box2d->set_child_manipulatable(box);
+    box2d->set_child_mode(box, Clutter::Box2D::BOX2D_DYNAMIC);
 
-    ClutterVertex anchor1 = { CLUTTER_UNITS_FROM_FLOAT (18), CLUTTER_UNITS_FROM_FLOAT (0.0) };
-    ClutterVertex anchor2 = { CLUTTER_UNITS_FROM_FLOAT (0.0), CLUTTER_UNITS_FROM_FLOAT (0.0) };
-    box2d->add_revolute_joint(prev_actor, box, &anchor1, &anchor2, 0.0);
+    Clutter::Vertex anchor1( CLUTTER_UNITS_FROM_FLOAT (18), CLUTTER_UNITS_FROM_FLOAT (0.0), 0 );
+    Clutter::Vertex anchor2( CLUTTER_UNITS_FROM_FLOAT (0.0), CLUTTER_UNITS_FROM_FLOAT (0.0), 0);
+    box2d->add_revolute_joint(prev_actor, box, anchor1, anchor2, 0.0);
    
     prev_actor = box;
   }

Modified: clutter-box2dmm/trunk/examples/pyramid/main.cc
==============================================================================
--- clutter-box2dmm/trunk/examples/pyramid/main.cc	(original)
+++ clutter-box2dmm/trunk/examples/pyramid/main.cc	Mon Aug 11 08:09:40 2008
@@ -3,33 +3,33 @@
 #include <iostream>
 
 static void
-add_static_box(const Glib::RefPtr<Clutter::Container>& group,
+add_static_box(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d,
                 int x, int y, int width, int height)
 {
   Glib::RefPtr<Clutter::Rectangle> rect = Clutter::Rectangle::create();
   rect->set_size(width, height);
   rect->set_position(x, y);
-  group->add_actor(rect);
 
-  group->set_child_property(rect, "mode", (int)Clutter::Box2D::BOX2D_STATIC);
+  box2d->add_actor(rect);
+  box2d->set_child_mode(rect, Clutter::Box2D::BOX2D_STATIC);
 }
 
 void
-add_cage (const Glib::RefPtr<Clutter::Container>& group, bool roof)
+add_cage(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d, bool roof)
 {
   Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default(); //TODO: There could be more than one stage.
-  int width = stage->get_width();
-  int height = stage->get_height();
+  const int width = stage->get_width();
+  const int height = stage->get_height();
 
   if(roof)
-    add_static_box(group, -100, -100, width + 200, 100);
+    add_static_box(box2d, -100, -100, width + 200, 100);
   else
-    add_static_box(group, -100, -height*(3-1)-100, width + 200, 100);
+    add_static_box(box2d, -100, -height*(3-1)-100, width + 200, 100);
  
-  add_static_box(group, -100, height, width + 200, 100);
+  add_static_box(box2d, -100, height, width + 200, 100);
 
-  add_static_box(group, -100, -(height*(5-1)) , 100, height * 5);
-  add_static_box(group, width, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, -100, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, width, -(height*(5-1)) , 100, height * 5);
 }
 
 
@@ -79,8 +79,8 @@
       texture->set_opacity(1.0 * 255);
       texture->set_position(x, y);
 
-      box2d->set_child_property(texture, "manipulatable", true);
-      box2d->set_child_property(texture, "mode", (int)Clutter::Box2D::BOX2D_DYNAMIC);
+      box2d->set_child_manipulatable(texture);
+      box2d->set_child_mode(texture, Clutter::Box2D::BOX2D_DYNAMIC);
     }
   }
 

Modified: clutter-box2dmm/trunk/examples/slides/main.cc
==============================================================================
--- clutter-box2dmm/trunk/examples/slides/main.cc	(original)
+++ clutter-box2dmm/trunk/examples/slides/main.cc	Mon Aug 11 08:09:40 2008
@@ -3,33 +3,33 @@
 #include <iostream>
 
 static void
-add_static_box(const Glib::RefPtr<Clutter::Container>& group,
+add_static_box(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d,
                 int x, int y, int width, int height)
 {
   Glib::RefPtr<Clutter::Rectangle> rect = Clutter::Rectangle::create();
   rect->set_size(width, height);
   rect->set_position(x, y);
-  group->add_actor(rect);
 
-  group->set_child_property(rect, "mode", (int)Clutter::Box2D::BOX2D_STATIC);
+  box2d->add_actor(rect);
+  box2d->set_child_mode(rect, Clutter::Box2D::BOX2D_STATIC);
 }
 
 void
-add_cage (const Glib::RefPtr<Clutter::Container>& group, bool roof)
+add_cage(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d, bool roof)
 {
   Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default(); //TODO: There could be more than one stage.
-  int width = stage->get_width();
-  int height = stage->get_height();
+  const int width = stage->get_width();
+  const int height = stage->get_height();
 
   if(roof)
-    add_static_box(group, -100, -100, width + 200, 100);
+    add_static_box(box2d, -100, -100, width + 200, 100);
   else
-    add_static_box(group, -100, -height*(3-1)-100, width + 200, 100);
+    add_static_box(box2d, -100, -height*(3-1)-100, width + 200, 100);
  
-  add_static_box(group, -100, height, width + 200, 100);
+  add_static_box(box2d, -100, height, width + 200, 100);
 
-  add_static_box(group, -100, -(height*(5-1)) , 100, height * 5);
-  add_static_box(group, width, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, -100, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, width, -(height*(5-1)) , 100, height * 5);
 }
 
 
@@ -68,14 +68,14 @@
   ground1->set_position(0, 310);
   ground1->set_rotation(Clutter::Z_AXIS, 30.0, 128, 16, 0);
   box2d->add_actor(ground1);
-  box2d->set_child_property(ground1, "mode", (int)Clutter::Box2D::BOX2D_STATIC);  //TODO: Avoid the need for the int cast.
+  box2d->set_child_mode(ground1, Clutter::Box2D::BOX2D_STATIC);
 
   Glib::RefPtr<Clutter::Rectangle> ground2 = Clutter::Rectangle::create();
   ground2->set_size(256, 3);
   ground2->set_position(200, 200);
   ground2->set_rotation(Clutter::Z_AXIS, -30.0, 0, 0, 0);
   box2d->add_actor(ground2);
-  box2d->set_child_property(ground2, "mode", (int)Clutter::Box2D::BOX2D_STATIC);  //TODO: Avoid the need for the int cast.
+  box2d->set_child_mode(ground2, Clutter::Box2D::BOX2D_STATIC);
 
 
   for(int i = 0; i < 20; ++i)
@@ -89,8 +89,8 @@
     texture->set_opacity(1.0 * 255);
     texture->set_position(x, y);
 
-    box2d->set_child_property(texture, "manipulatable", true);
-    box2d->set_child_property(texture, "mode", (int)Clutter::Box2D::BOX2D_DYNAMIC);
+    box2d->set_child_manipulatable(texture);
+    box2d->set_child_mode(texture, Clutter::Box2D::BOX2D_DYNAMIC);
   }
 
   box2d->set_reactive();

Modified: clutter-box2dmm/trunk/examples/table/main.cc
==============================================================================
--- clutter-box2dmm/trunk/examples/table/main.cc	(original)
+++ clutter-box2dmm/trunk/examples/table/main.cc	Mon Aug 11 08:09:40 2008
@@ -3,33 +3,33 @@
 #include <iostream>
 
 static void
-add_static_box(const Glib::RefPtr<Clutter::Container>& group,
+add_static_box(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d,
                 int x, int y, int width, int height)
 {
   Glib::RefPtr<Clutter::Rectangle> rect = Clutter::Rectangle::create();
   rect->set_size(width, height);
   rect->set_position(x, y);
-  group->add_actor(rect);
 
-  group->set_child_property(rect, "mode", (int)Clutter::Box2D::BOX2D_STATIC);
+  box2d->add_actor(rect);
+  box2d->set_child_mode(rect, Clutter::Box2D::BOX2D_STATIC);
 }
 
 void
-add_cage (const Glib::RefPtr<Clutter::Container>& group, bool roof)
+add_cage(const Glib::RefPtr<Clutter::Box2D::Box2D>& box2d, bool roof)
 {
   Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default(); //TODO: There could be more than one stage.
-  int width = stage->get_width();
-  int height = stage->get_height();
+  const int width = stage->get_width();
+  const int height = stage->get_height();
 
   if(roof)
-    add_static_box(group, -100, -100, width + 200, 100);
+    add_static_box(box2d, -100, -100, width + 200, 100);
   else
-    add_static_box(group, -100, -height*(3-1)-100, width + 200, 100);
+    add_static_box(box2d, -100, -height*(3-1)-100, width + 200, 100);
  
-  add_static_box(group, -100, height, width + 200, 100);
+  add_static_box(box2d, -100, height, width + 200, 100);
 
-  add_static_box(group, -100, -(height*(5-1)) , 100, height * 5);
-  add_static_box(group, width, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, -100, -(height*(5-1)) , 100, height * 5);
+  add_static_box(box2d, width, -(height*(5-1)) , 100, height * 5);
 }
 
 
@@ -74,8 +74,8 @@
     texture->set_opacity(1.0 * 255);
     texture->set_position(x, y);
 
-    box2d->set_child_property(texture, "manipulatable", true);
-    box2d->set_child_property(texture, "mode", (int)Clutter::Box2D::BOX2D_DYNAMIC);
+    box2d->set_child_manipulatable(texture);
+    box2d->set_child_mode(texture, Clutter::Box2D::BOX2D_DYNAMIC);
   }
 
   stage->show();

Modified: clutter-box2dmm/trunk/tools/m4/convert_clutter-box2dmm.m4
==============================================================================
--- clutter-box2dmm/trunk/tools/m4/convert_clutter-box2dmm.m4	(original)
+++ clutter-box2dmm/trunk/tools/m4/convert_clutter-box2dmm.m4	Mon Aug 11 08:09:40 2008
@@ -71,3 +71,6 @@
 
 _CONVERSION(`const gchar*', `const Glib::ustring&',__GCHARP_TO_USTRING)
 
+_CONVERSION(`const Clutter::Vertex&', `const ClutterVertex*', `($3).gobj()')
+
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]