aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ClientHamr/extantz/extantz.c128
1 files changed, 69 insertions, 59 deletions
diff --git a/ClientHamr/extantz/extantz.c b/ClientHamr/extantz/extantz.c
index 7e9f353..6d45501 100644
--- a/ClientHamr/extantz/extantz.c
+++ b/ClientHamr/extantz/extantz.c
@@ -350,86 +350,95 @@ static void _cb_mouse_down_elm(void *data, Evas *evas, Evas_Object *obj, void *e
350 { 350 {
351 gld->camFocus = 0; 351 gld->camFocus = 0;
352 // TODO - Yes we really DO need to figure out what was clicked on and set focus to it. sigh 352 // TODO - Yes we really DO need to figure out what was clicked on and set focus to it. sigh
353 // For now, we only got one window, focus on it's box. 353// elm_object_focus_set(gld->bx, EINA_TRUE);
354 elm_object_focus_set(gld->bx, EINA_TRUE);
355 printf("ELM object focused.\n"); 354 printf("ELM object focused.\n");
356 } 355 }
357} 356}
358 357
359static Eina_Bool _on_camera_input(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info) 358// These do not work as elm callbacks, coz Elm is grabbing the Left, Right, Up, and Down KEY_DOWNs. Something else is messing up Home + PgUp / PgDn.
359// It's a purely Evas object anyway.
360static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
360{ 361{
361 GLData *gld = data; 362 GLData *gld = data;
363 Evas_Event_Key_Down *ev = event_info;
362 364
363 if (gld->camFocus) 365 if (gld->camFocus)
364 { 366 {
365 if (gld->move) 367 if (gld->move)
366 { 368 {
367 // TODO - Careful, gld->move MIGHT be read at the other end by another thread. MIGHT, coz I really don't now at what point the camera animate routine is actually called. 369 // TODO - Careful, gld->move MIGHT be read at the other end by another thread. MIGHT, coz I really don't now at what point the camera animate routine is actually called.
368 Evas_Event_Key_Down *ev = event_info;
369 370
370 // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ... 371 // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ...
371 // TODO - make this a hash lookup dammit. 372 // TODO - make this a hash lookup dammit.
372 // TODO - these are not working, coz Elm is grabbing the Left, Right, Up, and Down KEY_DOWNs. 373 if (0 == strcmp(ev->key, "Escape"))
373 // TODO - no idea why yet, but can't do Home and Prior / Next at the same time. Don't seem to be a bug in the Irrlicht original at least.
374 if (EVAS_CALLBACK_KEY_DOWN == type)
375 { 374 {
376 if (0 == strcmp(ev->keyname, "Escape"))
377 {
378 }
379 else if (0 == strcmp(ev->key, "Left"))
380 gld->move->r = 1.0;
381 else if (0 == strcmp(ev->key, "Right"))
382 gld->move->r = -1.0;
383 else if (0 == strcmp(ev->key, "Up"))
384 gld->move->x = 1.0;
385 else if (0 == strcmp(ev->key, "Down"))
386 gld->move->x = -1.0;
387 else if (0 == strcmp(ev->key, "Prior"))
388 gld->move->x = 1.0;
389 else if (0 == strcmp(ev->key, "Next"))
390 gld->move->x = -1.0;
391 else if (0 == strcmp(ev->key, "Home"))
392 gld->move->r = 1.0;
393 else if (0 == strcmp(ev->key, "End"))
394 gld->move->r = -1.0;
395 else if (0 == strcmp(ev->key, "space"))
396 gld->move->jump = 1.0;
397 else
398 printf("Unexpected down keystroke - %s\n", ev->key);
399 } 375 }
400 else if (EVAS_CALLBACK_KEY_UP == type) 376 else if (0 == strcmp(ev->key, "Left"))
377 gld->move->r = 1.0;
378 else if (0 == strcmp(ev->key, "Right"))
379 gld->move->r = -1.0;
380 else if (0 == strcmp(ev->key, "Up"))
381 gld->move->x = 1.0;
382 else if (0 == strcmp(ev->key, "Down"))
383 gld->move->x = -1.0;
384 else if (0 == strcmp(ev->key, "Prior"))
385 ;
386 else if (0 == strcmp(ev->key, "Next"))
387 ;
388 else if (0 == strcmp(ev->key, "Home"))
389 ;
390 else if (0 == strcmp(ev->key, "End"))
391 ;
392 else if (0 == strcmp(ev->key, "space"))
393 gld->move->jump = 1.0;
394 else
395 printf("Unexpected down keystroke - %s\n", ev->key);
396 }
397 else
398 printf("Camera input not ready\n");
399 }
400}
401
402static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
403{
404 GLData *gld = data;
405 Evas_Event_Key_Up *ev = event_info;
406
407 if (gld->camFocus)
408 {
409 if (gld->move)
410 {
411 // TODO - Careful, gld->move MIGHT be read at the other end by another thread. MIGHT, coz I really don't now at what point the camera animate routine is actually called.
412
413 // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ...
414 // TODO - make this a hash lookup dammit.
415 if (0 == strcmp(ev->key, "Escape"))
401 { 416 {
402 if (0 == strcmp(ev->keyname, "Escape"))
403 {
404 }
405 else if (0 == strcmp(ev->key, "Left"))
406 gld->move->r = 0.0;
407 else if (0 == strcmp(ev->key, "Right"))
408 gld->move->r = 0.0;
409 else if (0 == strcmp(ev->key, "Up"))
410 gld->move->x = 0.0;
411 else if (0 == strcmp(ev->key, "Down"))
412 gld->move->x = 0.0;
413 else if (0 == strcmp(ev->key, "Prior"))
414 gld->move->x = 0.0;
415 else if (0 == strcmp(ev->key, "Next"))
416 gld->move->x = 0.0;
417 else if (0 == strcmp(ev->key, "Home"))
418 gld->move->r = 0.0;
419 else if (0 == strcmp(ev->key, "End"))
420 gld->move->r = 0.0;
421 else if (0 == strcmp(ev->key, "space"))
422 gld->move->jump = 0.0;
423 else
424 printf("Unexpected up keystroke - %s\n", ev->key);
425 } 417 }
426 return EINA_TRUE; 418 else if (0 == strcmp(ev->key, "Left"))
419 gld->move->r = 0.0;
420 else if (0 == strcmp(ev->key, "Right"))
421 gld->move->r = 0.0;
422 else if (0 == strcmp(ev->key, "Up"))
423 gld->move->x = 0.0;
424 else if (0 == strcmp(ev->key, "Down"))
425 gld->move->x = 0.0;
426 else if (0 == strcmp(ev->key, "Prior"))
427 ;
428 else if (0 == strcmp(ev->key, "Next"))
429 ;
430 else if (0 == strcmp(ev->key, "Home"))
431 ;
432 else if (0 == strcmp(ev->key, "End"))
433 ;
434 else if (0 == strcmp(ev->key, "space"))
435 gld->move->jump = 0.0;
436 else
437 printf("Unexpected up keystroke - %s\n", ev->key);
427 } 438 }
428 else 439 else
429 printf("Camera input not ready\n"); 440 printf("Camera input not ready\n");
430 } 441 }
431
432 return EINA_FALSE; // TRUE = event was processed here, don't propagate. FALSE = propagate event, not processed here.
433} 442}
434 443
435static void _resize(GLData *gld) 444static void _resize(GLData *gld)
@@ -544,7 +553,6 @@ on_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
544 if (!gld) return; 553 if (!gld) return;
545 Evas_GL_API *gl = gld->glapi; 554 Evas_GL_API *gl = gld->glapi;
546 555
547 elm_object_event_callback_del(gld->r1, _on_camera_input, gld);
548 ecore_animator_del(gld->animator); 556 ecore_animator_del(gld->animator);
549 557
550 if (gld->useEGL) 558 if (gld->useEGL)
@@ -740,7 +748,8 @@ static void init_evas_gl(GLData *gld, int w, int h)
740 gld->animator = ecore_animator_add(doFrame, gld); // This animator will be called every frame tick, which defaults to 1/30 seconds. 748 gld->animator = ecore_animator_add(doFrame, gld); // This animator will be called every frame tick, which defaults to 1/30 seconds.
741 749
742 // In this code, we are making our own camera, so grab it's input when we are focused. 750 // In this code, we are making our own camera, so grab it's input when we are focused.
743 elm_object_event_callback_add(gld->win, _on_camera_input, gld); 751 evas_object_event_callback_add(gld->win, EVAS_CALLBACK_KEY_DOWN, _on_camera_input_down, gld);
752 evas_object_event_callback_add(gld->win, EVAS_CALLBACK_KEY_UP, _on_camera_input_up, gld);
744 evas_object_event_callback_add(gld->r1, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_GL, gld); 753 evas_object_event_callback_add(gld->r1, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_GL, gld);
745 gld->camFocus = 1; // Start with the GL camera focused. 754 gld->camFocus = 1; // Start with the GL camera focused.
746 755
@@ -1012,6 +1021,7 @@ fill(Evas_Object *win)
1012 1021
1013 evas_object_show(bx); 1022 evas_object_show(bx);
1014} 1023}
1024
1015static void 1025static void
1016cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info) 1026cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1017{ 1027{