diff options
-rw-r--r-- | src/GuiLua/GuiLua.c | 16 | ||||
-rw-r--r-- | src/GuiLua/GuiLua.h | 5 | ||||
-rw-r--r-- | src/GuiLua/skang.c | 2 | ||||
-rw-r--r-- | src/extantz/ephysics_demo.c | 33 | ||||
-rw-r--r-- | src/extantz/extantz.c | 23 | ||||
-rw-r--r-- | src/extantz/extantz.h | 3 | ||||
-rw-r--r-- | src/extantz/files.c | 2 | ||||
-rw-r--r-- | src/extantz/woMan.c | 2 | ||||
-rw-r--r-- | src/libraries/winFang.c | 12 | ||||
-rw-r--r-- | src/libraries/winFang.h | 4 | ||||
-rw-r--r-- | src/purkle/purkle.c | 14 |
11 files changed, 69 insertions, 47 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index 55037e0..494be84 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -242,6 +242,7 @@ static int window(lua_State *L) | |||
242 | { | 242 | { |
243 | winFang *win = NULL; | 243 | winFang *win = NULL; |
244 | winFang *parent = NULL; | 244 | winFang *parent = NULL; |
245 | EPhysics_World *world = NULL; | ||
245 | char *name = "GuiLua"; | 246 | char *name = "GuiLua"; |
246 | char *title = "GuiLua test harness"; | 247 | char *title = "GuiLua test harness"; |
247 | int w = WIDTH, h = HEIGHT; | 248 | int w = WIDTH, h = HEIGHT; |
@@ -252,9 +253,13 @@ static int window(lua_State *L) | |||
252 | lua_getfield(L, LUA_REGISTRYINDEX, glName); | 253 | lua_getfield(L, LUA_REGISTRYINDEX, glName); |
253 | gl = lua_touserdata(L, -1); | 254 | gl = lua_touserdata(L, -1); |
254 | lua_pop(L, 1); | 255 | lua_pop(L, 1); |
255 | if (gl && gl->parent) parent = gl->parent; | 256 | if (gl) |
257 | { | ||
258 | parent = gl->parent; | ||
259 | world = gl->world; | ||
260 | } | ||
256 | 261 | ||
257 | win = winFangAdd(parent, 25, 25, w, h, title, name); | 262 | win = winFangAdd(parent, 25, 25, w, h, title, name, world); |
258 | if (gl) | 263 | if (gl) |
259 | { | 264 | { |
260 | // If there's no parent, we become the parent. | 265 | // If there's no parent, we become the parent. |
@@ -372,7 +377,7 @@ PD("GuiLua 3"); | |||
372 | return 1; | 377 | return 1; |
373 | } | 378 | } |
374 | 379 | ||
375 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent) | 380 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent, EPhysics_World *world) |
376 | { | 381 | { |
377 | GuiLua *result; | 382 | GuiLua *result; |
378 | lua_State *L; | 383 | lua_State *L; |
@@ -380,6 +385,7 @@ GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent) | |||
380 | 385 | ||
381 | result = calloc(1, sizeof(GuiLua)); | 386 | result = calloc(1, sizeof(GuiLua)); |
382 | result->parent = parent; | 387 | result->parent = parent; |
388 | result->world = world; | ||
383 | 389 | ||
384 | L = luaL_newstate(); | 390 | L = luaL_newstate(); |
385 | if (L) | 391 | if (L) |
@@ -433,12 +439,12 @@ GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent) | |||
433 | return result; | 439 | return result; |
434 | } | 440 | } |
435 | 441 | ||
436 | void GuiLuaLoad(char *module, winFang *parent) | 442 | void GuiLuaLoad(char *module, winFang *parent, EPhysics_World *world) |
437 | { | 443 | { |
438 | char *args[] = {"GuiLUa", "-l", ""}; | 444 | char *args[] = {"GuiLUa", "-l", ""}; |
439 | 445 | ||
440 | args[2] = module; | 446 | args[2] = module; |
441 | GuiLuaDo(3, args, parent); | 447 | GuiLuaDo(3, args, parent, world); |
442 | } | 448 | } |
443 | 449 | ||
444 | void GuiLuaDel(GuiLua *gl) | 450 | void GuiLuaDel(GuiLua *gl) |
diff --git a/src/GuiLua/GuiLua.h b/src/GuiLua/GuiLua.h index b123fe7..3bd2baf 100644 --- a/src/GuiLua/GuiLua.h +++ b/src/GuiLua/GuiLua.h | |||
@@ -20,6 +20,7 @@ typedef struct _GuiLua | |||
20 | lua_State *L; | 20 | lua_State *L; |
21 | winFang *us; // Our window, if it exists. | 21 | winFang *us; // Our window, if it exists. |
22 | winFang *parent; // Our parent window, if it exists. | 22 | winFang *parent; // Our parent window, if it exists. |
23 | EPhysics_World *world; // Our world, if it exists. | ||
23 | int inDel; | 24 | int inDel; |
24 | 25 | ||
25 | Eina_Clist node; | 26 | Eina_Clist node; |
@@ -29,8 +30,8 @@ typedef struct _GuiLua | |||
29 | 30 | ||
30 | extern const char *glName; | 31 | extern const char *glName; |
31 | 32 | ||
32 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent); | 33 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent, EPhysics_World *world); |
33 | void GuiLuaLoad(char *module, winFang *parent); | 34 | void GuiLuaLoad(char *module, winFang *parent, EPhysics_World *world); |
34 | void GuiLuaDel(GuiLua *gl); | 35 | void GuiLuaDel(GuiLua *gl); |
35 | 36 | ||
36 | #endif | 37 | #endif |
diff --git a/src/GuiLua/skang.c b/src/GuiLua/skang.c index ed6d31f..c116f30 100644 --- a/src/GuiLua/skang.c +++ b/src/GuiLua/skang.c | |||
@@ -5,7 +5,7 @@ | |||
5 | EAPI_MAIN int elm_main(int argc, char **argv) | 5 | EAPI_MAIN int elm_main(int argc, char **argv) |
6 | { | 6 | { |
7 | HamrTime(elm_main, "GuiLua"); | 7 | HamrTime(elm_main, "GuiLua"); |
8 | GuiLuaDo(argc, argv, NULL); | 8 | GuiLuaDo(argc, argv, NULL, NULL); |
9 | 9 | ||
10 | return 0; | 10 | return 0; |
11 | } | 11 | } |
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 | ||
9 | EPhysics_World *ephysicsAdd(globals *ourGlobals) | 7 | EPhysics_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 | ||
404 | EAPI_MAIN int elm_main(int argc, char **argv) | 406 | EAPI_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); |
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index a52d01c..205cedb 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -72,7 +72,7 @@ void winFangShow(winFang *win) | |||
72 | evas_object_show(win->hand[i]); | 72 | evas_object_show(win->hand[i]); |
73 | } | 73 | } |
74 | 74 | ||
75 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name) | 75 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world) |
76 | { | 76 | { |
77 | winFang *result; | 77 | winFang *result; |
78 | Evas_Object *obj, *obj2; | 78 | Evas_Object *obj, *obj2; |
@@ -143,6 +143,16 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
143 | eo_unref(result->hand[i]); | 143 | eo_unref(result->hand[i]); |
144 | #endif | 144 | #endif |
145 | } | 145 | } |
146 | if (world) | ||
147 | { | ||
148 | result->body = ephysics_body_box_add(world); | ||
149 | ephysics_body_evas_object_set(result->body, obj, EINA_TRUE); | ||
150 | ephysics_body_restitution_set(result->body, 0.7); | ||
151 | ephysics_body_friction_set(result->body, 0); | ||
152 | ephysics_body_linear_velocity_set(result->body, 80, -60, 0); | ||
153 | ephysics_body_angular_velocity_set(result->body, 0, 0, 360); | ||
154 | ephysics_body_sleeping_threshold_set(result->body, 0.1, 0.1); | ||
155 | } | ||
146 | } | 156 | } |
147 | else | 157 | else |
148 | { | 158 | { |
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h index 05c3036..a84c8de 100644 --- a/src/libraries/winFang.h +++ b/src/libraries/winFang.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <Eina.h> | 13 | #include <Eina.h> |
14 | #include <Evas.h> | 14 | #include <Evas.h> |
15 | #include <Elementary.h> | 15 | #include <Elementary.h> |
16 | #include <EPhysics.h> | ||
16 | 17 | ||
17 | 18 | ||
18 | typedef struct _winFang | 19 | typedef struct _winFang |
@@ -20,6 +21,7 @@ typedef struct _winFang | |||
20 | Evas_Object *win; | 21 | Evas_Object *win; |
21 | Evas_Object *bg; | 22 | Evas_Object *bg; |
22 | Evas_Object *box; | 23 | Evas_Object *box; |
24 | EPhysics_Body *body; | ||
23 | Eina_Clist widgets; | 25 | Eina_Clist widgets; |
24 | Eina_Clist winFangs; | 26 | Eina_Clist winFangs; |
25 | int x, y, w, h; | 27 | int x, y, w, h; |
@@ -48,7 +50,7 @@ typedef struct _Widget | |||
48 | Evas_Smart_Cb on_del; | 50 | Evas_Smart_Cb on_del; |
49 | } Widget; | 51 | } Widget; |
50 | 52 | ||
51 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name); | 53 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world); |
52 | void winFangHide(winFang *win); | 54 | void winFangHide(winFang *win); |
53 | void winFangShow(winFang *win); | 55 | void winFangShow(winFang *win); |
54 | void winFangDel(winFang *win); | 56 | void winFangDel(winFang *win); |
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c index 971ad37..8ea012c 100644 --- a/src/purkle/purkle.c +++ b/src/purkle/purkle.c | |||
@@ -13,13 +13,13 @@ static void _on_entry_del(void *data, Evas_Object *obj, void *event_info) | |||
13 | elm_entry_editable_set(obj, EINA_FALSE); | 13 | elm_entry_editable_set(obj, EINA_FALSE); |
14 | } | 14 | } |
15 | 15 | ||
16 | static winFang *purkleAdd(winFang *parent, int w, int h) | 16 | static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world) |
17 | { | 17 | { |
18 | winFang *me; | 18 | winFang *me; |
19 | Widget *wid; | 19 | Widget *wid; |
20 | Evas_Object *en; | 20 | Evas_Object *en; |
21 | 21 | ||
22 | me = winFangAdd(parent, 30, 520, w, h, "chatter box", "purkle"); | 22 | me = winFangAdd(parent, 30, 520, w, h, "chatter box", "purkle", world); |
23 | 23 | ||
24 | en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win, | 24 | en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win, |
25 | elm_obj_entry_scrollable_set(EINA_TRUE), | 25 | elm_obj_entry_scrollable_set(EINA_TRUE), |
@@ -52,7 +52,7 @@ int luaopen_purkle(lua_State *L) | |||
52 | { | 52 | { |
53 | GuiLua *gl; | 53 | GuiLua *gl; |
54 | winFang *parent = NULL; | 54 | winFang *parent = NULL; |
55 | 55 | EPhysics_World *world = NULL; | |
56 | 56 | ||
57 | // local skang = require 'skang' | 57 | // local skang = require 'skang' |
58 | lua_getglobal(L, "require"); | 58 | lua_getglobal(L, "require"); |
@@ -71,9 +71,13 @@ int luaopen_purkle(lua_State *L) | |||
71 | lua_getfield(L, LUA_REGISTRYINDEX, glName); | 71 | lua_getfield(L, LUA_REGISTRYINDEX, glName); |
72 | gl = lua_touserdata(L, -1); | 72 | gl = lua_touserdata(L, -1); |
73 | lua_pop(L, 1); | 73 | lua_pop(L, 1); |
74 | if (gl && gl->parent) parent = gl->parent; | 74 | if (gl) |
75 | { | ||
76 | parent = gl->parent; | ||
77 | world = gl->world; | ||
78 | } | ||
75 | 79 | ||
76 | purkleAdd(parent, 300, 400); | 80 | purkleAdd(parent, 300, 400, world); |
77 | 81 | ||
78 | push_lua(L, "@ ( = )", skang, MODULEEND, _M, 0); | 82 | push_lua(L, "@ ( = )", skang, MODULEEND, _M, 0); |
79 | 83 | ||