aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-03 01:47:19 +1000
committerDavid Walter Seikel2014-05-03 01:47:19 +1000
commite8678fdfe62bf62113baef2948874c0adfc82045 (patch)
treee2f0e4a14126fb5e9637802a42db9205be2897cf
parentMajor cleanup of extantz, part one. (diff)
downloadSledjHamr-e8678fdfe62bf62113baef2948874c0adfc82045.zip
SledjHamr-e8678fdfe62bf62113baef2948874c0adfc82045.tar.gz
SledjHamr-e8678fdfe62bf62113baef2948874c0adfc82045.tar.bz2
SledjHamr-e8678fdfe62bf62113baef2948874c0adfc82045.tar.xz
Major extantz clean up part 2. Including new Evas_3d style camera.
-rw-r--r--src/extantz/Evas_3D_demo.c29
-rwxr-xr-xsrc/extantz/build.lua4
-rw-r--r--src/extantz/camera.c182
-rw-r--r--src/extantz/chat.c41
-rw-r--r--src/extantz/extantz.c36
-rw-r--r--src/extantz/extantz.h9
-rw-r--r--src/extantz/fangWin.c174
-rw-r--r--src/libraries/LumbrJack.c5
8 files changed, 270 insertions, 210 deletions
diff --git a/src/extantz/Evas_3D_demo.c b/src/extantz/Evas_3D_demo.c
index 5f33fed..df05838 100644
--- a/src/extantz/Evas_3D_demo.c
+++ b/src/extantz/Evas_3D_demo.c
@@ -268,13 +268,16 @@ _sphere_init(int precision)
268 268
269Eina_Bool _animate_scene(void *data) 269Eina_Bool _animate_scene(void *data)
270{ 270{
271 globals *ourGlobals = data;
272
271 static float angle = 0.0f; 273 static float angle = 0.0f;
272 static float earthAngle = 0.0f; 274 static float earthAngle = 0.0f;
273 static int frame = 0; 275 static int frame = 0;
274 static int inc = 1; 276 static int inc = 1;
275 static int sonicFrame = 0; 277 static int sonicFrame = 0;
278 Evas_Real x, y, z;
276 279
277 Scene_Data *scene = (Scene_Data *)data; 280 Scene_Data *scene = ourGlobals->scene;
278 281
279 // Animate cube. 282 // Animate cube.
280 angle += 0.5; 283 angle += 0.5;
@@ -303,6 +306,13 @@ Eina_Bool _animate_scene(void *data)
303 evas_3d_node_orientation_angle_axis_set(angle, 0.0, 1.0, 0.0) 306 evas_3d_node_orientation_angle_axis_set(angle, 0.0, 1.0, 0.0)
304 ); 307 );
305 308
309 // Camera movement.
310 eo_do(scene->camera_node, evas_3d_node_position_get(EVAS_3D_SPACE_PARENT, &x, &y, &z));
311 x += ourGlobals->gld.move->x;
312 y += ourGlobals->gld.move->y;
313 z += ourGlobals->gld.move->z;
314 eo_do(scene->camera_node, evas_3d_node_position_set(x, y, z));
315
306 return EINA_TRUE; 316 return EINA_TRUE;
307} 317}
308 318
@@ -602,7 +612,10 @@ static void _on_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void
602 elm_object_tooltip_show(scene->image); 612 elm_object_tooltip_show(scene->image);
603 } 613 }
604 else 614 else
615 {
616 elm_object_tooltip_text_set(scene->image, "");
605 elm_object_tooltip_hide(scene->image); 617 elm_object_tooltip_hide(scene->image);
618 }
606} 619}
607 620
608static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo) 621static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo)
@@ -619,6 +632,9 @@ static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void
619 Eina_Bool pick; 632 Eina_Bool pick;
620 char *name = NULL; 633 char *name = NULL;
621 634
635 // Set the focus onto us.
636 elm_object_focus_set(o, EINA_TRUE);
637
622 evas_object_geometry_get(o, &x, &y, &w, &h); 638 evas_object_geometry_get(o, &x, &y, &w, &h);
623 639
624 obj_x = ev->canvas.x - x; 640 obj_x = ev->canvas.x - x;
@@ -673,15 +689,18 @@ void Evas_3D_Demo_add(globals *ourGlobals)
673 // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas calbacks instead. 689 // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas calbacks instead.
674 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, &ourScene); 690 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, &ourScene);
675 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourScene); 691 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourScene);
692 cameraAdd(obj, &ourGlobals->gld);
676 elm_win_resize_object_add(ourGlobals->win, obj); 693 elm_win_resize_object_add(ourGlobals->win, obj);
677// elm_box_pack_end(ourGlobals->gld.bx, obj); 694// elm_box_pack_end(ourGlobals->gld.bx, obj);
678 695
679 // Add animation timer callback. 696 // Add animation timer callback.
680// ecore_timer_add(0.016, _animate_scene, &ourScene); 697// ecore_timer_add(0.016, _animate_scene, &ourScene);
698 ourGlobals->gld.move = calloc(1, sizeof(cameraMove));
681} 699}
682 700
683void Evas_3D_Demo_fini() 701void Evas_3D_Demo_fini(globals *ourGlobals)
684{ 702{
685 free(sphere_vertices); 703 eo_unref(ourGlobals->scene->image);
686 free(sphere_indices); 704 free(sphere_vertices);
687} \ No newline at end of file 705 free(sphere_indices);
706}
diff --git a/src/extantz/build.lua b/src/extantz/build.lua
index 2871ae6..75b210f 100755
--- a/src/extantz/build.lua
+++ b/src/extantz/build.lua
@@ -17,10 +17,10 @@ CFLAGS = CFLAGS .. ' -I../../libraries/irrlicht-1.8.1/include -I/usr/X11R6/inc
17LDFLAGS = LDFLAGS .. ' -L../../libraries/irrlicht-1.8.1/lib/Linux' 17LDFLAGS = LDFLAGS .. ' -L../../libraries/irrlicht-1.8.1/lib/Linux'
18libs = libs .. ' -lIrrlicht -lGL -lbz2' 18libs = libs .. ' -lIrrlicht -lGL -lbz2'
19 19
20removeFiles(dir, {'../../extantz', 'crappisspuke.o', 'CDemo.o', 'extantzCamera.o', 'gears.o', 'ephysics_demo.o', 'Evas_3D_demo.o', 'fangWin.o', 'chat.o', 'woMan.o', '../../media/extantz.edj'}) 20removeFiles(dir, {'../../extantz', 'crappisspuke.o', 'CDemo.o', 'extantzCamera.o', 'gears.o', 'ephysics_demo.o', 'camera.o', 'Evas_3D_demo.o', 'fangWin.o', 'chat.o', 'woMan.o', '../../media/extantz.edj'})
21 21
22runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' extantz.edc ../../media/extantz.edj') 22runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' extantz.edc ../../media/extantz.edj')
23runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c crappisspuke.cpp -o crappisspuke.o ' .. LDFLAGS) 23runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c crappisspuke.cpp -o crappisspuke.o ' .. LDFLAGS)
24runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS) 24runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS)
25runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS) 25runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS)
26compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'Evas_3D_demo', 'fangWin', 'chat', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o') 26compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'camera', 'Evas_3D_demo', 'fangWin', 'chat', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o')
diff --git a/src/extantz/camera.c b/src/extantz/camera.c
new file mode 100644
index 0000000..331a85a
--- /dev/null
+++ b/src/extantz/camera.c
@@ -0,0 +1,182 @@
1#include "extantz.h"
2
3
4static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
5{
6 GLData *gld = data;
7 Evas_Event_Key_Down *ev = event_info;
8
9 if (gld->move)
10 {
11 // TODO - Careful, gld->move MIGHT be read at the other end by another thread. MIGHT, coz I really don't know at what point the camera animate routine is actually called.
12
13 // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ...
14 // TODO - make this a hash lookup dammit.
15 if (0 == strcmp(ev->key, "Escape"))
16 {
17 }
18 else if (0 == strcmp(ev->key, "Left"))
19 gld->move->y = 2.0;
20 else if (0 == strcmp(ev->key, "Right"))
21 gld->move->y = -2.0;
22 else if (0 == strcmp(ev->key, "Up"))
23 gld->move->x = 2.0;
24 else if (0 == strcmp(ev->key, "Down"))
25 gld->move->x = -2.0;
26 else if (0 == strcmp(ev->key, "Prior"))
27 gld->move->z = -2.0;
28 else if (0 == strcmp(ev->key, "Next"))
29 gld->move->z = 2.0;
30// else if (0 == strcmp(ev->key, "Home"))
31// ;
32// else if (0 == strcmp(ev->key, "End"))
33// ;
34 else if (0 == strcmp(ev->key, "space"))
35 gld->move->jump = 1.0;
36 else
37 printf("Unexpected down keystroke - %s\n", ev->key);
38 }
39 else
40 printf("Camera input not ready\n");
41}
42
43/* SL / OS camera controls
44 up / down / w / s moves avatar forward / backward
45 shifted version does the same
46 double tap triggers run mode / or fast fly mode
47 Running backwards turns your avatar to suit, walking does not.
48 left / right / a / d rotates avatar left / right, strafes in mouselook
49 shifted version turns the avatar to walk sideways, so not really a strafe.
50 So not sure if the "strafe" in mouse look turns the avatar as well?
51 PgDn / c crouch while it is held down move up in flight mode
52 PgUp jump move down in flight mode
53 Home toggle flying
54 End Nothing?
55 Esc return to third person view
56 m toggle mouse look
57 mouse wheel move view closer / further away from current focused object or avatar
58 Alt left click focus on some other object
59 Ins ???
60 Del ???
61 BS ???
62 Tab ???
63
64 Mouse look is just first person view, moving mouse looks left / right / up / down.
65 Not sure if the avatar rotates with left / right, but that's likely.
66
67 mouse moves With the left mouse button held down -
68 left / right up / down
69 ---------------------------------
70 for avatar swings avatar around zoom in and out of avatar
71 for object nothing
72 alt orbit left / right zoom in and out
73 alt ctrl orbit left / right orbit up / down
74 alt shift orbit left / right zoom in and out
75 alt ctrl shift shift view left / right / up / down
76 ctrl Nothing?
77 shift Nothing?
78 ctrl shift Nothing?
79
80 Need to also consider when looking at a moving object / avatar.
81
82 I think there are other letter keys that duplicate arrow keys and such. I'll look for them later, but I don't use them.
83 No idea what the function keys are mapped to, but think it's various non camera stuff.
84 I'm damn well leaving the Win/Command and Menu keys for the OS / window manager. lol
85 Keypad keys? Not interested, I don't have them.
86 Print Screen / SysRq, Pause / Break, other oddball keys, also not interested.
87 NOTE - gonna have an easily programmable "bind key to command" thingy, like E17s, so that can deal with other keys.
88 Should even let them be saveable so people can swap them with other people easily.
89
90 TODO - implement things like space mouse, sixaxis, phone as controller, joysticks, data gloves, etc.
91*/
92
93/* A moveRotate array of floats.
94 * X, Y, Z, and whatever the usual letters are for rotations. lol
95 * Each one means "move or rotate this much in this direction".
96 * Where 1.0 means "what ever the standard move is if that key is held down".
97 * So a keyboard move would just change it's part to 1.0 or -1.0 on key down,
98 * and back to 0.0 on key up. Or 2.0 / -2.0 if in run mode.
99 * Which would even work in fly mode.
100 * A joystick could be set to range over -2.0 to 2.0, and just set it's part directly.
101 * A mouse look rotate, well will come to that when we need to. B-)
102 * Setting the x or y to be the DIFFERENCE in window position of the mouse (-1.0 to 1.0) since the last frame.
103 *
104 * TODO - In the Elm_glview version, 2.0 seems to be correct speed for walking, but I thought 1.0 was in Evas_GL.
105 */
106
107static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
108{
109 GLData *gld = data;
110 Evas_Event_Key_Up *ev = event_info;
111
112 if (gld->move)
113 {
114 // TODO - Careful, gld->move MIGHT be read at the other end by another thread. MIGHT, coz I really don't know at what point the camera animate routine is actually called.
115
116 // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ...
117 // TODO - make this a hash lookup dammit.
118 if (0 == strcmp(ev->key, "Escape"))
119 {
120 }
121 else if (0 == strcmp(ev->key, "Left"))
122 gld->move->y = 0.0;
123 else if (0 == strcmp(ev->key, "Right"))
124 gld->move->y = 0.0;
125 else if (0 == strcmp(ev->key, "Up"))
126 gld->move->x = 0.0;
127 else if (0 == strcmp(ev->key, "Down"))
128 gld->move->x = 0.0;
129 else if (0 == strcmp(ev->key, "Prior"))
130 gld->move->z = 0.0;
131 else if (0 == strcmp(ev->key, "Next"))
132 gld->move->z = 0.0;
133// else if (0 == strcmp(ev->key, "Home"))
134// ;
135// else if (0 == strcmp(ev->key, "End"))
136// ;
137 else if (0 == strcmp(ev->key, "space"))
138 gld->move->jump = 0.0;
139 else
140 printf("Unexpected up keystroke - %s\n", ev->key);
141 }
142 else
143 printf("Camera input not ready\n");
144}
145
146// Elm style event callback.
147static Eina_Bool _cb_event_GL(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info)
148{
149 GLData *gld = data;
150 Eina_Bool processed = EINA_FALSE;
151
152 switch (type)
153 {
154 case EVAS_CALLBACK_KEY_DOWN :
155 {
156 _on_camera_input_down(gld, evas_object_evas_get(obj), obj, event_info);
157 processed = EINA_TRUE;
158 break;
159 }
160
161 case EVAS_CALLBACK_KEY_UP :
162 {
163 _on_camera_input_up(gld, evas_object_evas_get(obj), obj, event_info);
164 processed = EINA_TRUE;
165 break;
166 }
167
168 default :
169 printf("Unknown GL input event.\n");
170 }
171
172 return processed;
173}
174
175
176void cameraAdd(Evas_Object *win, GLData *gld)
177{
178 // In this code, we are making our own camera, so grab it's input when we are focused.
179 evas_object_event_callback_add(win, EVAS_CALLBACK_KEY_DOWN, _on_camera_input_down, gld);
180 evas_object_event_callback_add(win, EVAS_CALLBACK_KEY_UP, _on_camera_input_up, gld);
181 elm_object_event_callback_add(win, _cb_event_GL, gld);
182}
diff --git a/src/extantz/chat.c b/src/extantz/chat.c
index 23155a9..e8a0c4d 100644
--- a/src/extantz/chat.c
+++ b/src/extantz/chat.c
@@ -7,30 +7,41 @@ void chat_add(GLData *gld)
7 7
8 win = fang_win_add(gld); 8 win = fang_win_add(gld);
9 9
10 bx = elm_box_add(win); 10 bx = eo_add(ELM_OBJ_BOX_CLASS, win);
11 eo_do(bx,
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)
14 );
11 elm_win_resize_object_add(win, bx); 15 elm_win_resize_object_add(win, bx);
12 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
13 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
14 16
15 en = elm_entry_add(win); 17 en = eo_add(ELM_OBJ_ENTRY_CLASS, win);
16 elm_entry_scrollable_set(en, EINA_TRUE);
17 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
18 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
19 elm_object_text_set(en, "History is shown here"); 18 elm_object_text_set(en, "History is shown here");
20 elm_entry_editable_set(en, EINA_FALSE); 19 eo_do(en,
21 evas_object_show(en); 20 elm_obj_entry_scrollable_set(EINA_TRUE),
21 elm_obj_entry_editable_set(EINA_FALSE),
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),
24 evas_obj_visibility_set(EINA_TRUE)
25 );
22 elm_box_pack_end(bx, en); 26 elm_box_pack_end(bx, en);
27 eo_unref(en);
23 28
24 en = elm_entry_add(win); 29 en = eo_add(ELM_OBJ_ENTRY_CLASS, win);
25 elm_entry_scrollable_set(en, EINA_TRUE);
26 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
27 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
28 elm_object_text_set(en, ""); 30 elm_object_text_set(en, "");
29 elm_entry_editable_set(en, EINA_TRUE); 31 eo_do(en,
30 evas_object_show(en); 32 elm_obj_entry_scrollable_set(EINA_TRUE),
33// TODO - Setting editable to TRUE is what hangs up extantz on exit.
34// elm_obj_entry_editable_set(EINA_TRUE),
35 elm_obj_entry_editable_set(EINA_FALSE),
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),
38 evas_obj_visibility_set(EINA_TRUE)
39 );
31 elm_box_pack_end(bx, en); 40 elm_box_pack_end(bx, en);
41 eo_unref(en);
32 42
33 evas_object_show(bx); 43 evas_object_show(bx);
44 eo_unref(bx);
34 45
35 fang_win_complete(gld, win, 30, 500, gld->win_w / 3, gld->win_h / 3); 46 fang_win_complete(gld, win, 30, 500, gld->win_w / 3, gld->win_h / 3);
36} 47}
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c
index 28df70f..6ef2b75 100644
--- a/src/extantz/extantz.c
+++ b/src/extantz/extantz.c
@@ -34,7 +34,8 @@ static void _resize(GLData *gld)
34{ 34{
35 Evas_GL_API *gl = gld->glApi; 35 Evas_GL_API *gl = gld->glApi;
36 36
37 _resize_winwin(gld); 37 if (gld->elmGl)
38 _resize_winwin(gld);
38 39
39#if DO_GEARS 40#if DO_GEARS
40 GLfloat ar, m[16] = { 41 GLfloat ar, m[16] = {
@@ -56,7 +57,8 @@ static void _resize(GLData *gld)
56 memcpy(gld->proj, m, sizeof gld->proj); 57 memcpy(gld->proj, m, sizeof gld->proj);
57#endif 58#endif
58 59
59 gl->glViewport(0, 0, (GLint) gld->img_w, (GLint) gld->img_h); 60 if (gl)
61 gl->glViewport(0, 0, (GLint) gld->img_w, (GLint) gld->img_h);
60} 62}
61 63
62static void _resize_gl(Evas_Object *obj) 64static void _resize_gl(Evas_Object *obj)
@@ -71,6 +73,16 @@ static void _resize_gl(Evas_Object *obj)
71 _resize(gld); 73 _resize(gld);
72} 74}
73 75
76static void _on_resize(void *data, Evas *evas, Evas_Object *obj, void *event_info)
77{
78 globals *ourGlobals = data;
79 GLData *gld = &ourGlobals->gld;
80
81 eo_do(gld->win, evas_obj_size_get(&gld->win_w, &gld->win_h));
82 eo_do(ourGlobals->tb, evas_obj_size_set(gld->win_w, 25));
83 _resize(gld);
84}
85
74// Callback from Evas, also used as the general callback for deleting the GL stuff. 86// Callback from Evas, also used as the general callback for deleting the GL stuff.
75static void _clean_gl(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 87static void _clean_gl(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
76{ 88{
@@ -128,6 +140,7 @@ static void _draw_gl(Evas_Object *obj)
128{ 140{
129 globals *ourGlobals = evas_object_data_get(obj, "glob"); 141 globals *ourGlobals = evas_object_data_get(obj, "glob");
130 GLData *gld = &ourGlobals->gld; 142 GLData *gld = &ourGlobals->gld;
143 if (!ourGlobals) return;
131 144
132 if (!gld->doneIrr) gld->doneIrr = startIrr(gld); // Needs to be after gld->win is shown, and needs to be done in the render thread. 145 if (!gld->doneIrr) gld->doneIrr = startIrr(gld); // Needs to be after gld->win is shown, and needs to be done in the render thread.
133#if DO_GEARS 146#if DO_GEARS
@@ -142,7 +155,7 @@ static void _draw_gl(Evas_Object *obj)
142 drawGears(gld); 155 drawGears(gld);
143#endif 156#endif
144 157
145 _animate_scene(ourGlobals->scene); 158 _animate_scene(ourGlobals);
146 159
147 drawIrr_end(gld); 160 drawIrr_end(gld);
148 161
@@ -254,17 +267,19 @@ static Evas_Object *_toolbar_menu_add(Evas_Object *win, Evas_Object *tb, char *l
254 return menu; 267 return menu;
255} 268}
256 269
257static void makeMainMenu(GLData *gld) 270static void makeMainMenu(globals *ourGlobals)
258{ 271{
272 GLData *gld = &ourGlobals->gld;
259 Evas_Object *menu, *tb; 273 Evas_Object *menu, *tb;
260 Elm_Object_Item *tb_it; 274 Elm_Object_Item *tb_it;
261 275
262 // A toolbar thingy. 276 // A toolbar thingy.
263 tb = eo_add(ELM_OBJ_TOOLBAR_CLASS, gld->win); 277 tb = eo_add(ELM_OBJ_TOOLBAR_CLASS, gld->win);
278 ourGlobals->tb = tb;
264 eo_do(tb, 279 eo_do(tb,
265 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), 280 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
266 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), 281 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
267 elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_SCROLL), 282 elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU),
268 evas_obj_size_set(gld->win_w, 25), 283 evas_obj_size_set(gld->win_w, 25),
269 evas_obj_position_set(0, 0), 284 evas_obj_position_set(0, 0),
270 elm_obj_toolbar_align_set(0.0) 285 elm_obj_toolbar_align_set(0.0)
@@ -306,7 +321,6 @@ static void makeMainMenu(GLData *gld)
306 tb_it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL); 321 tb_it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL);
307 322
308 evas_object_show(tb); 323 evas_object_show(tb);
309 eo_unref(tb);
310} 324}
311 325
312EAPI_MAIN int elm_main(int argc, char **argv) 326EAPI_MAIN int elm_main(int argc, char **argv)
@@ -354,6 +368,7 @@ EAPI_MAIN int elm_main(int argc, char **argv)
354#endif 368#endif
355 369
356 evas_object_smart_callback_add(gld->win, "delete,request", _on_done, gld); 370 evas_object_smart_callback_add(gld->win, "delete,request", _on_done, gld);
371 evas_object_event_callback_add(gld->win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals);
357 372
358 // Get the screen size. 373 // Get the screen size.
359 elm_win_screen_size_get(gld->win, &gld->win_x, &gld->win_y, &gld->scr_w, &gld->scr_h); 374 elm_win_screen_size_get(gld->win, &gld->win_x, &gld->win_y, &gld->scr_w, &gld->scr_h);
@@ -373,7 +388,6 @@ EAPI_MAIN int elm_main(int argc, char **argv)
373 elm_win_resize_object_add(gld->win, obj); 388 elm_win_resize_object_add(gld->win, obj);
374 eo_unref(obj); 389 eo_unref(obj);
375 390
376
377 gld->bx = eo_add(ELM_OBJ_BOX_CLASS, gld->win); 391 gld->bx = eo_add(ELM_OBJ_BOX_CLASS, gld->win);
378 eo_do(gld->bx, 392 eo_do(gld->bx,
379 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 393 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
@@ -384,13 +398,12 @@ EAPI_MAIN int elm_main(int argc, char **argv)
384 398
385// overlay_add(gld); 399// overlay_add(gld);
386 woMan_add(gld); 400 woMan_add(gld);
387 // TODO - This is what causes it to hang after quitting. Fix it. 401 chat_add(gld);
388// chat_add(gld);
389 402
390 // Gotta do this after adding the windows, otherwise the menu renders under the window. 403 // Gotta do this after adding the windows, otherwise the menu renders under the window.
391 // This sucks, gotta redefine this menu each time we create a new window? 404 // This sucks, gotta redefine this menu each time we create a new window?
392 // Also, GL focus gets lost when any menu is used. sigh 405 // Also, GL focus gets lost when any menu is used. sigh
393 makeMainMenu(gld); 406 makeMainMenu(&ourGlobals);
394 407
395 // This does elm_box_pack_end(), so needs to be after the others. 408 // This does elm_box_pack_end(), so needs to be after the others.
396 init_evas_gl(&ourGlobals); 409 init_evas_gl(&ourGlobals);
@@ -418,8 +431,9 @@ EAPI_MAIN int elm_main(int argc, char **argv)
418 431
419 if (gld->win) 432 if (gld->win)
420 { 433 {
434 Evas_3D_Demo_fini(&ourGlobals);
435 eo_unref(ourGlobals.tb);
421 eo_unref(gld->bx); 436 eo_unref(gld->bx);
422 Evas_3D_Demo_fini();
423 evas_object_del(gld->win); 437 evas_object_del(gld->win);
424 } 438 }
425 439
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h
index c475fa8..b91124e 100644
--- a/src/extantz/extantz.h
+++ b/src/extantz/extantz.h
@@ -1,5 +1,5 @@
1#define USE_PHYSICS 1 1#define USE_PHYSICS 1
2#define USE_IRR 1 2#define USE_IRR 0
3#define USE_DEMO 1 3#define USE_DEMO 1
4#define DO_GEARS 0 4#define DO_GEARS 0
5 5
@@ -128,6 +128,8 @@ struct _Gear
128 int count; 128 int count;
129}; 129};
130 130
131
132
131typedef struct _Scene_Data 133typedef struct _Scene_Data
132{ 134{
133 Evas_Object *image; // Our Elm image. 135 Evas_Object *image; // Our Elm image.
@@ -216,6 +218,7 @@ typedef struct _globals
216{ 218{
217 Evas *evas; 219 Evas *evas;
218 Evas_Object *win; // Our Elm window. 220 Evas_Object *win; // Our Elm window.
221 Evas_Object *tb; // Our Elm toolbar.
219 Eina_Clist widgets; // Our windows widgets. 222 Eina_Clist widgets; // Our windows widgets.
220 int logDom; // Our logging domain. 223 int logDom; // Our logging domain.
221 224
@@ -239,7 +242,9 @@ EAPI void finishIrr(GLData *gld);
239 242
240EAPI void Evas_3D_Demo_add(globals *ourGlobals); 243EAPI void Evas_3D_Demo_add(globals *ourGlobals);
241Eina_Bool _animate_scene(void *data); 244Eina_Bool _animate_scene(void *data);
242void Evas_3D_Demo_fini(void); 245void Evas_3D_Demo_fini(globals *ourGlobals);
246
247void cameraAdd(Evas_Object *win, GLData *gld);
243 248
244Evas_Object *fang_win_add(GLData *gld); 249Evas_Object *fang_win_add(GLData *gld);
245void fang_win_complete(GLData *gld, Evas_Object *win, int x, int y, int w, int h); 250void fang_win_complete(GLData *gld, Evas_Object *win, int x, int y, int w, int h);
diff --git a/src/extantz/fangWin.c b/src/extantz/fangWin.c
index 06bfde4..8f68658 100644
--- a/src/extantz/fangWin.c
+++ b/src/extantz/fangWin.c
@@ -1,176 +1,6 @@
1#include "extantz.h" 1#include "extantz.h"
2 2
3 3
4static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
5{
6 GLData *gld = data;
7 Evas_Event_Key_Down *ev = event_info;
8
9 if (gld->move)
10 {
11 // TODO - Careful, gld->move MIGHT be read at the other end by another thread. MIGHT, coz I really don't know at what point the camera animate routine is actually called.
12
13 // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ...
14 // TODO - make this a hash lookup dammit.
15 if (0 == strcmp(ev->key, "Escape"))
16 {
17 }
18 else if (0 == strcmp(ev->key, "Left"))
19 gld->move->r = 2.0;
20 else if (0 == strcmp(ev->key, "Right"))
21 gld->move->r = -2.0;
22 else if (0 == strcmp(ev->key, "Up"))
23 gld->move->x = 2.0;
24 else if (0 == strcmp(ev->key, "Down"))
25 gld->move->x = -2.0;
26// else if (0 == strcmp(ev->key, "Prior"))
27// ;
28// else if (0 == strcmp(ev->key, "Next"))
29// ;
30// else if (0 == strcmp(ev->key, "Home"))
31// ;
32// else if (0 == strcmp(ev->key, "End"))
33// ;
34 else if (0 == strcmp(ev->key, "space"))
35 gld->move->jump = 1.0;
36 else
37 printf("Unexpected down keystroke - %s\n", ev->key);
38 }
39 else
40 printf("Camera input not ready\n");
41}
42
43/* SL / OS camera controls
44 up / down / w / s moves avatar forward / backward
45 shifted version does the same
46 double tap triggers run mode / or fast fly mode
47 Running backwards turns your avatar to suit, walking does not.
48 left / right / a / d rotates avatar left / right, strafes in mouselook
49 shifted version turns the avatar to walk sideways, so not really a strafe.
50 So not sure if the "strafe" in mouse look turns the avatar as well?
51 PgDn / c crouch while it is held down move up in flight mode
52 PgUp jump move down in flight mode
53 Home toggle flying
54 End Nothing?
55 Esc return to third person view
56 m toggle mouse look
57 mouse wheel move view closer / further away from current focused object or avatar
58 Alt left click focus on some other object
59 Ins ???
60 Del ???
61 BS ???
62 Tab ???
63
64 Mouse look is just first person view, moving mouse looks left / right / up / down.
65 Not sure if the avatar rotates with left / right, but that's likely.
66
67 mouse moves With the left mouse button held down -
68 left / right up / down
69 ---------------------------------
70 for avatar swings avatar around zoom in and out of avatar
71 for object nothing
72 alt orbit left / right zoom in and out
73 alt ctrl orbit left / right orbit up / down
74 alt shift orbit left / right zoom in and out
75 alt ctrl shift shift view left / right / up / down
76 ctrl Nothing?
77 shift Nothing?
78 ctrl shift Nothing?
79
80 Need to also consider when looking at a moving object / avatar.
81
82 I think there are other letter keys that duplicate arrow keys and such. I'll look for them later, but I don't use them.
83 No idea what the function keys are mapped to, but think it's various non camera stuff.
84 I'm damn well leaving the Win/Command and Menu keys for the OS / window manager. lol
85 Keypad keys? Not interested, I don't have them.
86 Print Screen / SysRq, Pause / Break, other oddball keys, also not interested.
87 NOTE - gonna have an easily programmable "bind key to command" thingy, like E17s, so that can deal with other keys.
88 Should even let them be saveable so people can swap them with other people easily.
89
90 TODO - implement things like space mouse, sixaxis, phone as controller, joysticks, data gloves, etc.
91*/
92
93/* A moveRotate array of floats.
94 * X, Y, Z, and whatever the usual letters are for rotations. lol
95 * Each one means "move or rotate this much in this direction".
96 * Where 1.0 means "what ever the standard move is if that key is held down".
97 * So a keyboard move would just change it's part to 1.0 or -1.0 on key down,
98 * and back to 0.0 on key up. Or 2.0 / -2.0 if in run mode.
99 * Which would even work in fly mode.
100 * A joystick could be set to range over -2.0 to 2.0, and just set it's part directly.
101 * A mouse look rotate, well will come to that when we need to. B-)
102 * Setting the x or y to be the DIFFERENCE in window position of the mouse (-1.0 to 1.0) since the last frame.
103 *
104 * TODO - In the Elm_glview version, 2.0 seems to be correct speed for walking, but I thought 1.0 was in Evas_GL.
105 */
106
107static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
108{
109 GLData *gld = data;
110 Evas_Event_Key_Up *ev = event_info;
111
112 if (gld->move)
113 {
114 // TODO - Careful, gld->move MIGHT be read at the other end by another thread. MIGHT, coz I really don't know at what point the camera animate routine is actually called.
115
116 // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ...
117 // TODO - make this a hash lookup dammit.
118 if (0 == strcmp(ev->key, "Escape"))
119 {
120 }
121 else if (0 == strcmp(ev->key, "Left"))
122 gld->move->r = 0.0;
123 else if (0 == strcmp(ev->key, "Right"))
124 gld->move->r = 0.0;
125 else if (0 == strcmp(ev->key, "Up"))
126 gld->move->x = 0.0;
127 else if (0 == strcmp(ev->key, "Down"))
128 gld->move->x = 0.0;
129// else if (0 == strcmp(ev->key, "Prior"))
130// ;
131// else if (0 == strcmp(ev->key, "Next"))
132// ;
133// else if (0 == strcmp(ev->key, "Home"))
134// ;
135// else if (0 == strcmp(ev->key, "End"))
136// ;
137 else if (0 == strcmp(ev->key, "space"))
138 gld->move->jump = 0.0;
139 else
140 printf("Unexpected up keystroke - %s\n", ev->key);
141 }
142 else
143 printf("Camera input not ready\n");
144}
145
146// Elm style event callback.
147static Eina_Bool _cb_event_GL(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info)
148{
149 GLData *gld = data;
150 Eina_Bool processed = EINA_FALSE;
151
152 switch (type)
153 {
154 case EVAS_CALLBACK_KEY_DOWN :
155 {
156 _on_camera_input_down(gld, evas_object_evas_get(obj), obj, event_info);
157 processed = EINA_TRUE;
158 break;
159 }
160
161 case EVAS_CALLBACK_KEY_UP :
162 {
163 _on_camera_input_up(gld, evas_object_evas_get(obj), obj, event_info);
164 processed = EINA_TRUE;
165 break;
166 }
167
168 default :
169 printf("Unknown GL input event.\n");
170 }
171
172 return processed;
173}
174 4
175// Elm inlined image windows needs this to change focus on mouse click. 5// Elm inlined image windows needs this to change focus on mouse click.
176// Evas style event callback. 6// Evas style event callback.
@@ -305,9 +135,7 @@ void overlay_add(GLData *gld)
305 // According to the Elm inlined image window example, this is what's needed to. 135 // According to the Elm inlined image window example, this is what's needed to.
306 evas_object_event_callback_add(elm_win_inlined_image_object_get(gld->winwin), EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, gld); 136 evas_object_event_callback_add(elm_win_inlined_image_object_get(gld->winwin), EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, gld);
307 // In this code, we are making our own camera, so grab it's input when we are focused. 137 // In this code, we are making our own camera, so grab it's input when we are focused.
308 evas_object_event_callback_add(gld->winwin, EVAS_CALLBACK_KEY_DOWN, _on_camera_input_down, gld); 138 cameraAdd(gld->winwin, gld);
309 evas_object_event_callback_add(gld->winwin, EVAS_CALLBACK_KEY_UP, _on_camera_input_up, gld);
310 elm_object_event_callback_add(gld->winwin, _cb_event_GL, gld);
311 139
312 elm_win_alpha_set(gld->winwin, EINA_TRUE); 140 elm_win_alpha_set(gld->winwin, EINA_TRUE);
313 // Apparently transparent is not good enough for ELM backgrounds, so make it a rectangle. 141 // Apparently transparent is not good enough for ELM backgrounds, so make it a rectangle.
diff --git a/src/libraries/LumbrJack.c b/src/libraries/LumbrJack.c
index ef4f081..e873d02 100644
--- a/src/libraries/LumbrJack.c
+++ b/src/libraries/LumbrJack.c
@@ -46,7 +46,7 @@ int loggingStartup(char *name, int logDom)
46 46
47 // Shut up the excess debugging shit from EFL. 47 // Shut up the excess debugging shit from EFL.
48 eina_log_domain_level_set("eo", EINA_LOG_LEVEL_WARN); 48 eina_log_domain_level_set("eo", EINA_LOG_LEVEL_WARN);
49 eina_log_domain_level_set("eldbus", EINA_LOG_LEVEL_WARN); 49 eina_log_domain_level_set("eldbus", EINA_LOG_LEVEL_CRITICAL);
50 eina_log_domain_level_set("eet", EINA_LOG_LEVEL_WARN); 50 eina_log_domain_level_set("eet", EINA_LOG_LEVEL_WARN);
51 eina_log_domain_level_set("efreet_icon", EINA_LOG_LEVEL_WARN); 51 eina_log_domain_level_set("efreet_icon", EINA_LOG_LEVEL_WARN);
52 eina_log_domain_level_set("ecore", EINA_LOG_LEVEL_WARN); 52 eina_log_domain_level_set("ecore", EINA_LOG_LEVEL_WARN);
@@ -58,7 +58,8 @@ int loggingStartup(char *name, int logDom)
58 eina_log_domain_level_set("ecore_system_upower", EINA_LOG_LEVEL_WARN); 58 eina_log_domain_level_set("ecore_system_upower", EINA_LOG_LEVEL_WARN);
59 eina_log_domain_level_set("eio", EINA_LOG_LEVEL_WARN); 59 eina_log_domain_level_set("eio", EINA_LOG_LEVEL_WARN);
60 eina_log_domain_level_set("ephysics", EINA_LOG_LEVEL_WARN); 60 eina_log_domain_level_set("ephysics", EINA_LOG_LEVEL_WARN);
61 eina_log_domain_level_set("evas_main", EINA_LOG_LEVEL_WARN); 61 eina_log_domain_level_set("evas", EINA_LOG_LEVEL_WARN);
62 eina_log_domain_level_set("evas_main", EINA_LOG_LEVEL_ERR);
62 63
63 return logDom; 64 return logDom;
64} 65}