diff options
author | David Walter Seikel | 2014-05-03 18:33:58 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-03 18:33:58 +1000 |
commit | 3c0fb329ecc4a719bd8d80257298d08f80b1bfd3 (patch) | |
tree | a0bb12ea6772588b90b0d26c855aeb802b6e56c3 | |
parent | Remove Evas_3d example stuff from GuiLua, now that it's in extantz. (diff) | |
download | SledjHamr-3c0fb329ecc4a719bd8d80257298d08f80b1bfd3.zip SledjHamr-3c0fb329ecc4a719bd8d80257298d08f80b1bfd3.tar.gz SledjHamr-3c0fb329ecc4a719bd8d80257298d08f80b1bfd3.tar.bz2 SledjHamr-3c0fb329ecc4a719bd8d80257298d08f80b1bfd3.tar.xz |
Move non GL_View stuff from gld -> ourGlobals. Plus some white space fixes.
-rw-r--r-- | src/extantz/chat.c | 80 | ||||
-rw-r--r-- | src/extantz/ephysics_demo.c | 120 | ||||
-rw-r--r-- | src/extantz/extantz.c | 170 | ||||
-rw-r--r-- | src/extantz/extantz.h | 50 | ||||
-rw-r--r-- | src/extantz/fangWin.c | 138 | ||||
-rw-r--r-- | src/extantz/woMan.c | 17 |
6 files changed, 287 insertions, 288 deletions
diff --git a/src/extantz/chat.c b/src/extantz/chat.c index e8a0c4d..12f4d20 100644 --- a/src/extantz/chat.c +++ b/src/extantz/chat.c | |||
@@ -1,47 +1,47 @@ | |||
1 | #include "extantz.h" | 1 | #include "extantz.h" |
2 | 2 | ||
3 | 3 | ||
4 | void chat_add(GLData *gld) | 4 | void chat_add(globals *ourGlobals) |
5 | { | 5 | { |
6 | Evas_Object *win, *bx, *en; | 6 | Evas_Object *win, *bx, *en; |
7 | 7 | ||
8 | win = fang_win_add(gld); | 8 | win = fang_win_add(ourGlobals); |
9 | 9 | ||
10 | bx = eo_add(ELM_OBJ_BOX_CLASS, win); | 10 | bx = eo_add(ELM_OBJ_BOX_CLASS, win); |
11 | eo_do(bx, | 11 | eo_do(bx, |
12 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 12 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
13 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL) | 13 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL) |
14 | ); | 14 | ); |
15 | elm_win_resize_object_add(win, bx); | 15 | elm_win_resize_object_add(win, bx); |
16 | 16 | ||
17 | en = eo_add(ELM_OBJ_ENTRY_CLASS, win); | 17 | en = eo_add(ELM_OBJ_ENTRY_CLASS, win); |
18 | elm_object_text_set(en, "History is shown here"); | 18 | elm_object_text_set(en, "History is shown here"); |
19 | eo_do(en, | 19 | eo_do(en, |
20 | elm_obj_entry_scrollable_set(EINA_TRUE), | 20 | elm_obj_entry_scrollable_set(EINA_TRUE), |
21 | elm_obj_entry_editable_set(EINA_FALSE), | 21 | elm_obj_entry_editable_set(EINA_FALSE), |
22 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 22 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
23 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 23 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
24 | evas_obj_visibility_set(EINA_TRUE) | 24 | evas_obj_visibility_set(EINA_TRUE) |
25 | ); | 25 | ); |
26 | elm_box_pack_end(bx, en); | 26 | elm_box_pack_end(bx, en); |
27 | eo_unref(en); | 27 | eo_unref(en); |
28 | 28 | ||
29 | en = eo_add(ELM_OBJ_ENTRY_CLASS, win); | 29 | en = eo_add(ELM_OBJ_ENTRY_CLASS, win); |
30 | elm_object_text_set(en, ""); | 30 | elm_object_text_set(en, ""); |
31 | eo_do(en, | 31 | eo_do(en, |
32 | elm_obj_entry_scrollable_set(EINA_TRUE), | 32 | elm_obj_entry_scrollable_set(EINA_TRUE), |
33 | // TODO - Setting editable to TRUE is what hangs up extantz on exit. | 33 | // TODO - Setting editable to TRUE is what hangs up extantz on exit. |
34 | // elm_obj_entry_editable_set(EINA_TRUE), | 34 | // elm_obj_entry_editable_set(EINA_TRUE), |
35 | elm_obj_entry_editable_set(EINA_FALSE), | 35 | elm_obj_entry_editable_set(EINA_FALSE), |
36 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 36 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
37 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 37 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
38 | evas_obj_visibility_set(EINA_TRUE) | 38 | evas_obj_visibility_set(EINA_TRUE) |
39 | ); | 39 | ); |
40 | elm_box_pack_end(bx, en); | 40 | elm_box_pack_end(bx, en); |
41 | eo_unref(en); | 41 | eo_unref(en); |
42 | 42 | ||
43 | evas_object_show(bx); | 43 | evas_object_show(bx); |
44 | eo_unref(bx); | 44 | eo_unref(bx); |
45 | 45 | ||
46 | fang_win_complete(gld, win, 30, 500, gld->win_w / 3, gld->win_h / 3); | 46 | fang_win_complete(ourGlobals, win, 30, 500, ourGlobals->win_w / 3, ourGlobals->win_h / 3); |
47 | } | 47 | } |
diff --git a/src/extantz/ephysics_demo.c b/src/extantz/ephysics_demo.c index e3aa62f..a47ca17 100644 --- a/src/extantz/ephysics_demo.c +++ b/src/extantz/ephysics_demo.c | |||
@@ -5,65 +5,67 @@ | |||
5 | 5 | ||
6 | #define EPHYSICS_TEST_THEME "extantz" | 6 | #define EPHYSICS_TEST_THEME "extantz" |
7 | 7 | ||
8 | EPhysics_World *ephysicsAdd(GLData *gld) | 8 | EPhysics_World *ephysicsAdd(globals *ourGlobals) |
9 | { | 9 | { |
10 | EPhysics_Body *boundary; | 10 | // GLData *gld = &ourGlobals->gld; |
11 | EPhysics_World *world; | 11 | |
12 | EPhysics_Body *box_body1, *box_body2; | 12 | EPhysics_Body *boundary; |
13 | Evas_Object *box1, *box2; | 13 | EPhysics_World *world; |
14 | char buf[PATH_MAX]; | 14 | EPhysics_Body *box_body1, *box_body2; |
15 | 15 | Evas_Object *box1, *box2; | |
16 | // ePhysics stuff. | 16 | char buf[PATH_MAX]; |
17 | world = ephysics_world_new(); | 17 | |
18 | ephysics_world_render_geometry_set(world, 0, 0, -50, gld->win_w, gld->win_h, 100); | 18 | // ePhysics stuff. |
19 | 19 | world = ephysics_world_new(); | |
20 | boundary = ephysics_body_bottom_boundary_add(world); | 20 | ephysics_world_render_geometry_set(world, 0, 0, -50, ourGlobals->win_w, ourGlobals->win_h, 100); |
21 | ephysics_body_restitution_set(boundary, 1); | 21 | |
22 | ephysics_body_friction_set(boundary, 0); | 22 | boundary = ephysics_body_bottom_boundary_add(world); |
23 | 23 | ephysics_body_restitution_set(boundary, 1); | |
24 | boundary = ephysics_body_top_boundary_add(world); | 24 | ephysics_body_friction_set(boundary, 0); |
25 | ephysics_body_restitution_set(boundary, 1); | 25 | |
26 | ephysics_body_friction_set(boundary, 0); | 26 | boundary = ephysics_body_top_boundary_add(world); |
27 | 27 | ephysics_body_restitution_set(boundary, 1); | |
28 | boundary = ephysics_body_left_boundary_add(world); | 28 | ephysics_body_friction_set(boundary, 0); |
29 | ephysics_body_restitution_set(boundary, 1); | 29 | |
30 | ephysics_body_friction_set(boundary, 0); | 30 | boundary = ephysics_body_left_boundary_add(world); |
31 | 31 | ephysics_body_restitution_set(boundary, 1); | |
32 | boundary = ephysics_body_right_boundary_add(world); | 32 | ephysics_body_friction_set(boundary, 0); |
33 | ephysics_body_restitution_set(boundary, 1); | 33 | |
34 | ephysics_body_friction_set(boundary, 0); | 34 | boundary = ephysics_body_right_boundary_add(world); |
35 | 35 | ephysics_body_restitution_set(boundary, 1); | |
36 | box1 = elm_image_add(gld->win); | 36 | ephysics_body_friction_set(boundary, 0); |
37 | sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); | 37 | |
38 | elm_image_file_set(box1, strdup(buf), "blue-cube"); | 38 | box1 = elm_image_add(ourGlobals->win); |
39 | evas_object_move(box1, gld->win_w / 2 - 80, gld->win_h - 200); | 39 | sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); |
40 | evas_object_resize(box1, 70, 70); | 40 | elm_image_file_set(box1, strdup(buf), "blue-cube"); |
41 | evas_object_show(box1); | 41 | evas_object_move(box1, ourGlobals->win_w / 2 - 80, ourGlobals->win_h - 200); |
42 | 42 | evas_object_resize(box1, 70, 70); | |
43 | box_body1 = ephysics_body_box_add(world); | 43 | evas_object_show(box1); |
44 | ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE); | 44 | |
45 | ephysics_body_restitution_set(box_body1, 0.7); | 45 | box_body1 = ephysics_body_box_add(world); |
46 | ephysics_body_friction_set(box_body1, 0); | 46 | ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE); |
47 | ephysics_body_linear_velocity_set(box_body1, -150, 200, 0); | 47 | ephysics_body_restitution_set(box_body1, 0.7); |
48 | ephysics_body_angular_velocity_set(box_body1, 0, 0, 36); | 48 | ephysics_body_friction_set(box_body1, 0); |
49 | ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); | 49 | ephysics_body_linear_velocity_set(box_body1, -150, 200, 0); |
50 | 50 | ephysics_body_angular_velocity_set(box_body1, 0, 0, 36); | |
51 | box2 = elm_image_add(gld->win); | 51 | ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); |
52 | elm_image_file_set(box2, strdup(buf), "purple-cube"); | 52 | |
53 | evas_object_move(box2, gld->win_w / 2 + 10, gld->win_h - 200); | 53 | box2 = elm_image_add(ourGlobals->win); |
54 | evas_object_resize(box2, 70, 70); | 54 | elm_image_file_set(box2, strdup(buf), "purple-cube"); |
55 | evas_object_show(box2); | 55 | evas_object_move(box2, ourGlobals->win_w / 2 + 10, ourGlobals->win_h - 200); |
56 | 56 | evas_object_resize(box2, 70, 70); | |
57 | box_body2 = ephysics_body_box_add(world); | 57 | evas_object_show(box2); |
58 | ephysics_body_evas_object_set(box_body2, box2, EINA_TRUE); | 58 | |
59 | ephysics_body_restitution_set(box_body2, 0.7); | 59 | box_body2 = ephysics_body_box_add(world); |
60 | ephysics_body_friction_set(box_body2, 0); | 60 | ephysics_body_evas_object_set(box_body2, box2, EINA_TRUE); |
61 | ephysics_body_linear_velocity_set(box_body2, 80, -60, 0); | 61 | ephysics_body_restitution_set(box_body2, 0.7); |
62 | ephysics_body_angular_velocity_set(box_body2, 0, 0, 360); | 62 | ephysics_body_friction_set(box_body2, 0); |
63 | ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1); | 63 | ephysics_body_linear_velocity_set(box_body2, 80, -60, 0); |
64 | 64 | ephysics_body_angular_velocity_set(box_body2, 0, 0, 360); | |
65 | ephysics_world_gravity_set(world, 0, 0, 0); | 65 | ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1); |
66 | 66 | ||
67 | return world; | 67 | ephysics_world_gravity_set(world, 0, 0, 0); |
68 | |||
69 | return world; | ||
68 | } | 70 | } |
69 | #endif | 71 | #endif |
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 6ef2b75..d1fdf50 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -8,6 +8,7 @@ static void gldata_init(GLData *gld) | |||
8 | { | 8 | { |
9 | gld->useIrr = USE_IRR; | 9 | gld->useIrr = USE_IRR; |
10 | 10 | ||
11 | #if DO_GEARS | ||
11 | gld->view_rotx = -20.0; | 12 | gld->view_rotx = -20.0; |
12 | gld->view_roty = -30.0; | 13 | gld->view_roty = -30.0; |
13 | gld->view_rotz = 0.0; | 14 | gld->view_rotz = 0.0; |
@@ -16,10 +17,10 @@ static void gldata_init(GLData *gld) | |||
16 | gld->light[0] = 1.0; | 17 | gld->light[0] = 1.0; |
17 | gld->light[1] = 1.0; | 18 | gld->light[1] = 1.0; |
18 | gld->light[2] = -5.0; | 19 | gld->light[2] = -5.0; |
20 | #endif | ||
19 | } | 21 | } |
20 | 22 | ||
21 | 23 | ||
22 | |||
23 | static void _resize_winwin(GLData *gld) | 24 | static void _resize_winwin(GLData *gld) |
24 | { | 25 | { |
25 | Evas_Coord x, y, w, h; | 26 | Evas_Coord x, y, w, h; |
@@ -63,14 +64,15 @@ static void _resize(GLData *gld) | |||
63 | 64 | ||
64 | static void _resize_gl(Evas_Object *obj) | 65 | static void _resize_gl(Evas_Object *obj) |
65 | { | 66 | { |
66 | int w, h; | 67 | globals *ourGlobals = evas_object_data_get(obj, "glob"); |
67 | GLData *gld = evas_object_data_get(obj, "gld"); | 68 | GLData *gld = &ourGlobals->gld; |
68 | 69 | int w, h; | |
69 | elm_glview_size_get(obj, &w, &h); | 70 | if (!ourGlobals) return; |
70 | 71 | ||
71 | gld->img_w = w; | 72 | elm_glview_size_get(obj, &w, &h); |
72 | gld->img_h = h; | 73 | gld->img_w = w; |
73 | _resize(gld); | 74 | gld->img_h = h; |
75 | _resize(gld); | ||
74 | } | 76 | } |
75 | 77 | ||
76 | static void _on_resize(void *data, Evas *evas, Evas_Object *obj, void *event_info) | 78 | static void _on_resize(void *data, Evas *evas, Evas_Object *obj, void *event_info) |
@@ -78,54 +80,51 @@ static void _on_resize(void *data, Evas *evas, Evas_Object *obj, void *event_inf | |||
78 | globals *ourGlobals = data; | 80 | globals *ourGlobals = data; |
79 | GLData *gld = &ourGlobals->gld; | 81 | GLData *gld = &ourGlobals->gld; |
80 | 82 | ||
81 | eo_do(gld->win, evas_obj_size_get(&gld->win_w, &gld->win_h)); | 83 | eo_do(ourGlobals->win, evas_obj_size_get(&ourGlobals->win_w, &ourGlobals->win_h)); |
82 | eo_do(ourGlobals->tb, evas_obj_size_set(gld->win_w, 25)); | 84 | eo_do(ourGlobals->tb, evas_obj_size_set(ourGlobals->win_w, 25)); |
83 | _resize(gld); | 85 | _resize(gld); |
84 | } | 86 | } |
85 | 87 | ||
86 | // Callback from Evas, also used as the general callback for deleting the GL stuff. | 88 | // Callback from Evas, also used as the general callback for deleting the GL stuff. |
87 | static void _clean_gl(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 89 | static void _clean_gl(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
88 | { | 90 | { |
89 | GLData *gld = data; | 91 | globals *ourGlobals = data; |
92 | GLData *gld = &ourGlobals->gld; | ||
90 | 93 | ||
91 | ecore_animator_del(gld->animator); | 94 | ecore_animator_del(ourGlobals->animator); |
92 | 95 | ||
93 | // Do a make_current before deleting all the GL stuff. | 96 | // Do a make_current before deleting all the GL stuff. |
94 | // evas_gl_make_current(NULL, NULL, NULL); | 97 | // evas_gl_make_current(NULL, NULL, NULL); |
95 | 98 | ||
96 | // TODO - Since this is created on the render thread, better hope this is being deleted on the render thread. | 99 | // TODO - Since this is created on the render thread, better hope this is being deleted on the render thread. |
97 | finishIrr(gld); | 100 | finishIrr(gld); |
98 | 101 | ||
99 | #if DO_GEARS | 102 | #if DO_GEARS |
100 | Evas_GL_API *gl = gld->glApi; | 103 | Evas_GL_API *gl = gld->glApi; |
101 | 104 | ||
102 | gl->glDeleteShader(gld->vtx_shader); | 105 | gl->glDeleteShader(gld->vtx_shader); |
103 | gl->glDeleteShader(gld->fgmt_shader); | 106 | gl->glDeleteShader(gld->fgmt_shader); |
104 | gl->glDeleteProgram(gld->program); | 107 | gl->glDeleteProgram(gld->program); |
105 | 108 | ||
106 | gl->glDeleteBuffers(1, &gld->gear1->vbo); | 109 | gl->glDeleteBuffers(1, &gld->gear1->vbo); |
107 | gl->glDeleteBuffers(1, &gld->gear2->vbo); | 110 | gl->glDeleteBuffers(1, &gld->gear2->vbo); |
108 | gl->glDeleteBuffers(1, &gld->gear3->vbo); | 111 | gl->glDeleteBuffers(1, &gld->gear3->vbo); |
109 | 112 | ||
110 | free_gear(gld->gear1); | 113 | free_gear(gld->gear1); |
111 | free_gear(gld->gear2); | 114 | free_gear(gld->gear2); |
112 | free_gear(gld->gear3); | 115 | free_gear(gld->gear3); |
113 | #endif | 116 | #endif |
117 | |||
118 | evas_object_data_del((Evas_Object*)obj, "glob"); | ||
114 | } | 119 | } |
115 | 120 | ||
116 | // Callback from Elm, coz they do shit different. | 121 | // Callback from Elm, coz they do shit different. |
117 | static void _del_gl(Evas_Object *obj) | 122 | static void _del_gl(Evas_Object *obj) |
118 | { | 123 | { |
119 | GLData *gld = evas_object_data_get(obj, "gld"); | 124 | globals *ourGlobals = evas_object_data_get(obj, "glob"); |
120 | if (!gld) | 125 | if (!ourGlobals) return; |
121 | { | ||
122 | printf("Unable to get GLData. \n"); | ||
123 | return; | ||
124 | } | ||
125 | |||
126 | _clean_gl(gld, NULL, NULL, NULL); | ||
127 | 126 | ||
128 | evas_object_data_del((Evas_Object*)obj, "gld"); | 127 | _clean_gl(ourGlobals, NULL, NULL, NULL); |
129 | } | 128 | } |
130 | 129 | ||
131 | // Callback for when the app quits. | 130 | // Callback for when the app quits. |
@@ -200,42 +199,34 @@ static void init_evas_gl(globals *ourGlobals) | |||
200 | { | 199 | { |
201 | GLData *gld = &ourGlobals->gld; | 200 | GLData *gld = &ourGlobals->gld; |
202 | 201 | ||
203 | gld->sfc_w = gld->win_w; | 202 | gld->sfc_w = ourGlobals->win_w; |
204 | gld->sfc_h = gld->win_h; | 203 | gld->sfc_h = ourGlobals->win_h; |
205 | 204 | ||
206 | if (USE_IRR || DO_GEARS) | 205 | if (USE_IRR || DO_GEARS) |
207 | { | 206 | { |
208 | gld->sfc_h = gld->win_h; | 207 | gld->sfc_h = ourGlobals->win_h; |
209 | |||
210 | // Get the Evas / canvas from the elm window (that the Evas_Object "lives on"), which is itself an Evas_Object created by Elm, so not sure if it was created internally with Ecore_Evas. | ||
211 | gld->canvas = evas_object_evas_get(gld->win); | ||
212 | // An Ecore_Evas holds an Evas. | ||
213 | // Get the Ecore_Evas that wraps an Evas. | ||
214 | gld->ee = ecore_evas_ecore_evas_get(gld->canvas); // Only use this on Evas that was created with Ecore_Evas. | ||
215 | 208 | ||
216 | // Add a GLView | 209 | // Add a GLView |
217 | gld->elmGl = elm_glview_add(gld->win); | 210 | gld->elmGl = elm_glview_add(ourGlobals->win); |
218 | evas_object_size_hint_align_set(gld->elmGl, EVAS_HINT_FILL, EVAS_HINT_FILL); | 211 | evas_object_size_hint_align_set(gld->elmGl, EVAS_HINT_FILL, EVAS_HINT_FILL); |
219 | evas_object_size_hint_weight_set(gld->elmGl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | 212 | evas_object_size_hint_weight_set(gld->elmGl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); |
220 | elm_glview_mode_set(gld->elmGl, 0 | ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH | ELM_GLVIEW_DIRECT); | 213 | elm_glview_mode_set(gld->elmGl, 0 | ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH | ELM_GLVIEW_DIRECT); |
221 | elm_glview_resize_policy_set(gld->elmGl, ELM_GLVIEW_RESIZE_POLICY_RECREATE); // Destroy the current surface on a resize and create a new one. | 214 | elm_glview_resize_policy_set(gld->elmGl, ELM_GLVIEW_RESIZE_POLICY_RECREATE); // Destroy the current surface on a resize and create a new one. |
222 | elm_glview_render_policy_set(gld->elmGl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND); | 215 | elm_glview_render_policy_set(gld->elmGl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND); |
223 | // elm_glview_render_policy_set(gld->elmGl, ELM_GLVIEW_RENDER_POLICY_ALWAYS); | 216 | // elm_glview_render_policy_set(gld->elmGl, ELM_GLVIEW_RENDER_POLICY_ALWAYS); |
217 | |||
218 | gld->glApi = elm_glview_gl_api_get(gld->elmGl); | ||
219 | evas_object_data_set(gld->elmGl, "glob", ourGlobals); | ||
224 | // These get called in the render thread I think. | 220 | // These get called in the render thread I think. |
225 | // None let me pass data, so this is why we are adding "gld" data to the object below. | 221 | // None let me pass data, so this is why we are adding "glob" data to the object above. |
226 | // Maybe we can use elm_object_signal_callback_add or elm_object_item_signal_callback_add (edje signals)? | 222 | // Maybe we can use elm_object_signal_callback_add or elm_object_item_signal_callback_add (edje signals)? |
227 | //elm_glview_init_func_set(gld->elmGl, _init_gl); // Not actually needed, it gets done in on_pixels. | 223 | //elm_glview_init_func_set(gld->elmGl, _init_gl); // Not actually needed, it gets done in on_pixels. |
228 | elm_glview_del_func_set(gld->elmGl, _del_gl); | 224 | elm_glview_del_func_set(gld->elmGl, _del_gl); |
229 | elm_glview_resize_func_set(gld->elmGl, _resize_gl); | 225 | elm_glview_resize_func_set(gld->elmGl, _resize_gl); |
230 | elm_glview_render_func_set(gld->elmGl, (Elm_GLView_Func_Cb) _draw_gl); | 226 | elm_glview_render_func_set(gld->elmGl, (Elm_GLView_Func_Cb) _draw_gl); |
231 | 227 | ||
232 | // Not needed, the resize callback above deals with that. | ||
233 | //elm_win_resize_object_add(gld->win, gld->elmGl); | ||
234 | gld->glApi = elm_glview_gl_api_get(gld->elmGl); | ||
235 | evas_object_data_set(gld->elmGl, "gld", gld); | ||
236 | evas_object_data_set(gld->elmGl, "glob", ourGlobals); | ||
237 | evas_object_show(gld->elmGl); | 228 | evas_object_show(gld->elmGl); |
238 | elm_box_pack_end(gld->bx, gld->elmGl); | 229 | elm_box_pack_end(ourGlobals->bx, gld->elmGl); |
239 | } | 230 | } |
240 | 231 | ||
241 | // TODO - apparently the proper way to deal with the new async rendering is to have this animator do the dirty thing, and call the Irrlicht rendering stuff in the _draw_gl call set above. | 232 | // TODO - apparently the proper way to deal with the new async rendering is to have this animator do the dirty thing, and call the Irrlicht rendering stuff in the _draw_gl call set above. |
@@ -243,7 +234,7 @@ static void init_evas_gl(globals *ourGlobals) | |||
243 | 234 | ||
244 | // Jiggling this seems to produce a trade off between flickering and frame rate. Nothing else changed the flickering. | 235 | // Jiggling this seems to produce a trade off between flickering and frame rate. Nothing else changed the flickering. |
245 | ecore_animator_frametime_set(0.04); // Default is 1/30, or 0.033333 | 236 | ecore_animator_frametime_set(0.04); // Default is 1/30, or 0.033333 |
246 | gld->animator = ecore_animator_add(doFrame, ourGlobals); // This animator will be called every frame tick, which defaults to 1/30 seconds. | 237 | ourGlobals->animator = ecore_animator_add(doFrame, ourGlobals); // This animator will be called every frame tick, which defaults to 1/30 seconds. |
247 | 238 | ||
248 | return; | 239 | return; |
249 | } | 240 | } |
@@ -274,29 +265,29 @@ static void makeMainMenu(globals *ourGlobals) | |||
274 | Elm_Object_Item *tb_it; | 265 | Elm_Object_Item *tb_it; |
275 | 266 | ||
276 | // A toolbar thingy. | 267 | // A toolbar thingy. |
277 | tb = eo_add(ELM_OBJ_TOOLBAR_CLASS, gld->win); | 268 | tb = eo_add(ELM_OBJ_TOOLBAR_CLASS, ourGlobals->win); |
278 | ourGlobals->tb = tb; | 269 | ourGlobals->tb = tb; |
279 | eo_do(tb, | 270 | eo_do(tb, |
280 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), | 271 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), |
281 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 272 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
282 | elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU), | 273 | elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU), |
283 | evas_obj_size_set(gld->win_w, 25), | 274 | evas_obj_size_set(ourGlobals->win_w, 25), |
284 | evas_obj_position_set(0, 0), | 275 | evas_obj_position_set(0, 0), |
285 | elm_obj_toolbar_align_set(0.0) | 276 | elm_obj_toolbar_align_set(0.0) |
286 | ); | 277 | ); |
287 | 278 | ||
288 | // Menus. | 279 | // Menus. |
289 | menu = _toolbar_menu_add(gld->win, tb, "file"); | 280 | menu = _toolbar_menu_add(ourGlobals->win, tb, "file"); |
290 | elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, gld); | 281 | elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, gld); |
291 | 282 | ||
292 | menu = _toolbar_menu_add(gld->win, tb, "edit"); | 283 | menu = _toolbar_menu_add(ourGlobals->win, tb, "edit"); |
293 | elm_menu_item_add(menu, NULL, NULL, "preferences", NULL, NULL); | 284 | elm_menu_item_add(menu, NULL, NULL, "preferences", NULL, NULL); |
294 | 285 | ||
295 | menu = _toolbar_menu_add(gld->win, tb, "view"); | 286 | menu = _toolbar_menu_add(ourGlobals->win, tb, "view"); |
296 | menu = _toolbar_menu_add(gld->win, tb, "world"); | 287 | menu = _toolbar_menu_add(ourGlobals->win, tb, "world"); |
297 | menu = _toolbar_menu_add(gld->win, tb, "tools"); | 288 | menu = _toolbar_menu_add(ourGlobals->win, tb, "tools"); |
298 | 289 | ||
299 | menu = _toolbar_menu_add(gld->win, tb, "help"); | 290 | menu = _toolbar_menu_add(ourGlobals->win, tb, "help"); |
300 | elm_menu_item_add(menu, NULL, NULL, "grid help", NULL, NULL); | 291 | elm_menu_item_add(menu, NULL, NULL, "grid help", NULL, NULL); |
301 | elm_menu_item_separator_add(menu, NULL); | 292 | elm_menu_item_separator_add(menu, NULL); |
302 | elm_menu_item_add(menu, NULL, NULL, "extantz blogs", NULL, NULL); | 293 | elm_menu_item_add(menu, NULL, NULL, "extantz blogs", NULL, NULL); |
@@ -304,10 +295,10 @@ static void makeMainMenu(globals *ourGlobals) | |||
304 | elm_menu_item_separator_add(menu, NULL); | 295 | elm_menu_item_separator_add(menu, NULL); |
305 | elm_menu_item_add(menu, NULL, NULL, "about extantz", NULL, NULL); | 296 | elm_menu_item_add(menu, NULL, NULL, "about extantz", NULL, NULL); |
306 | 297 | ||
307 | menu = _toolbar_menu_add(gld->win, tb, "advanced"); | 298 | menu = _toolbar_menu_add(ourGlobals->win, tb, "advanced"); |
308 | elm_menu_item_add(menu, NULL, NULL, "debug settings", NULL, NULL); | 299 | elm_menu_item_add(menu, NULL, NULL, "debug settings", NULL, NULL); |
309 | 300 | ||
310 | menu = _toolbar_menu_add(gld->win, tb, "god"); | 301 | menu = _toolbar_menu_add(ourGlobals->win, tb, "god"); |
311 | 302 | ||
312 | // Other stuff in the toolbar. | 303 | // Other stuff in the toolbar. |
313 | tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); | 304 | tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); |
@@ -354,30 +345,33 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
354 | 345 | ||
355 | // Set the engine to opengl_x11, then open our window. | 346 | // Set the engine to opengl_x11, then open our window. |
356 | elm_config_preferred_engine_set("opengl_x11"); | 347 | elm_config_preferred_engine_set("opengl_x11"); |
357 | gld->win = elm_win_util_standard_add("extantz", "extantz virtual world viewer"); | 348 | ourGlobals.win = elm_win_util_standard_add("extantz", "extantz virtual world viewer"); |
358 | ourGlobals.win = gld->win; | ||
359 | // Get the Evas / canvas from the elm window (that the Evas_Object "lives on"), which is itself an Evas_Object created by Elm, so not sure if it was created internally with Ecore_Evas. | ||
360 | ourGlobals.evas = evas_object_evas_get(gld->win); | ||
361 | |||
362 | // Set preferred engine back to default from config | 349 | // Set preferred engine back to default from config |
363 | elm_config_preferred_engine_set(NULL); | 350 | elm_config_preferred_engine_set(NULL); |
364 | 351 | ||
352 | // TODO, or not TODO - I keep getting rid of these, but keep bringing them back. Leave ee commented for now. | ||
353 | // Get the Evas / canvas from the elm window (that the Evas_Object "lives on"), which is itself an Evas_Object created by Elm, so not sure if it was created internally with Ecore_Evas. | ||
354 | ourGlobals.evas = evas_object_evas_get(ourGlobals.win); | ||
355 | // An Ecore_Evas holds an Evas. | ||
356 | // Get the Ecore_Evas that wraps an Evas. | ||
357 | //ourGlobals.ee = ecore_evas_ecore_evas_get(ourGlobals.evas); // Only use this on Evas that was created with Ecore_Evas. | ||
358 | |||
365 | #if USE_PHYSICS | 359 | #if USE_PHYSICS |
366 | if (!ephysics_init()) | 360 | if (!ephysics_init()) |
367 | return 1; | 361 | return 1; |
368 | #endif | 362 | #endif |
369 | 363 | ||
370 | evas_object_smart_callback_add(gld->win, "delete,request", _on_done, gld); | 364 | evas_object_smart_callback_add(ourGlobals.win, "delete,request", _on_done, gld); |
371 | evas_object_event_callback_add(gld->win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); | 365 | evas_object_event_callback_add(ourGlobals.win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); |
372 | 366 | ||
373 | // Get the screen size. | 367 | // Get the screen size. |
374 | elm_win_screen_size_get(gld->win, &gld->win_x, &gld->win_y, &gld->scr_w, &gld->scr_h); | 368 | elm_win_screen_size_get(ourGlobals.win, &ourGlobals.win_x, &ourGlobals.win_y, &ourGlobals.scr_w, &ourGlobals.scr_h); |
375 | gld->win_x = gld->win_x + (gld->scr_w / 3); | 369 | ourGlobals.win_x = ourGlobals.win_x + (ourGlobals.scr_w / 3); |
376 | gld->win_w = gld->scr_w / 2; | 370 | ourGlobals.win_w = ourGlobals.scr_w / 2; |
377 | gld->win_h = gld->scr_h - 30; | 371 | ourGlobals.win_h = ourGlobals.scr_h - 30; |
378 | 372 | ||
379 | // Add a background image object. | 373 | // Add a background image object. |
380 | obj = eo_add(ELM_OBJ_IMAGE_CLASS, gld->win); | 374 | obj = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals.win); |
381 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", elm_app_data_dir_get()); | 375 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", elm_app_data_dir_get()); |
382 | eo_do(obj, | 376 | eo_do(obj, |
383 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 377 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
@@ -385,20 +379,20 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
385 | elm_obj_image_file_set(buf, NULL), | 379 | elm_obj_image_file_set(buf, NULL), |
386 | evas_obj_visibility_set(EINA_TRUE) | 380 | evas_obj_visibility_set(EINA_TRUE) |
387 | ); | 381 | ); |
388 | elm_win_resize_object_add(gld->win, obj); | 382 | elm_win_resize_object_add(ourGlobals.win, obj); |
389 | eo_unref(obj); | 383 | eo_unref(obj); |
390 | 384 | ||
391 | gld->bx = eo_add(ELM_OBJ_BOX_CLASS, gld->win); | 385 | ourGlobals.bx = eo_add(ELM_OBJ_BOX_CLASS, ourGlobals.win); |
392 | eo_do(gld->bx, | 386 | eo_do(ourGlobals.bx, |
393 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 387 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
394 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 388 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
395 | evas_obj_visibility_set(EINA_TRUE) | 389 | evas_obj_visibility_set(EINA_TRUE) |
396 | ); | 390 | ); |
397 | elm_win_resize_object_add(gld->win, gld->bx); | 391 | elm_win_resize_object_add(ourGlobals.win, ourGlobals.bx); |
398 | 392 | ||
399 | // overlay_add(gld); | 393 | // overlay_add(&ourGlobals); |
400 | woMan_add(gld); | 394 | woMan_add(&ourGlobals); |
401 | chat_add(gld); | 395 | chat_add(&ourGlobals); |
402 | 396 | ||
403 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | 397 | // Gotta do this after adding the windows, otherwise the menu renders under the window. |
404 | // This sucks, gotta redefine this menu each time we create a new window? | 398 | // This sucks, gotta redefine this menu each time we create a new window? |
@@ -413,12 +407,12 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
413 | evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals.scene->image), on_pixels, &ourGlobals); | 407 | evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals.scene->image), on_pixels, &ourGlobals); |
414 | 408 | ||
415 | #if USE_PHYSICS | 409 | #if USE_PHYSICS |
416 | world = ephysicsAdd(gld); | 410 | world = ephysicsAdd(&ourGlobals); |
417 | #endif | 411 | #endif |
418 | 412 | ||
419 | evas_object_move(gld->win, gld->win_x, gld->win_y); | 413 | evas_object_move(ourGlobals.win, ourGlobals.win_x, ourGlobals.win_y); |
420 | evas_object_resize(gld->win, gld->win_w, gld->win_h); | 414 | evas_object_resize(ourGlobals.win, ourGlobals.win_w, ourGlobals.win_h); |
421 | evas_object_show(gld->win); | 415 | evas_object_show(ourGlobals.win); |
422 | 416 | ||
423 | _resize_winwin(gld); | 417 | _resize_winwin(gld); |
424 | 418 | ||
@@ -429,12 +423,12 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
429 | ephysics_shutdown(); | 423 | ephysics_shutdown(); |
430 | #endif | 424 | #endif |
431 | 425 | ||
432 | if (gld->win) | 426 | if (ourGlobals. win) |
433 | { | 427 | { |
434 | Evas_3D_Demo_fini(&ourGlobals); | 428 | Evas_3D_Demo_fini(&ourGlobals); |
435 | eo_unref(ourGlobals.tb); | 429 | eo_unref(ourGlobals.tb); |
436 | eo_unref(gld->bx); | 430 | eo_unref(ourGlobals.bx); |
437 | evas_object_del(gld->win); | 431 | evas_object_del(ourGlobals.win); |
438 | } | 432 | } |
439 | 433 | ||
440 | if (ourGlobals.logDom >= 0) | 434 | if (ourGlobals.logDom >= 0) |
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index b91124e..fab6708 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h | |||
@@ -161,23 +161,13 @@ typedef struct _Scene_Data | |||
161 | 161 | ||
162 | } Scene_Data; | 162 | } Scene_Data; |
163 | 163 | ||
164 | // GL related data here. | 164 | // Elm GL view related data here. |
165 | struct _GLData | 165 | struct _GLData |
166 | { | 166 | { |
167 | Evas_Object *win, *winwin; | 167 | Evas_Object *winwin; |
168 | Evas_Object *elmGl; | ||
169 | Evas_GL_API *glApi; | ||
168 | 170 | ||
169 | Ecore_Evas *ee; | ||
170 | Evas *canvas; | ||
171 | |||
172 | Evas_Object *elmGl; | ||
173 | Evas_GL_API *glApi; | ||
174 | |||
175 | GLuint program; | ||
176 | GLuint vtx_shader; | ||
177 | GLuint fgmt_shader; | ||
178 | int scr_w, scr_h; // The size of the screen. | ||
179 | int win_w, win_h; // The size of the window. | ||
180 | int win_x, win_y; // The position of the window. | ||
181 | int sfc_w, sfc_h; // This is what Irrlicht is using, size of the GL image surface / glview. | 171 | int sfc_w, sfc_h; // This is what Irrlicht is using, size of the GL image surface / glview. |
182 | int img_w, img_h; // Size of the viewport. DON'T reuse sfc_* here. Despite the fact that sfc_* is only used in the init when Irricht is disabled? WTF? | 172 | int img_w, img_h; // Size of the viewport. DON'T reuse sfc_* here. Despite the fact that sfc_* is only used in the init when Irricht is disabled? WTF? |
183 | int useIrr : 1; | 173 | int useIrr : 1; |
@@ -185,9 +175,6 @@ struct _GLData | |||
185 | int gearsInited : 1; | 175 | int gearsInited : 1; |
186 | int resized : 1; | 176 | int resized : 1; |
187 | 177 | ||
188 | Evas_Object *bx;//, *r1; | ||
189 | Ecore_Animator *animator; | ||
190 | |||
191 | IrrlichtDevice *device; | 178 | IrrlichtDevice *device; |
192 | IVideoDriver *driver; | 179 | IVideoDriver *driver; |
193 | ISceneManager *smgr; | 180 | ISceneManager *smgr; |
@@ -195,7 +182,11 @@ struct _GLData | |||
195 | 182 | ||
196 | cameraMove *move; | 183 | cameraMove *move; |
197 | 184 | ||
198 | // Gear Stuff | 185 | #if DO_GEARS |
186 | GLuint program; | ||
187 | GLuint vtx_shader; | ||
188 | GLuint fgmt_shader; | ||
189 | |||
199 | GLfloat view_rotx; | 190 | GLfloat view_rotx; |
200 | GLfloat view_roty; | 191 | GLfloat view_roty; |
201 | GLfloat view_rotz; | 192 | GLfloat view_rotz; |
@@ -212,16 +203,25 @@ struct _GLData | |||
212 | 203 | ||
213 | GLfloat proj[16]; | 204 | GLfloat proj[16]; |
214 | GLfloat light[3]; | 205 | GLfloat light[3]; |
206 | #endif | ||
215 | }; | 207 | }; |
216 | 208 | ||
217 | typedef struct _globals | 209 | typedef struct _globals |
218 | { | 210 | { |
219 | Evas *evas; | 211 | // Ecore_Evas *ee; |
212 | Evas *evas; | ||
220 | Evas_Object *win; // Our Elm window. | 213 | Evas_Object *win; // Our Elm window. |
221 | Evas_Object *tb; // Our Elm toolbar. | 214 | Evas_Object *tb; // Our Elm toolbar. |
215 | Evas_Object *bx; // Our box. | ||
222 | Eina_Clist widgets; // Our windows widgets. | 216 | Eina_Clist widgets; // Our windows widgets. |
223 | int logDom; // Our logging domain. | 217 | int logDom; // Our logging domain. |
224 | 218 | ||
219 | int scr_w, scr_h; // The size of the screen. | ||
220 | int win_w, win_h; // The size of the window. | ||
221 | int win_x, win_y; // The position of the window. | ||
222 | |||
223 | Ecore_Animator *animator; | ||
224 | |||
225 | struct _GLData gld; | 225 | struct _GLData gld; |
226 | Scene_Data *scene; | 226 | Scene_Data *scene; |
227 | } globals; | 227 | } globals; |
@@ -233,7 +233,7 @@ void gears_init(GLData *gld); | |||
233 | void drawGears(GLData *gld); | 233 | void drawGears(GLData *gld); |
234 | void free_gear(Gear *gear); | 234 | void free_gear(Gear *gear); |
235 | 235 | ||
236 | EPhysics_World *ephysicsAdd(GLData *gld); | 236 | EPhysics_World *ephysicsAdd(globals *ourGlobals); |
237 | 237 | ||
238 | EAPI int startIrr(GLData *gld); | 238 | EAPI int startIrr(GLData *gld); |
239 | EAPI void drawIrr_start(GLData *gld); | 239 | EAPI void drawIrr_start(GLData *gld); |
@@ -246,12 +246,12 @@ void Evas_3D_Demo_fini(globals *ourGlobals); | |||
246 | 246 | ||
247 | void cameraAdd(Evas_Object *win, GLData *gld); | 247 | void cameraAdd(Evas_Object *win, GLData *gld); |
248 | 248 | ||
249 | Evas_Object *fang_win_add(GLData *gld); | 249 | Evas_Object *fang_win_add(globals *ourGlobals); |
250 | void fang_win_complete(GLData *gld, Evas_Object *win, int x, int y, int w, int h); | 250 | void fang_win_complete(globals *ourGlobals, Evas_Object *win, int x, int y, int w, int h); |
251 | void overlay_add(GLData *gld); | 251 | void overlay_add(globals *ourGlobals); |
252 | 252 | ||
253 | void chat_add(GLData *gld); | 253 | void chat_add(globals *ourGlobals); |
254 | void woMan_add(GLData *gld); | 254 | void woMan_add(globals *ourGlobals); |
255 | 255 | ||
256 | 256 | ||
257 | #ifdef __cplusplus | 257 | #ifdef __cplusplus |
diff --git a/src/extantz/fangWin.c b/src/extantz/fangWin.c index 8f68658..c7ec145 100644 --- a/src/extantz/fangWin.c +++ b/src/extantz/fangWin.c | |||
@@ -78,79 +78,81 @@ static void create_handles(Evas_Object *obj) | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | Evas_Object *fang_win_add(GLData *gld) | 81 | Evas_Object *fang_win_add(globals *ourGlobals) |
82 | { | 82 | { |
83 | Evas_Object *win, *bg; | 83 | GLData *gld = &ourGlobals->gld; |
84 | 84 | Evas_Object *win, *bg; | |
85 | // In theory this should create an EWS window, in practice, I'm not seeing any difference. | 85 | |
86 | // Guess I'll have to implement my own internal window manager. I don't think a basic one will be that hard. Famous last words. | 86 | // In theory this should create an EWS window, in practice, I'm not seeing any difference. |
87 | // elm_config_engine_set("ews"); | 87 | // Guess I'll have to implement my own internal window manager. I don't think a basic one will be that hard. Famous last words. |
88 | win = elm_win_add(gld->win, "inlined", ELM_WIN_INLINED_IMAGE); | 88 | // elm_config_engine_set("ews"); |
89 | // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. | 89 | win = elm_win_add(ourGlobals->win, "inlined", ELM_WIN_INLINED_IMAGE); |
90 | // According to the Elm inlined image window example, this is what's needed to. | 90 | // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. |
91 | evas_object_event_callback_add(elm_win_inlined_image_object_get(win), EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, gld); | 91 | // According to the Elm inlined image window example, this is what's needed to. |
92 | elm_win_alpha_set(win, EINA_TRUE); | 92 | evas_object_event_callback_add(elm_win_inlined_image_object_get(win), EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, gld); |
93 | 93 | elm_win_alpha_set(win, EINA_TRUE); | |
94 | // Apparently transparent is not good enough for ELM backgrounds, so make it a rectangle. | 94 | |
95 | // Apparently coz ELM prefers stuff to have edjes. A bit over the top if all I want is a transparent rectangle. | 95 | // Apparently transparent is not good enough for ELM backgrounds, so make it a rectangle. |
96 | bg = evas_object_rectangle_add(evas_object_evas_get(win)); | 96 | // Apparently coz ELM prefers stuff to have edjes. A bit over the top if all I want is a transparent rectangle. |
97 | evas_object_color_set(bg, 50, 0, 100, 100); | 97 | bg = evas_object_rectangle_add(evas_object_evas_get(win)); |
98 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | 98 | evas_object_color_set(bg, 50, 0, 100, 100); |
99 | elm_win_resize_object_add(win, bg); | 99 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); |
100 | evas_object_show(bg); | 100 | elm_win_resize_object_add(win, bg); |
101 | 101 | evas_object_show(bg); | |
102 | return win; | 102 | |
103 | return win; | ||
103 | } | 104 | } |
104 | 105 | ||
105 | void fang_win_complete(GLData *gld, Evas_Object *win, int x, int y, int w, int h) | 106 | void fang_win_complete(globals *ourGlobals, Evas_Object *win, int x, int y, int w, int h) |
106 | { | 107 | { |
107 | // image object for win is unlinked to its pos/size - so manual control | 108 | // image object for win is unlinked to its pos/size - so manual control |
108 | // this allows also for using map and other things with it. | 109 | // this allows also for using map and other things with it. |
109 | evas_object_move(elm_win_inlined_image_object_get(win), x, y); | 110 | evas_object_move(elm_win_inlined_image_object_get(win), x, y); |
110 | // Odd, it needs to be resized twice. WTF? | 111 | // Odd, it needs to be resized twice. WTF? |
111 | evas_object_resize(win, w, h); | 112 | evas_object_resize(win, w, h); |
112 | evas_object_resize(elm_win_inlined_image_object_get(win), w, h); | 113 | evas_object_resize(elm_win_inlined_image_object_get(win), w, h); |
113 | evas_object_show(win); | 114 | evas_object_show(win); |
114 | create_handles(elm_win_inlined_image_object_get(win)); | 115 | create_handles(elm_win_inlined_image_object_get(win)); |
115 | } | 116 | } |
116 | 117 | ||
117 | void overlay_add(GLData *gld) | 118 | void overlay_add(globals *ourGlobals) |
118 | { | 119 | { |
119 | Evas_Object *bg; | 120 | GLData *gld = &ourGlobals->gld; |
120 | 121 | Evas_Object *bg; | |
121 | // There are many reasons for this window. | 122 | |
122 | // The first is to cover the GL and provide something to click on to change focus. | 123 | // There are many reasons for this window. |
123 | // The second is to provide something to click on for all the GL type clicking stuff that needs to be done. In other words, no click through, we catch the clicks here. | 124 | // The first is to cover the GL and provide something to click on to change focus. |
124 | // So we can probably avoid the following issue - | 125 | // The second is to provide something to click on for all the GL type clicking stuff that needs to be done. In other words, no click through, we catch the clicks here. |
125 | // How to do click through? evas_object_pass_events_set(rectangle, EINA_TRUE), and maybe need to do that to the underlaying window to? | 126 | // So we can probably avoid the following issue - |
126 | // Though if the rectangle is entirely transparent, or even hidden, events might pass through anyway. | 127 | // How to do click through? evas_object_pass_events_set(rectangle, EINA_TRUE), and maybe need to do that to the underlaying window to? |
127 | // Gotta have click through on the parts where there's no other window. | 128 | // Though if the rectangle is entirely transparent, or even hidden, events might pass through anyway. |
128 | // The third is to have the other windows live here. | 129 | // Gotta have click through on the parts where there's no other window. |
129 | // This idea doesn't work, as it breaks the damn focus again. | 130 | // The third is to have the other windows live here. |
130 | // Don't think it's needed anyway. | 131 | // This idea doesn't work, as it breaks the damn focus again. |
131 | // While on the subject of layers, need a HUD layer of some sort, but Irrlicht might support that itself. | 132 | // Don't think it's needed anyway. |
132 | 133 | // While on the subject of layers, need a HUD layer of some sort, but Irrlicht might support that itself. | |
133 | gld->winwin = elm_win_add(gld->win, "inlined", ELM_WIN_INLINED_IMAGE); | 134 | |
134 | // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. | 135 | gld->winwin = elm_win_add(ourGlobals->win, "inlined", ELM_WIN_INLINED_IMAGE); |
135 | // According to the Elm inlined image window example, this is what's needed to. | 136 | // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. |
136 | evas_object_event_callback_add(elm_win_inlined_image_object_get(gld->winwin), EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, gld); | 137 | // According to the Elm inlined image window example, this is what's needed to. |
137 | // In this code, we are making our own camera, so grab it's input when we are focused. | 138 | evas_object_event_callback_add(elm_win_inlined_image_object_get(gld->winwin), EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, gld); |
138 | cameraAdd(gld->winwin, gld); | 139 | // In this code, we are making our own camera, so grab it's input when we are focused. |
139 | 140 | cameraAdd(gld->winwin, gld); | |
140 | elm_win_alpha_set(gld->winwin, EINA_TRUE); | 141 | |
141 | // Apparently transparent is not good enough for ELM backgrounds, so make it a rectangle. | 142 | elm_win_alpha_set(gld->winwin, EINA_TRUE); |
142 | // Apparently coz ELM prefers stuff to have edjes. A bit over the top if all I want is a transparent rectangle. | 143 | // Apparently transparent is not good enough for ELM backgrounds, so make it a rectangle. |
143 | bg = evas_object_rectangle_add(evas_object_evas_get(gld->winwin)); | 144 | // Apparently coz ELM prefers stuff to have edjes. A bit over the top if all I want is a transparent rectangle. |
144 | evas_object_color_set(bg, 0, 0, 0, 0); | 145 | bg = evas_object_rectangle_add(evas_object_evas_get(gld->winwin)); |
145 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | 146 | evas_object_color_set(bg, 0, 0, 0, 0); |
146 | elm_win_resize_object_add(gld->winwin, bg); | 147 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); |
147 | evas_object_show(bg); | 148 | elm_win_resize_object_add(gld->winwin, bg); |
148 | 149 | evas_object_show(bg); | |
149 | // image object for win is unlinked to its pos/size - so manual control | 150 | |
150 | // this allows also for using map and other things with it. | 151 | // image object for win is unlinked to its pos/size - so manual control |
151 | evas_object_move(elm_win_inlined_image_object_get(gld->winwin), 0, 0); | 152 | // this allows also for using map and other things with it. |
152 | // Odd, it needs to be resized twice. WTF? | 153 | evas_object_move(elm_win_inlined_image_object_get(gld->winwin), 0, 0); |
153 | evas_object_resize(gld->winwin, gld->win_w, gld->win_h); | 154 | // Odd, it needs to be resized twice. WTF? |
154 | evas_object_resize(elm_win_inlined_image_object_get(gld->winwin), gld->win_w, gld->win_h); | 155 | evas_object_resize(gld->winwin, ourGlobals->win_w, ourGlobals->win_h); |
155 | evas_object_show(gld->winwin); | 156 | evas_object_resize(elm_win_inlined_image_object_get(gld->winwin), ourGlobals->win_w, ourGlobals->win_h); |
157 | evas_object_show(gld->winwin); | ||
156 | } | 158 | } |
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c index 3bb42fe..bef449c 100644 --- a/src/extantz/woMan.c +++ b/src/extantz/woMan.c | |||
@@ -139,27 +139,28 @@ static Evas_Object *_viewer_content_get(void *data, Evas_Object *obj, const char | |||
139 | 139 | ||
140 | static void _grid_sel_cb(void *data, Evas_Object *obj, void *event_info) | 140 | static void _grid_sel_cb(void *data, Evas_Object *obj, void *event_info) |
141 | { | 141 | { |
142 | ezGrid *thisGrid = data; | 142 | // ezGrid *thisGrid = data; |
143 | GLData *gld = thisGrid->gld; | 143 | // GLData *gld = thisGrid->gld; |
144 | char buf[PATH_MAX]; | 144 | // char buf[PATH_MAX]; |
145 | 145 | ||
146 | // sprintf(buf, "dillo -f -g '%dx%d+%d+%d' %s &", gld->win_w - (gld->win_w / 5), gld->win_h - 30, gld->win_w / 5, gld->win_y, thisGrid->splashPage); | 146 | // sprintf(buf, "dillo -f -g '%dx%d+%d+%d' %s &", gld->win_w - (gld->win_w / 5), gld->win_h - 30, gld->win_w / 5, gld->win_y, thisGrid->splashPage); |
147 | sprintf(buf, "uzbl -g '%dx%d+%d+%d' -u %s &", gld->win_w - (gld->win_w / 5), gld->win_h - 30, gld->win_w / 5, gld->win_y, thisGrid->splashPage); | 147 | // sprintf(buf, "uzbl -g '%dx%d+%d+%d' -u %s &", gld->win_w - (gld->win_w / 5), gld->win_h - 30, gld->win_w / 5, gld->win_y, thisGrid->splashPage); |
148 | printf("%s ### genlist obj [%p], item pointer [%p]\n", buf, obj, event_info); | 148 | // printf("%s ### genlist obj [%p], item pointer [%p]\n", buf, obj, event_info); |
149 | // comment this out for now, busy dealing with input stuff, don't want to trigger this multiple times. | 149 | // comment this out for now, busy dealing with input stuff, don't want to trigger this multiple times. |
150 | // system(buf); | 150 | // system(buf); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | void woMan_add(GLData *gld) | 154 | void woMan_add(globals *ourGlobals) |
155 | { | 155 | { |
156 | GLData *gld = &ourGlobals->gld; | ||
156 | // Evas_Object *win, *bg, *bx, *ic, *bb, *av, *en, *bt, *nf, *tab, *tb, *gridList, *viewerList, *menu; | 157 | // Evas_Object *win, *bg, *bx, *ic, *bb, *av, *en, *bt, *nf, *tab, *tb, *gridList, *viewerList, *menu; |
157 | Evas_Object *win, *bx, *bt, *nf, *tab, *tb, *gridList, *viewerList, *menu; | 158 | Evas_Object *win, *bx, *bt, *nf, *tab, *tb, *gridList, *viewerList, *menu; |
158 | Elm_Object_Item *tb_it, *menu_it, *tab_it; | 159 | Elm_Object_Item *tb_it, *menu_it, *tab_it; |
159 | char buf[PATH_MAX]; | 160 | char buf[PATH_MAX]; |
160 | int i; | 161 | int i; |
161 | 162 | ||
162 | win = fang_win_add(gld); | 163 | win = fang_win_add(ourGlobals); |
163 | 164 | ||
164 | bx = elm_box_add(win); | 165 | bx = elm_box_add(win); |
165 | elm_win_resize_object_add(win, bx); | 166 | elm_win_resize_object_add(win, bx); |
@@ -287,5 +288,5 @@ void woMan_add(GLData *gld) | |||
287 | eo_unref(bt); | 288 | eo_unref(bt); |
288 | evas_object_show(bx); | 289 | evas_object_show(bx); |
289 | 290 | ||
290 | fang_win_complete(gld, win, 30, 30, gld->win_w / 3, gld->win_h / 3); | 291 | fang_win_complete(ourGlobals, win, 30, 30, ourGlobals->win_w / 3, ourGlobals->win_h / 3); |
291 | } | 292 | } |