[clutter-box2d] Exposed the box2d b2Body->fixedRotation property as a clutter-box2d-child is-fixed-rotation propert



commit 1792b692fb640b08690185c9c07ec47f02a0653b
Author: Aidan Delaney <aidan phoric eu>
Date:   Mon May 7 20:32:19 2012 +0100

    	Exposed the box2d b2Body->fixedRotation property as a clutter-box2d-child is-fixed-rotation property

 clutter-box2d/clutter-box2d-child.cpp |   29 +++++++++++++++++++++++++++++
 clutter-box2d/clutter-box2d-child.h   |    6 ++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/clutter-box2d/clutter-box2d-child.cpp b/clutter-box2d/clutter-box2d-child.cpp
index 2d3eb71..1d11d99 100644
--- a/clutter-box2d/clutter-box2d-child.cpp
+++ b/clutter-box2d/clutter-box2d-child.cpp
@@ -35,6 +35,7 @@ enum
 {
   PROP_0,
   PROP_IS_BULLET,
+  PROP_IS_FIXED_ROTATION,
   PROP_IS_CIRCLE,
   PROP_OUTLINE,
   PROP_DENSITY,
@@ -72,6 +73,12 @@ clutter_box2d_child_is_bullet (ClutterBox2DChild *box2d_child)
   return box2d_child->priv->body->IsBullet ();
 }
 
+static gboolean
+clutter_box2d_child_is_fixed_rotation (ClutterBox2DChild *box2d_child)
+{
+  return box2d_child->priv->body->IsFixedRotation ();
+}
+
 static void
 clutter_box2d_child_set_type2 (ClutterBox2DChild *box2d_child,
                                ClutterBox2DType   type)
@@ -207,6 +214,22 @@ clutter_box2d_child_set_is_bullet_internal (ClutterBox2DChild *box2d_child,
 }
 
 static void
+clutter_box2d_child_set_is_fixed_rotation_internal (ClutterBox2DChild *box2d_child,
+						    gboolean           is_fixed_rotation)
+{
+  ClutterBox2D *box2d = CLUTTER_BOX2D (clutter_child_meta_get_container (
+                                       CLUTTER_CHILD_META (box2d_child)));
+  _clutter_box2d_sync_body (box2d, box2d_child);
+
+  if (!box2d_child->priv->body ||
+      box2d_child->priv->body->IsFixedRotation () == is_fixed_rotation)
+    return;
+
+  box2d_child->priv->body->SetFixedRotation (is_fixed_rotation);
+  g_object_notify (G_OBJECT (box2d_child), "is-fixed-rotation");
+}
+
+static void
 clutter_box2d_child_set_is_circle_internal (ClutterBox2DChild *box2d_child,
                                             gboolean           is_circle)
 {
@@ -299,6 +322,12 @@ clutter_box2d_child_set_property (GObject      *gobject,
                                                   g_value_get_boolean (value));
       break;
 
+    case PROP_IS_FIXED_ROTATION:
+      clutter_box2d_child_set_is_fixed_rotation_internal (box2d_child,
+							  g_value_get_boolean (value));
+      break;
+
+
     case PROP_IS_CIRCLE:
       clutter_box2d_child_set_is_circle_internal (box2d_child,
                                                   g_value_get_boolean (value));
diff --git a/clutter-box2d/clutter-box2d-child.h b/clutter-box2d/clutter-box2d-child.h
index a78edb2..8dfcc0d 100644
--- a/clutter-box2d/clutter-box2d-child.h
+++ b/clutter-box2d/clutter-box2d-child.h
@@ -71,6 +71,12 @@ void clutter_box2d_child_set_is_bullet (ClutterBox2D *box2d,
 gboolean clutter_box2d_child_get_is_bullet (ClutterBox2D *box2d,
                                             ClutterActor *child);
 
+void clutter_box2d_child_set_is_fixed_rotation (ClutterBox2D *box2d,
+						ClutterActor *child,
+						gboolean      is_fixed_rotation);
+gboolean clutter_box2d_child_get_is_fixed_rotation (ClutterBox2D *box2d,
+						    ClutterActor *child);
+
 void clutter_box2d_child_set_is_circle (ClutterBox2D *box2d,
                                         ClutterActor *child,
                                         gboolean      is_circle);



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