diff options
-rw-r--r-- | src/extantz/extantz.c | 147 |
1 files changed, 131 insertions, 16 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 49e2ebe..19432c6 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -525,6 +525,108 @@ void overlay_add(globals *ourGlobals) | |||
525 | } | 525 | } |
526 | 526 | ||
527 | 527 | ||
528 | // Use jobs to split the init load. So that the window pops up quickly, with it's background clouds. | ||
529 | // Then the rest appears a bit at a time. | ||
530 | static Eina_Bool _makePhysics(void *data) | ||
531 | { | ||
532 | globals *ourGlobals = data; | ||
533 | |||
534 | if (ephysics_init()) | ||
535 | ourGlobals->world = ephysicsAdd(ourGlobals); | ||
536 | |||
537 | return ECORE_CALLBACK_CANCEL; | ||
538 | } | ||
539 | |||
540 | static Eina_Bool _makeFiles(void *data) | ||
541 | { | ||
542 | globals *ourGlobals = data; | ||
543 | |||
544 | ecore_job_add(_makePhysics, ourGlobals); | ||
545 | // ecore_timer_add(0.1, _makePhysics, ourGlobals); | ||
546 | |||
547 | // ourGlobals->files = filesAdd(ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); | ||
548 | |||
549 | return ECORE_CALLBACK_CANCEL; | ||
550 | } | ||
551 | |||
552 | static Eina_Bool _makeLove(void *data) | ||
553 | { | ||
554 | globals *ourGlobals = data; | ||
555 | |||
556 | ecore_job_add(_makeFiles, ourGlobals); | ||
557 | // ecore_timer_add(0.1, _makeFiles, ourGlobals); | ||
558 | |||
559 | PD("About to try connecting to a love server."); | ||
560 | reachOut("love", "./love", "127.0.0.1", 8211 + 1, ourGlobals, (Ecore_Event_Handler_Cb) _add, /*(Ecore_Event_Handler_Cb) _data*/ NULL, (Ecore_Event_Handler_Cb) _del, clientParser); | ||
561 | |||
562 | return ECORE_CALLBACK_CANCEL; | ||
563 | } | ||
564 | |||
565 | static Eina_Bool _makeMess(void *data) | ||
566 | { | ||
567 | globals *ourGlobals = data; | ||
568 | |||
569 | ecore_job_add(_makeLove, ourGlobals); | ||
570 | // ecore_timer_add(0.1, _makeLove, ourGlobals); | ||
571 | |||
572 | ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); | ||
573 | |||
574 | return ECORE_CALLBACK_CANCEL; | ||
575 | } | ||
576 | |||
577 | static Eina_Bool _makeScenery(void *data) | ||
578 | { | ||
579 | #if USE_EVAS_3D | ||
580 | globals *ourGlobals = data; | ||
581 | |||
582 | ecore_job_add(_makeMess, ourGlobals); | ||
583 | // ecore_timer_add(0.1, _makeMess, ourGlobals); | ||
584 | |||
585 | // Setup our Evas_3D stuff. | ||
586 | ourGlobals->scene = scenriAdd(ourGlobals->win); | ||
587 | // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move. | ||
588 | // ourGlobals->gld->move = ourGlobals->scene->move; | ||
589 | evas_object_data_set(elm_image_object_get(ourGlobals->scene->image), "glob", ourGlobals); | ||
590 | evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals->scene->image), on_pixels, ourGlobals); | ||
591 | ourGlobals->scene->clickCb = _onWorldClick; | ||
592 | #endif | ||
593 | |||
594 | return ECORE_CALLBACK_CANCEL; | ||
595 | } | ||
596 | |||
597 | static Eina_Bool _makeMenus(void *data) | ||
598 | { | ||
599 | globals *ourGlobals = data; | ||
600 | |||
601 | // ecore_job_add(_makeScenery, ourGlobals); | ||
602 | ecore_timer_add(0.5, _makeScenery, ourGlobals); | ||
603 | |||
604 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | ||
605 | // This sucks, gotta redefine this menu each time we create a new window? | ||
606 | _makeMainMenu(ourGlobals); | ||
607 | |||
608 | return ECORE_CALLBACK_CANCEL; | ||
609 | } | ||
610 | |||
611 | static Eina_Bool _makePurkle(void *data) | ||
612 | { | ||
613 | globals *ourGlobals = data; | ||
614 | |||
615 | // ecore_job_add(_makeMenus, ourGlobals); | ||
616 | ecore_timer_add(1.0, _makeMenus, ourGlobals); | ||
617 | |||
618 | woMan_add(ourGlobals); | ||
619 | ourGlobals->purkle = GuiLuaLoad("purkle", ourGlobals->mainWindow, ourGlobals->world); | ||
620 | // ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); | ||
621 | // ourGlobals->files = filesAdd(ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); | ||
622 | |||
623 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | ||
624 | // This sucks, gotta redefine this menu each time we create a new window? | ||
625 | // _makeMainMenu(ourGlobals); | ||
626 | |||
627 | return ECORE_CALLBACK_CANCEL; | ||
628 | } | ||
629 | |||
528 | EAPI_MAIN int elm_main(int argc, char **argv) | 630 | EAPI_MAIN int elm_main(int argc, char **argv) |
529 | { | 631 | { |
530 | GLData *gld = NULL; | 632 | GLData *gld = NULL; |
@@ -554,8 +656,9 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
554 | elm_config_finger_size_set(0); | 656 | elm_config_finger_size_set(0); |
555 | elm_config_scale_set(1.0); | 657 | elm_config_scale_set(1.0); |
556 | 658 | ||
557 | if (!ephysics_init()) | 659 | // JOB? |
558 | return 1; | 660 | // if (!ephysics_init()) |
661 | // return 1; | ||
559 | 662 | ||
560 | gld = &ourGlobals.gld; | 663 | gld = &ourGlobals.gld; |
561 | gldata_init(gld); | 664 | gldata_init(gld); |
@@ -636,34 +739,46 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
636 | 739 | ||
637 | init_evas_gl(&ourGlobals); | 740 | init_evas_gl(&ourGlobals); |
638 | 741 | ||
742 | // JOB? | ||
639 | #if USE_EVAS_3D | 743 | #if USE_EVAS_3D |
640 | // Setup our Evas_3D stuff. | 744 | // Setup our Evas_3D stuff. |
641 | ourGlobals.scene = scenriAdd(ourGlobals.win); | 745 | // ourGlobals.scene = scenriAdd(ourGlobals.win); |
642 | // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move. | 746 | // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move. |
643 | ourGlobals.gld.move = ourGlobals.scene->move; | 747 | // ourGlobals.gld.move = ourGlobals.scene->move; |
644 | evas_object_data_set(elm_image_object_get(ourGlobals.scene->image), "glob", &ourGlobals); | 748 | // evas_object_data_set(elm_image_object_get(ourGlobals.scene->image), "glob", &ourGlobals); |
645 | evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals.scene->image), on_pixels, &ourGlobals); | 749 | // evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals.scene->image), on_pixels, &ourGlobals); |
646 | ourGlobals.scene->clickCb = _onWorldClick; | 750 | // ourGlobals.scene->clickCb = _onWorldClick; |
647 | #endif | 751 | #endif |
648 | 752 | ||
649 | ourGlobals.world = ephysicsAdd(&ourGlobals); | 753 | // JOB? |
754 | // JOB? | ||
755 | // if (!ephysics_init()) | ||
756 | // return 1; | ||
757 | // ourGlobals.world = ephysicsAdd(&ourGlobals); | ||
650 | 758 | ||
651 | // overlay_add(&ourGlobals); | 759 | // overlay_add(&ourGlobals); |
652 | // GuiLuaLoad("test", ourGlobals.mainWindow, ourGlobals.world); | 760 | // GuiLuaLoad("test", ourGlobals.mainWindow, ourGlobals.world); |
653 | woMan_add(&ourGlobals); | 761 | |
654 | ourGlobals.purkle = GuiLuaLoad("purkle", ourGlobals.mainWindow, ourGlobals.world); | 762 | // JOB? |
655 | ourGlobals.LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals.mainWindow, ourGlobals.world); | 763 | // woMan_add(&ourGlobals); |
656 | ourGlobals.files = filesAdd(&ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); | 764 | // ourGlobals.purkle = GuiLuaLoad("purkle", ourGlobals.mainWindow, ourGlobals.world); |
765 | // ourGlobals.LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals.mainWindow, ourGlobals.world); | ||
766 | // ourGlobals.files = filesAdd(&ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); | ||
657 | 767 | ||
658 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | 768 | // Gotta do this after adding the windows, otherwise the menu renders under the window. |
659 | // This sucks, gotta redefine this menu each time we create a new window? | 769 | // This sucks, gotta redefine this menu each time we create a new window? |
660 | _makeMainMenu(&ourGlobals); | 770 | // _makeMainMenu(&ourGlobals); |
661 | 771 | ||
662 | // Try to connect to a local love server. | 772 | // JOB? |
663 | serverStream = eina_strbuf_new(); | 773 | // PD("About to try connecting to a love server."); |
664 | reachOut("127.0.0.1", 8211 + 1, &ourGlobals, (Ecore_Event_Handler_Cb) _add, (Ecore_Event_Handler_Cb) _data, (Ecore_Event_Handler_Cb) _del); | 774 | // reachOut("love", "./love", "127.0.0.1", 8211 + 1, &ourGlobals, (Ecore_Event_Handler_Cb) _add, /*(Ecore_Event_Handler_Cb) _data*/ NULL, (Ecore_Event_Handler_Cb) _del, clientParser); |
665 | 775 | ||
666 | _on_resize(&ourGlobals, NULL, NULL, NULL); | 776 | _on_resize(&ourGlobals, NULL, NULL, NULL); |
777 | // evas_object_show(ourGlobals.win); | ||
778 | |||
779 | // TODO - It's still very random if we got clouds straight away or not. B-( | ||
780 | // ecore_job_add(_makePurkle, &ourGlobals); | ||
781 | ecore_timer_add(0.5, _makePurkle, &ourGlobals); | ||
667 | 782 | ||
668 | elm_run(); | 783 | elm_run(); |
669 | ourGlobals.running = 0; | 784 | ourGlobals.running = 0; |