From e8678fdfe62bf62113baef2948874c0adfc82045 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 3 May 2014 01:47:19 +1000 Subject: Major extantz clean up part 2. Including new Evas_3d style camera. --- src/extantz/Evas_3D_demo.c | 29 ++++++-- src/extantz/build.lua | 4 +- src/extantz/camera.c | 182 +++++++++++++++++++++++++++++++++++++++++++++ src/extantz/chat.c | 41 ++++++---- src/extantz/extantz.c | 36 ++++++--- src/extantz/extantz.h | 9 ++- src/extantz/fangWin.c | 174 +------------------------------------------ src/libraries/LumbrJack.c | 5 +- 8 files changed, 270 insertions(+), 210 deletions(-) create mode 100644 src/extantz/camera.c (limited to 'src') 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) Eina_Bool _animate_scene(void *data) { + globals *ourGlobals = data; + static float angle = 0.0f; static float earthAngle = 0.0f; static int frame = 0; static int inc = 1; static int sonicFrame = 0; + Evas_Real x, y, z; - Scene_Data *scene = (Scene_Data *)data; + Scene_Data *scene = ourGlobals->scene; // Animate cube. angle += 0.5; @@ -303,6 +306,13 @@ Eina_Bool _animate_scene(void *data) evas_3d_node_orientation_angle_axis_set(angle, 0.0, 1.0, 0.0) ); + // Camera movement. + eo_do(scene->camera_node, evas_3d_node_position_get(EVAS_3D_SPACE_PARENT, &x, &y, &z)); + x += ourGlobals->gld.move->x; + y += ourGlobals->gld.move->y; + z += ourGlobals->gld.move->z; + eo_do(scene->camera_node, evas_3d_node_position_set(x, y, z)); + return EINA_TRUE; } @@ -602,7 +612,10 @@ static void _on_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void elm_object_tooltip_show(scene->image); } else + { + elm_object_tooltip_text_set(scene->image, ""); elm_object_tooltip_hide(scene->image); + } } static 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 Eina_Bool pick; char *name = NULL; + // Set the focus onto us. + elm_object_focus_set(o, EINA_TRUE); + evas_object_geometry_get(o, &x, &y, &w, &h); obj_x = ev->canvas.x - x; @@ -673,15 +689,18 @@ void Evas_3D_Demo_add(globals *ourGlobals) // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas calbacks instead. evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, &ourScene); evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &ourScene); + cameraAdd(obj, &ourGlobals->gld); elm_win_resize_object_add(ourGlobals->win, obj); // elm_box_pack_end(ourGlobals->gld.bx, obj); // Add animation timer callback. // ecore_timer_add(0.016, _animate_scene, &ourScene); + ourGlobals->gld.move = calloc(1, sizeof(cameraMove)); } -void Evas_3D_Demo_fini() +void Evas_3D_Demo_fini(globals *ourGlobals) { - free(sphere_vertices); - free(sphere_indices); -} \ No newline at end of file + eo_unref(ourGlobals->scene->image); + free(sphere_vertices); + free(sphere_indices); +} 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 LDFLAGS = LDFLAGS .. ' -L../../libraries/irrlicht-1.8.1/lib/Linux' libs = libs .. ' -lIrrlicht -lGL -lbz2' -removeFiles(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'}) +removeFiles(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'}) runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' extantz.edc ../../media/extantz.edj') runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c crappisspuke.cpp -o crappisspuke.o ' .. LDFLAGS) runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS) runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS) -compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'Evas_3D_demo', 'fangWin', 'chat', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o') +compileFiles('../../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 @@ +#include "extantz.h" + + +static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) +{ + GLData *gld = data; + Evas_Event_Key_Down *ev = event_info; + + if (gld->move) + { + // 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. + + // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ... + // TODO - make this a hash lookup dammit. + if (0 == strcmp(ev->key, "Escape")) + { + } + else if (0 == strcmp(ev->key, "Left")) + gld->move->y = 2.0; + else if (0 == strcmp(ev->key, "Right")) + gld->move->y = -2.0; + else if (0 == strcmp(ev->key, "Up")) + gld->move->x = 2.0; + else if (0 == strcmp(ev->key, "Down")) + gld->move->x = -2.0; + else if (0 == strcmp(ev->key, "Prior")) + gld->move->z = -2.0; + else if (0 == strcmp(ev->key, "Next")) + gld->move->z = 2.0; +// else if (0 == strcmp(ev->key, "Home")) +// ; +// else if (0 == strcmp(ev->key, "End")) +// ; + else if (0 == strcmp(ev->key, "space")) + gld->move->jump = 1.0; + else + printf("Unexpected down keystroke - %s\n", ev->key); + } + else + printf("Camera input not ready\n"); +} + +/* SL / OS camera controls + up / down / w / s moves avatar forward / backward + shifted version does the same + double tap triggers run mode / or fast fly mode + Running backwards turns your avatar to suit, walking does not. + left / right / a / d rotates avatar left / right, strafes in mouselook + shifted version turns the avatar to walk sideways, so not really a strafe. + So not sure if the "strafe" in mouse look turns the avatar as well? + PgDn / c crouch while it is held down move up in flight mode + PgUp jump move down in flight mode + Home toggle flying + End Nothing? + Esc return to third person view + m toggle mouse look + mouse wheel move view closer / further away from current focused object or avatar + Alt left click focus on some other object + Ins ??? + Del ??? + BS ??? + Tab ??? + + Mouse look is just first person view, moving mouse looks left / right / up / down. + Not sure if the avatar rotates with left / right, but that's likely. + + mouse moves With the left mouse button held down - + left / right up / down + --------------------------------- + for avatar swings avatar around zoom in and out of avatar + for object nothing + alt orbit left / right zoom in and out + alt ctrl orbit left / right orbit up / down + alt shift orbit left / right zoom in and out + alt ctrl shift shift view left / right / up / down + ctrl Nothing? + shift Nothing? + ctrl shift Nothing? + + Need to also consider when looking at a moving object / avatar. + + 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. + No idea what the function keys are mapped to, but think it's various non camera stuff. + I'm damn well leaving the Win/Command and Menu keys for the OS / window manager. lol + Keypad keys? Not interested, I don't have them. + Print Screen / SysRq, Pause / Break, other oddball keys, also not interested. + NOTE - gonna have an easily programmable "bind key to command" thingy, like E17s, so that can deal with other keys. + Should even let them be saveable so people can swap them with other people easily. + + TODO - implement things like space mouse, sixaxis, phone as controller, joysticks, data gloves, etc. +*/ + +/* A moveRotate array of floats. + * X, Y, Z, and whatever the usual letters are for rotations. lol + * Each one means "move or rotate this much in this direction". + * Where 1.0 means "what ever the standard move is if that key is held down". + * So a keyboard move would just change it's part to 1.0 or -1.0 on key down, + * and back to 0.0 on key up. Or 2.0 / -2.0 if in run mode. + * Which would even work in fly mode. + * A joystick could be set to range over -2.0 to 2.0, and just set it's part directly. + * A mouse look rotate, well will come to that when we need to. B-) + * Setting the x or y to be the DIFFERENCE in window position of the mouse (-1.0 to 1.0) since the last frame. + * + * TODO - In the Elm_glview version, 2.0 seems to be correct speed for walking, but I thought 1.0 was in Evas_GL. + */ + +static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) +{ + GLData *gld = data; + Evas_Event_Key_Up *ev = event_info; + + if (gld->move) + { + // 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. + + // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ... + // TODO - make this a hash lookup dammit. + if (0 == strcmp(ev->key, "Escape")) + { + } + else if (0 == strcmp(ev->key, "Left")) + gld->move->y = 0.0; + else if (0 == strcmp(ev->key, "Right")) + gld->move->y = 0.0; + else if (0 == strcmp(ev->key, "Up")) + gld->move->x = 0.0; + else if (0 == strcmp(ev->key, "Down")) + gld->move->x = 0.0; + else if (0 == strcmp(ev->key, "Prior")) + gld->move->z = 0.0; + else if (0 == strcmp(ev->key, "Next")) + gld->move->z = 0.0; +// else if (0 == strcmp(ev->key, "Home")) +// ; +// else if (0 == strcmp(ev->key, "End")) +// ; + else if (0 == strcmp(ev->key, "space")) + gld->move->jump = 0.0; + else + printf("Unexpected up keystroke - %s\n", ev->key); + } + else + printf("Camera input not ready\n"); +} + +// Elm style event callback. +static Eina_Bool _cb_event_GL(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info) +{ + GLData *gld = data; + Eina_Bool processed = EINA_FALSE; + + switch (type) + { + case EVAS_CALLBACK_KEY_DOWN : + { + _on_camera_input_down(gld, evas_object_evas_get(obj), obj, event_info); + processed = EINA_TRUE; + break; + } + + case EVAS_CALLBACK_KEY_UP : + { + _on_camera_input_up(gld, evas_object_evas_get(obj), obj, event_info); + processed = EINA_TRUE; + break; + } + + default : + printf("Unknown GL input event.\n"); + } + + return processed; +} + + +void cameraAdd(Evas_Object *win, GLData *gld) +{ + // In this code, we are making our own camera, so grab it's input when we are focused. + evas_object_event_callback_add(win, EVAS_CALLBACK_KEY_DOWN, _on_camera_input_down, gld); + evas_object_event_callback_add(win, EVAS_CALLBACK_KEY_UP, _on_camera_input_up, gld); + elm_object_event_callback_add(win, _cb_event_GL, gld); +} 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) win = fang_win_add(gld); - bx = elm_box_add(win); + bx = eo_add(ELM_OBJ_BOX_CLASS, win); + eo_do(bx, + evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), + evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL) + ); elm_win_resize_object_add(win, bx); - evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); - en = elm_entry_add(win); - elm_entry_scrollable_set(en, EINA_TRUE); - evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + en = eo_add(ELM_OBJ_ENTRY_CLASS, win); elm_object_text_set(en, "History is shown here"); - elm_entry_editable_set(en, EINA_FALSE); - evas_object_show(en); + eo_do(en, + elm_obj_entry_scrollable_set(EINA_TRUE), + elm_obj_entry_editable_set(EINA_FALSE), + evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), + evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), + evas_obj_visibility_set(EINA_TRUE) + ); elm_box_pack_end(bx, en); + eo_unref(en); - en = elm_entry_add(win); - elm_entry_scrollable_set(en, EINA_TRUE); - evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + en = eo_add(ELM_OBJ_ENTRY_CLASS, win); elm_object_text_set(en, ""); - elm_entry_editable_set(en, EINA_TRUE); - evas_object_show(en); + eo_do(en, + elm_obj_entry_scrollable_set(EINA_TRUE), +// TODO - Setting editable to TRUE is what hangs up extantz on exit. +// elm_obj_entry_editable_set(EINA_TRUE), + elm_obj_entry_editable_set(EINA_FALSE), + evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), + evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), + evas_obj_visibility_set(EINA_TRUE) + ); elm_box_pack_end(bx, en); + eo_unref(en); evas_object_show(bx); + eo_unref(bx); fang_win_complete(gld, win, 30, 500, gld->win_w / 3, gld->win_h / 3); } 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) { Evas_GL_API *gl = gld->glApi; - _resize_winwin(gld); + if (gld->elmGl) + _resize_winwin(gld); #if DO_GEARS GLfloat ar, m[16] = { @@ -56,7 +57,8 @@ static void _resize(GLData *gld) memcpy(gld->proj, m, sizeof gld->proj); #endif - gl->glViewport(0, 0, (GLint) gld->img_w, (GLint) gld->img_h); + if (gl) + gl->glViewport(0, 0, (GLint) gld->img_w, (GLint) gld->img_h); } static void _resize_gl(Evas_Object *obj) @@ -71,6 +73,16 @@ static void _resize_gl(Evas_Object *obj) _resize(gld); } +static void _on_resize(void *data, Evas *evas, Evas_Object *obj, void *event_info) +{ + globals *ourGlobals = data; + GLData *gld = &ourGlobals->gld; + + eo_do(gld->win, evas_obj_size_get(&gld->win_w, &gld->win_h)); + eo_do(ourGlobals->tb, evas_obj_size_set(gld->win_w, 25)); + _resize(gld); +} + // Callback from Evas, also used as the general callback for deleting the GL stuff. static void _clean_gl(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -128,6 +140,7 @@ static void _draw_gl(Evas_Object *obj) { globals *ourGlobals = evas_object_data_get(obj, "glob"); GLData *gld = &ourGlobals->gld; + if (!ourGlobals) return; if (!gld->doneIrr) gld->doneIrr = startIrr(gld); // Needs to be after gld->win is shown, and needs to be done in the render thread. #if DO_GEARS @@ -142,7 +155,7 @@ static void _draw_gl(Evas_Object *obj) drawGears(gld); #endif - _animate_scene(ourGlobals->scene); + _animate_scene(ourGlobals); drawIrr_end(gld); @@ -254,17 +267,19 @@ static Evas_Object *_toolbar_menu_add(Evas_Object *win, Evas_Object *tb, char *l return menu; } -static void makeMainMenu(GLData *gld) +static void makeMainMenu(globals *ourGlobals) { + GLData *gld = &ourGlobals->gld; Evas_Object *menu, *tb; Elm_Object_Item *tb_it; // A toolbar thingy. tb = eo_add(ELM_OBJ_TOOLBAR_CLASS, gld->win); + ourGlobals->tb = tb; eo_do(tb, evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), - elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_SCROLL), + elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU), evas_obj_size_set(gld->win_w, 25), evas_obj_position_set(0, 0), elm_obj_toolbar_align_set(0.0) @@ -306,7 +321,6 @@ static void makeMainMenu(GLData *gld) tb_it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL); evas_object_show(tb); - eo_unref(tb); } EAPI_MAIN int elm_main(int argc, char **argv) @@ -354,6 +368,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) #endif evas_object_smart_callback_add(gld->win, "delete,request", _on_done, gld); + evas_object_event_callback_add(gld->win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); // Get the screen size. 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) elm_win_resize_object_add(gld->win, obj); eo_unref(obj); - gld->bx = eo_add(ELM_OBJ_BOX_CLASS, gld->win); eo_do(gld->bx, 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) // overlay_add(gld); woMan_add(gld); - // TODO - This is what causes it to hang after quitting. Fix it. -// chat_add(gld); + chat_add(gld); // Gotta do this after adding the windows, otherwise the menu renders under the window. // This sucks, gotta redefine this menu each time we create a new window? // Also, GL focus gets lost when any menu is used. sigh - makeMainMenu(gld); + makeMainMenu(&ourGlobals); // This does elm_box_pack_end(), so needs to be after the others. init_evas_gl(&ourGlobals); @@ -418,8 +431,9 @@ EAPI_MAIN int elm_main(int argc, char **argv) if (gld->win) { + Evas_3D_Demo_fini(&ourGlobals); + eo_unref(ourGlobals.tb); eo_unref(gld->bx); - Evas_3D_Demo_fini(); evas_object_del(gld->win); } 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 @@ #define USE_PHYSICS 1 -#define USE_IRR 1 +#define USE_IRR 0 #define USE_DEMO 1 #define DO_GEARS 0 @@ -128,6 +128,8 @@ struct _Gear int count; }; + + typedef struct _Scene_Data { Evas_Object *image; // Our Elm image. @@ -216,6 +218,7 @@ typedef struct _globals { Evas *evas; Evas_Object *win; // Our Elm window. + Evas_Object *tb; // Our Elm toolbar. Eina_Clist widgets; // Our windows widgets. int logDom; // Our logging domain. @@ -239,7 +242,9 @@ EAPI void finishIrr(GLData *gld); EAPI void Evas_3D_Demo_add(globals *ourGlobals); Eina_Bool _animate_scene(void *data); -void Evas_3D_Demo_fini(void); +void Evas_3D_Demo_fini(globals *ourGlobals); + +void cameraAdd(Evas_Object *win, GLData *gld); Evas_Object *fang_win_add(GLData *gld); void 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 @@ #include "extantz.h" -static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - GLData *gld = data; - Evas_Event_Key_Down *ev = event_info; - - if (gld->move) - { - // 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. - - // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ... - // TODO - make this a hash lookup dammit. - if (0 == strcmp(ev->key, "Escape")) - { - } - else if (0 == strcmp(ev->key, "Left")) - gld->move->r = 2.0; - else if (0 == strcmp(ev->key, "Right")) - gld->move->r = -2.0; - else if (0 == strcmp(ev->key, "Up")) - gld->move->x = 2.0; - else if (0 == strcmp(ev->key, "Down")) - gld->move->x = -2.0; -// else if (0 == strcmp(ev->key, "Prior")) -// ; -// else if (0 == strcmp(ev->key, "Next")) -// ; -// else if (0 == strcmp(ev->key, "Home")) -// ; -// else if (0 == strcmp(ev->key, "End")) -// ; - else if (0 == strcmp(ev->key, "space")) - gld->move->jump = 1.0; - else - printf("Unexpected down keystroke - %s\n", ev->key); - } - else - printf("Camera input not ready\n"); -} - -/* SL / OS camera controls - up / down / w / s moves avatar forward / backward - shifted version does the same - double tap triggers run mode / or fast fly mode - Running backwards turns your avatar to suit, walking does not. - left / right / a / d rotates avatar left / right, strafes in mouselook - shifted version turns the avatar to walk sideways, so not really a strafe. - So not sure if the "strafe" in mouse look turns the avatar as well? - PgDn / c crouch while it is held down move up in flight mode - PgUp jump move down in flight mode - Home toggle flying - End Nothing? - Esc return to third person view - m toggle mouse look - mouse wheel move view closer / further away from current focused object or avatar - Alt left click focus on some other object - Ins ??? - Del ??? - BS ??? - Tab ??? - - Mouse look is just first person view, moving mouse looks left / right / up / down. - Not sure if the avatar rotates with left / right, but that's likely. - - mouse moves With the left mouse button held down - - left / right up / down - --------------------------------- - for avatar swings avatar around zoom in and out of avatar - for object nothing - alt orbit left / right zoom in and out - alt ctrl orbit left / right orbit up / down - alt shift orbit left / right zoom in and out - alt ctrl shift shift view left / right / up / down - ctrl Nothing? - shift Nothing? - ctrl shift Nothing? - - Need to also consider when looking at a moving object / avatar. - - 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. - No idea what the function keys are mapped to, but think it's various non camera stuff. - I'm damn well leaving the Win/Command and Menu keys for the OS / window manager. lol - Keypad keys? Not interested, I don't have them. - Print Screen / SysRq, Pause / Break, other oddball keys, also not interested. - NOTE - gonna have an easily programmable "bind key to command" thingy, like E17s, so that can deal with other keys. - Should even let them be saveable so people can swap them with other people easily. - - TODO - implement things like space mouse, sixaxis, phone as controller, joysticks, data gloves, etc. -*/ - -/* A moveRotate array of floats. - * X, Y, Z, and whatever the usual letters are for rotations. lol - * Each one means "move or rotate this much in this direction". - * Where 1.0 means "what ever the standard move is if that key is held down". - * So a keyboard move would just change it's part to 1.0 or -1.0 on key down, - * and back to 0.0 on key up. Or 2.0 / -2.0 if in run mode. - * Which would even work in fly mode. - * A joystick could be set to range over -2.0 to 2.0, and just set it's part directly. - * A mouse look rotate, well will come to that when we need to. B-) - * Setting the x or y to be the DIFFERENCE in window position of the mouse (-1.0 to 1.0) since the last frame. - * - * TODO - In the Elm_glview version, 2.0 seems to be correct speed for walking, but I thought 1.0 was in Evas_GL. - */ - -static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - GLData *gld = data; - Evas_Event_Key_Up *ev = event_info; - - if (gld->move) - { - // 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. - - // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ... - // TODO - make this a hash lookup dammit. - if (0 == strcmp(ev->key, "Escape")) - { - } - else if (0 == strcmp(ev->key, "Left")) - gld->move->r = 0.0; - else if (0 == strcmp(ev->key, "Right")) - gld->move->r = 0.0; - else if (0 == strcmp(ev->key, "Up")) - gld->move->x = 0.0; - else if (0 == strcmp(ev->key, "Down")) - gld->move->x = 0.0; -// else if (0 == strcmp(ev->key, "Prior")) -// ; -// else if (0 == strcmp(ev->key, "Next")) -// ; -// else if (0 == strcmp(ev->key, "Home")) -// ; -// else if (0 == strcmp(ev->key, "End")) -// ; - else if (0 == strcmp(ev->key, "space")) - gld->move->jump = 0.0; - else - printf("Unexpected up keystroke - %s\n", ev->key); - } - else - printf("Camera input not ready\n"); -} - -// Elm style event callback. -static Eina_Bool _cb_event_GL(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info) -{ - GLData *gld = data; - Eina_Bool processed = EINA_FALSE; - - switch (type) - { - case EVAS_CALLBACK_KEY_DOWN : - { - _on_camera_input_down(gld, evas_object_evas_get(obj), obj, event_info); - processed = EINA_TRUE; - break; - } - - case EVAS_CALLBACK_KEY_UP : - { - _on_camera_input_up(gld, evas_object_evas_get(obj), obj, event_info); - processed = EINA_TRUE; - break; - } - - default : - printf("Unknown GL input event.\n"); - } - - return processed; -} // Elm inlined image windows needs this to change focus on mouse click. // Evas style event callback. @@ -305,9 +135,7 @@ void overlay_add(GLData *gld) // According to the Elm inlined image window example, this is what's needed to. evas_object_event_callback_add(elm_win_inlined_image_object_get(gld->winwin), EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, gld); // In this code, we are making our own camera, so grab it's input when we are focused. - evas_object_event_callback_add(gld->winwin, EVAS_CALLBACK_KEY_DOWN, _on_camera_input_down, gld); - evas_object_event_callback_add(gld->winwin, EVAS_CALLBACK_KEY_UP, _on_camera_input_up, gld); - elm_object_event_callback_add(gld->winwin, _cb_event_GL, gld); + cameraAdd(gld->winwin, gld); elm_win_alpha_set(gld->winwin, EINA_TRUE); // 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) // Shut up the excess debugging shit from EFL. eina_log_domain_level_set("eo", EINA_LOG_LEVEL_WARN); - eina_log_domain_level_set("eldbus", EINA_LOG_LEVEL_WARN); + eina_log_domain_level_set("eldbus", EINA_LOG_LEVEL_CRITICAL); eina_log_domain_level_set("eet", EINA_LOG_LEVEL_WARN); eina_log_domain_level_set("efreet_icon", EINA_LOG_LEVEL_WARN); eina_log_domain_level_set("ecore", EINA_LOG_LEVEL_WARN); @@ -58,7 +58,8 @@ int loggingStartup(char *name, int logDom) eina_log_domain_level_set("ecore_system_upower", EINA_LOG_LEVEL_WARN); eina_log_domain_level_set("eio", EINA_LOG_LEVEL_WARN); eina_log_domain_level_set("ephysics", EINA_LOG_LEVEL_WARN); - eina_log_domain_level_set("evas_main", EINA_LOG_LEVEL_WARN); + eina_log_domain_level_set("evas", EINA_LOG_LEVEL_WARN); + eina_log_domain_level_set("evas_main", EINA_LOG_LEVEL_ERR); return logDom; } -- cgit v1.1