edje: add very basic physics example
authorBruno Dilly <bdilly@profusion.mobi>
Wed, 28 Nov 2012 22:39:00 +0000 (22:39 +0000)
committerBruno Dilly <bdilly@profusion.mobi>
Wed, 28 Nov 2012 22:39:00 +0000 (22:39 +0000)
Just two bodies falling (a circle and a box) and colliding
to the floor.

bug: when edje is resized objects will be moved back to original
position.

SVN revision: 79794

legacy/edje/configure.ac
legacy/edje/src/examples/Makefile.am
legacy/edje/src/examples/physics_basic.edc [new file with mode: 0644]

index f3179ac..2b193b0 100644 (file)
@@ -346,6 +346,7 @@ fi
 if test "x${want_ephysics}" = "xyes" -a "x${have_ephysics}" = "xno"; then
    AC_MSG_ERROR([EPhysics required, but not found])
 fi
+AM_CONDITIONAL([ENABLE_EPHYSICS], [test "x${have_ephysics}" != "xno"])
 
 
 # Enable Multisense use
index 7ad48bf..3f12089 100644 (file)
@@ -52,6 +52,10 @@ if ENABLE_MULTISENSE
 EDCS += multisense.edc
 endif
 
+if ENABLE_EPHYSICS
+EDCS += physics_basic.edc
+endif
+
 .edc.edj:
        $(EDJE_CC) $(EDJE_CC_FLAGS) $(SND_DIR) $< $(builddir)/$(@F)
 
diff --git a/legacy/edje/src/examples/physics_basic.edc b/legacy/edje/src/examples/physics_basic.edc
new file mode 100644 (file)
index 0000000..cc98fdc
--- /dev/null
@@ -0,0 +1,64 @@
+collections {
+
+   images {
+      image: "bubble-blue.png" COMP;
+   }
+
+   group {
+      name: "example_group";
+      min: 100 100;
+
+      parts {
+         part {
+            name: "background";
+            type: RECT;
+            physics_body: NONE;
+            description {
+               state: "default" 0.0;
+               color: 255 255 255 255; /* white */
+               rel1.relative: 0.0 0.0;
+               rel2.relative: 1.0 1.0;
+            }
+         }
+
+         part {
+            name: "red_box";
+            type: RECT;
+            physics_body: RIGID_BOX;
+            description {
+               state: "default" 0.0;
+               color: 255 0 0 255; /* red */
+               rel1.relative: 0.55 0.1;
+               rel2.relative: 0.75 0.3;
+               aspect: 1 1;
+            }
+         }
+
+         part {
+            name: "blue_circle";
+            type: IMAGE;
+            physics_body: RIGID_CIRCLE;
+            description {
+               state: "default" 0.0;
+               rel1.relative: 0.25 0.1;
+               rel2.relative: 0.45 0.3;
+               aspect: 1 1;
+               image {
+                  normal: "bubble-blue.png";
+               }
+            }
+         }
+
+         part {
+            name: "floor";
+            type: RECT;
+            physics_body: BOUNDARY_BOTTOM;
+            description {
+               state: "default" 0.0;
+               visible: 0;
+            }
+         }
+      }
+
+   }
+}