aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz
diff options
context:
space:
mode:
Diffstat (limited to 'src/extantz')
-rw-r--r--src/extantz/ephysics_demo.c33
-rw-r--r--src/extantz/extantz.c23
-rw-r--r--src/extantz/extantz.h3
-rw-r--r--src/extantz/files.c2
-rw-r--r--src/extantz/woMan.c2
5 files changed, 31 insertions, 32 deletions
diff --git a/src/extantz/ephysics_demo.c b/src/extantz/ephysics_demo.c
index 6697cc9..4655dbb 100644
--- a/src/extantz/ephysics_demo.c
+++ b/src/extantz/ephysics_demo.c
@@ -2,8 +2,6 @@
2#include <EPhysics.h> 2#include <EPhysics.h>
3 3
4 4
5#if USE_PHYSICS
6
7#define EPHYSICS_TEST_THEME "extantz" 5#define EPHYSICS_TEST_THEME "extantz"
8 6
9EPhysics_World *ephysicsAdd(globals *ourGlobals) 7EPhysics_World *ephysicsAdd(globals *ourGlobals)
@@ -34,37 +32,42 @@ EPhysics_World *ephysicsAdd(globals *ourGlobals)
34 ephysics_body_restitution_set(boundary, 1); 32 ephysics_body_restitution_set(boundary, 1);
35 ephysics_body_friction_set(boundary, 0); 33 ephysics_body_friction_set(boundary, 0);
36 34
37 box1 = elm_image_add(ourGlobals->win);
38 sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); 35 sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME);
39 elm_image_file_set(box1, strdup(buf), "blue-cube"); 36 box1 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win,
40 evas_object_move(box1, ourGlobals->win_w / 2 - 80, ourGlobals->win_h - 200); 37 elm_obj_image_file_set(strdup(buf), "blue-cube"),
41 evas_object_resize(box1, 70, 70); 38 evas_obj_size_set(70, 70),
42 evas_object_show(box1); 39 evas_obj_position_set(ourGlobals->win_w / 2 - 80, ourGlobals->win_h - 200),
40 evas_obj_visibility_set(EINA_TRUE)
41 );
43 42
44 box_body1 = ephysics_body_box_add(world); 43 box_body1 = ephysics_body_box_add(world);
45 ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE); 44 ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE);
46 ephysics_body_restitution_set(box_body1, 0.7); 45 ephysics_body_restitution_set(box_body1, 0.7);
47 ephysics_body_friction_set(box_body1, 0); 46 ephysics_body_friction_set(box_body1, 0);
48 ephysics_body_linear_velocity_set(box_body1, -150, 200, 0); 47 ephysics_body_linear_velocity_set(box_body1, -1500, 2000, 0);
49 ephysics_body_angular_velocity_set(box_body1, 0, 0, 36); 48 ephysics_body_angular_velocity_set(box_body1, 0, 0, 36);
50 ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); 49 ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1);
50 eo_unref(box1);
51
51 52
52 box2 = elm_image_add(ourGlobals->win); 53 sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME);
53 elm_image_file_set(box2, strdup(buf), "purple-cube"); 54 box2 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win,
54 evas_object_move(box2, ourGlobals->win_w / 2 + 10, ourGlobals->win_h - 200); 55 elm_obj_image_file_set(strdup(buf), "purple-cube"),
55 evas_object_resize(box2, 70, 70); 56 evas_obj_size_set(70, 70),
56 evas_object_show(box2); 57 evas_obj_position_set(ourGlobals->win_w / 2 + 10, ourGlobals->win_h - 200),
58 evas_obj_visibility_set(EINA_TRUE)
59 );
57 60
58 box_body2 = ephysics_body_box_add(world); 61 box_body2 = ephysics_body_box_add(world);
59 ephysics_body_evas_object_set(box_body2, box2, EINA_TRUE); 62 ephysics_body_evas_object_set(box_body2, box2, EINA_TRUE);
60 ephysics_body_restitution_set(box_body2, 0.7); 63 ephysics_body_restitution_set(box_body2, 0.7);
61 ephysics_body_friction_set(box_body2, 0); 64 ephysics_body_friction_set(box_body2, 0);
62 ephysics_body_linear_velocity_set(box_body2, 80, -60, 0); 65 ephysics_body_linear_velocity_set(box_body2, 800, -600, 0);
63 ephysics_body_angular_velocity_set(box_body2, 0, 0, 360); 66 ephysics_body_angular_velocity_set(box_body2, 0, 0, 360);
64 ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1); 67 ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1);
68 eo_unref(box2);
65 69
66 ephysics_world_gravity_set(world, 0, 0, 0); 70 ephysics_world_gravity_set(world, 0, 0, 0);
67 71
68 return world; 72 return world;
69} 73}
70#endif
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c
index 5fb88f4..03979ab 100644
--- a/src/extantz/extantz.c
+++ b/src/extantz/extantz.c
@@ -89,6 +89,8 @@ static void _on_resize(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA
89 evas_obj_size_hint_min_get(NULL, &h), 89 evas_obj_size_hint_min_get(NULL, &h),
90 evas_obj_size_set(ourGlobals->win_w, h) 90 evas_obj_size_set(ourGlobals->win_w, h)
91 ); 91 );
92 if (ourGlobals->world)
93 ephysics_world_render_geometry_set(ourGlobals->world, 0, 0, -50, ourGlobals->win_w, ourGlobals->win_h, 100);
92 _resize(gld); 94 _resize(gld);
93} 95}
94 96
@@ -403,7 +405,6 @@ void overlay_add(globals *ourGlobals)
403 405
404EAPI_MAIN int elm_main(int argc, char **argv) 406EAPI_MAIN int elm_main(int argc, char **argv)
405{ 407{
406 EPhysics_World *world;
407 GLData *gld = NULL; 408 GLData *gld = NULL;
408 char buf[PATH_MAX]; 409 char buf[PATH_MAX];
409// Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't. 410// Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't.
@@ -435,17 +436,15 @@ EAPI_MAIN int elm_main(int argc, char **argv)
435 elm_config_finger_size_set(0); 436 elm_config_finger_size_set(0);
436 elm_config_scale_set(1.0); 437 elm_config_scale_set(1.0);
437 438
438#if USE_PHYSICS
439 if (!ephysics_init()) 439 if (!ephysics_init())
440 return 1; 440 return 1;
441#endif
442 441
443 gld = &ourGlobals.gld; 442 gld = &ourGlobals.gld;
444 gldata_init(gld); 443 gldata_init(gld);
445 444
446 // Set the engine to opengl_x11, then open our window. 445 // Set the engine to opengl_x11, then open our window.
447 elm_config_preferred_engine_set("opengl_x11"); 446 elm_config_preferred_engine_set("opengl_x11");
448 ourGlobals.mainWindow = winFangAdd(NULL, 0, 0, 50, 20, "extantz virtual world viewer", "extantz"); 447 ourGlobals.mainWindow = winFangAdd(NULL, 0, 0, 50, 20, "extantz virtual world viewer", "extantz", NULL);
449 // Set preferred engine back to default from config 448 // Set preferred engine back to default from config
450 elm_config_preferred_engine_set(NULL); 449 elm_config_preferred_engine_set(NULL);
451 450
@@ -514,17 +513,15 @@ EAPI_MAIN int elm_main(int argc, char **argv)
514 // Also, GL focus gets lost when any menu is used. sigh 513 // Also, GL focus gets lost when any menu is used. sigh
515 makeMainMenu(&ourGlobals); 514 makeMainMenu(&ourGlobals);
516 515
516 ourGlobals.world = ephysicsAdd(&ourGlobals);
517
517// overlay_add(&ourGlobals); 518// overlay_add(&ourGlobals);
518 GuiLuaLoad("test", ourGlobals.mainWindow); 519 GuiLuaLoad("test", ourGlobals.mainWindow, ourGlobals.world);
519 woMan_add(&ourGlobals); 520 woMan_add(&ourGlobals);
520 GuiLuaLoad("purkle", ourGlobals.mainWindow); 521 GuiLuaLoad("purkle", ourGlobals.mainWindow, ourGlobals.world);
521 ourGlobals.files = filesAdd(&ourGlobals, (char *) elm_app_data_dir_get(), EINA_TRUE, EINA_FALSE); 522 ourGlobals.files = filesAdd(&ourGlobals, (char *) elm_app_data_dir_get(), EINA_TRUE, EINA_FALSE);
522 523
523#if USE_PHYSICS 524 // Bump the top toolbar above the windows.
524 world = ephysicsAdd(&ourGlobals);
525#endif
526
527 // Bump the top toolbar above the windows.
528 evas_object_raise(ourGlobals.tb); 525 evas_object_raise(ourGlobals.tb);
529 526
530 evas_object_show(ourGlobals.mainWindow->box); 527 evas_object_show(ourGlobals.mainWindow->box);
@@ -532,10 +529,8 @@ EAPI_MAIN int elm_main(int argc, char **argv)
532 529
533 elm_run(); 530 elm_run();
534 531
535#if USE_PHYSICS 532 ephysics_world_del(ourGlobals.world);
536 ephysics_world_del(world);
537 ephysics_shutdown(); 533 ephysics_shutdown();
538#endif
539 534
540 if (ourGlobals.win) 535 if (ourGlobals.win)
541 { 536 {
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h
index 684b53d..5b172c2 100644
--- a/src/extantz/extantz.h
+++ b/src/extantz/extantz.h
@@ -1,7 +1,6 @@
1#ifndef _EXTANTZ_H_ 1#ifndef _EXTANTZ_H_
2#define _EXTANTZ_H_ 2#define _EXTANTZ_H_
3 3
4#define USE_PHYSICS 1
5#define USE_IRR 0 4#define USE_IRR 0
6#define USE_DEMO 1 5#define USE_DEMO 1
7#define DO_GEARS 0 6#define DO_GEARS 0
@@ -225,6 +224,8 @@ typedef struct _globals
225 GLData gld; 224 GLData gld;
226 Scene_Data *scene; 225 Scene_Data *scene;
227 226
227 EPhysics_World *world;
228
228 winFang *files; 229 winFang *files;
229} globals; 230} globals;
230 231
diff --git a/src/extantz/files.c b/src/extantz/files.c
index 7dd08fa..3aeb7f9 100644
--- a/src/extantz/files.c
+++ b/src/extantz/files.c
@@ -146,7 +146,7 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa
146 Widget *wid; 146 Widget *wid;
147 Evas_Object *vbox, *fs, *bt, *rd = NULL, *rdg = NULL, *hoversel; 147 Evas_Object *vbox, *fs, *bt, *rd = NULL, *rdg = NULL, *hoversel;
148 148
149 me = winFangAdd(ourGlobals->mainWindow, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 350, 500, "file selector", "files"); 149 me = winFangAdd(ourGlobals->mainWindow, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 350, 500, "file selector", "files", ourGlobals->world);
150 150
151 wid = widgetAdd(me, ELM_OBJ_FILESELECTOR_CLASS, me->box, NULL); 151 wid = widgetAdd(me, ELM_OBJ_FILESELECTOR_CLASS, me->box, NULL);
152 fs = wid->obj; 152 fs = wid->obj;
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c
index cd1d5c8..2911686 100644
--- a/src/extantz/woMan.c
+++ b/src/extantz/woMan.c
@@ -159,7 +159,7 @@ winFang *woMan_add(globals *ourGlobals)
159 char buf[PATH_MAX]; 159 char buf[PATH_MAX];
160 int i; 160 int i;
161 161
162 me = winFangAdd(ourGlobals->mainWindow, 30, 150, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "virtual world manager", "woMan"); 162 me = winFangAdd(ourGlobals->mainWindow, 30, 150, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "virtual world manager", "woMan", ourGlobals->world);
163 163
164 // A tab thingy. 164 // A tab thingy.
165 tb = elm_toolbar_add(me->win); 165 tb = elm_toolbar_add(me->win);