Merge remote-tracking branch 'remotes/origin/upstream'
[framework/uifw/expedite.git] / src / bin / ui.c
1 #include "main.h"
2
3 #define PROTO
4 #include "tests.h"
5 #undef PROTO
6
7 static double start = 0.0;
8
9 static double t_start = 0.0;
10 static double t_loop = 0.0;
11 static int    f_start = 0;
12 static int    f_loop = 0;
13 static char   data_dir[4096];
14
15 typedef struct _Menu_Item Menu_Item;
16
17 struct _Menu_Item
18 {
19    Evas_Object *o_icon;
20    char *icon;
21    char *text;
22    void (*func) (void);
23 };
24
25 static Evas_Object *o_bg = NULL;
26 static Evas_Object *o_wallpaper = NULL;
27 static Evas_Object *o_title = NULL;
28 static Evas_Object *o_byline = NULL;
29 static Evas_Object *o_menu_logo = NULL;
30 static Evas_Object *o_menu_icon = NULL;
31 static Evas_Object *o_menu_icon_sel = NULL;
32 static Evas_Object *o_menu_icon_sel2 = NULL;
33 static Evas_Object *o_menu_text_sel = NULL;
34 static Evas_Object *o_menu_title = NULL;
35 static Eina_List   *menu = NULL;
36 static int          menu_sel = 0;
37 static int          menu_active = 0;
38 static double       menu_anim = 0.0;
39 static double       menu_anim_sel = 0.0;
40
41 static double       p_fps = 0.0;
42
43 static void (*key_func) (char *key) = NULL;
44 static void (*loop_func) (double t, int f) = NULL;
45
46 static int run_all = 0;
47 static int run_test = 0;
48 static int list_test = 0;
49 static int exit_after_test = 0;
50
51 static double weights[] =
52 {
53    0.0, // no test 0
54      
55      50.4851, // test 1
56      97.3703, // test 2
57      10.0000, // test 3
58      87.3703, // ...
59      10.0000, 
60    
61      150.0000, // test 6
62      10.0000,
63      150.0000,
64      10.0000,
65      150.0000,
66    
67      10.0000, // test 11
68      150.0000,
69      10.0000,
70      10.6493, 
71      38.4818,
72    
73      40.7314, // test 16
74      32.0866,
75      21.3337,
76      21.2167,
77      71.6141,
78    
79      64.8893, // test 21
80      95.0880,
81      121.0438,
82      41.2646,
83      162.7149,
84    
85      89.1650, // test 26
86      105.3571,
87      40.9657,
88      98.4671,
89      28.4322,
90    
91      60.000, // test 31
92      75.5507,
93      51.6601,
94      135.4753,
95      38.2705,
96    
97      35.9915, // test 36
98      31.9500,
99      22.6752,
100      38.2702,
101      37.4459,
102    
103      37.2009, // test 41
104      34.5459,
105      38.5043,
106      50.0000,
107      37.0282,
108    
109      55.8886, // test 46
110      17.2535,
111      23.1457,
112      36.9874,
113      37.9336,
114    
115      17.1830, // test 51
116      20.7521,
117      29.0141,
118      131.6784,
119      13.6851,
120    
121      23.4462, // test 56
122      14.7573,
123      36.5261,
124       5.0000,
125       5.0000,
126    
127      24.3482, // test 61
128      10.4611,
129      86.0290,
130      82.0735,
131      18.6459,
132    
133      37.4608, // test 66
134      32.4417,
135      11.5449,
136       5.0000,
137      11.4172,
138    
139      13.3682, // test 71
140      10.0324,
141      10.0584,
142      10.0170,
143      5.4029,
144    
145      10.6349, // test 76
146      21.7728,
147      12.7933,
148      19.4177,
149      34.4192,
150    
151      23.9110, // test 81
152      22.8287,
153      41.2399,
154      30.1383,
155      22.0342,
156    
157      38.2952, // test 86
158      5.5560,
159      0.5000,
160      1.000,
161      10.000,
162    
163      5.000, // test 91
164      20.000, // MASK
165      20.000, // MASK 2
166      20.000, // MASK 3
167      20.000, // MASK 4
168    
169      20.000, // test 96
170      20.000, // MASK 6
171      20.000, // MASK 7
172      20.000, // MASK 8
173      20.000, // MASK 9
174    
175      20.000, // test 101
176      20.000, // MASK 11
177      20.000, // MASK 12
178      20.000, // MASK 13
179      20.000, // MASK 14
180    
181      20.000, // test 106 MASK 15
182      1.000,
183      2.000,
184      1.000,
185      2.000,
186
187      1.000, // test 111
188      2.000,
189      1.000,
190      2.000,
191      1.000,
192
193      2.000,   // test 116
194      10.000,
195      10.000,
196    
197      0.0, // Exit
198    
199      0.0, // no final test - add a 0 at the end anyway to pad
200      0.0,
201      0.0,
202      0.0,
203      0.0
204 };
205
206 static void
207 _ui_exit(void)
208 {
209    Menu_Item *mi;
210
211    EINA_LIST_FREE(menu, mi)
212      {
213         free(mi->icon);
214         free(mi->text);
215         free(mi);
216      }
217    engine_abort();
218 }
219
220 extern const char *profile;
221 extern int win_w, win_h;
222 extern const char *engine;
223 extern int loops;
224 extern int fullscreen;
225
226 static void
227 _ui_all(void)
228 {
229    Eina_List *l;
230    double fps = 0.0;
231    double wfps = 0.0;
232    int t_count = 0;
233    unsigned int i;
234    double avgw = 0.0;
235
236    evas_object_hide(o_menu_logo);
237    evas_object_hide(o_menu_title);
238    evas_object_hide(o_menu_icon);
239    evas_object_hide(o_menu_icon_sel);
240    evas_object_hide(o_menu_icon_sel2);
241    evas_object_hide(o_menu_text_sel);
242    evas_object_hide(o_title);
243    evas_object_hide(o_byline);
244    for (l = menu; l; l = l->next)
245      {
246         Menu_Item *mi;
247
248         mi = l->data;
249         if ((mi->func == about_start) ||
250             (mi->func == _ui_exit) ||
251             (mi->func == _ui_all))
252           continue;
253         if (mi->func) mi->func();
254         evas_object_hide(o_title);
255         evas_object_hide(o_byline);
256         while (p_fps == 0.0)
257           {
258              engine_loop();
259              ui_loop();
260              evas_render(evas);
261           }
262         /* This give time to delete the objects of the previous test and make
263            the result of next test more accurate. Draw back, some time is not
264            counted at all. */
265         evas_render(evas);
266         t_count++;
267         fps += p_fps;
268         wfps += (p_fps * weights[t_count]);
269         key_func("Escape");
270      }
271    for (i = 1; 
272         (i < (1 + t_count)) &&
273         (weights[i] > 0.0);
274         i++)
275      avgw += weights[i];
276    avgw /= (i - 1);
277    if (t_count > 0)
278      {
279         char datestr[1024];
280         struct tm *tim;
281         time_t now;
282         
283         now = time(NULL);
284         tim = localtime(&now);
285         if (tim) strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", tim);
286         else snprintf(datestr, sizeof(datestr), "unknown");
287 //        printf("%5.2f , EVAS SPEED\n", fps / t_count);
288         printf("%5.2f , EVAS SPEED (WEIGHTED), "
289                "tn, %i , "
290                "t, %s , "
291                "ev , %i.%i.%i.%i , "
292                "p , %s , "
293                "sz , %i , %i , "
294                "c , %i , "
295                "e , %s , "
296                "fs , %i\n"
297                ,
298                wfps / (t_count * avgw),
299 //               fps / t_count,
300                t_count,
301                datestr,
302                evas_version->major, evas_version->minor, evas_version->micro, evas_version->revision,
303                profile,
304                win_w, win_h,
305                loops,
306                engine,
307                fullscreen
308               );
309      }
310 }
311
312
313 static void
314 _ui_num(int n)
315 {
316    double fps = 0.0;
317    double wfps = 0.0;
318    int t_count = 0;
319    Menu_Item *mi;
320    unsigned int i;
321    double avgw = 0.0;
322
323    evas_object_hide(o_menu_logo);
324    evas_object_hide(o_menu_title);
325    evas_object_hide(o_menu_icon);
326    evas_object_hide(o_menu_icon_sel);
327    evas_object_hide(o_menu_icon_sel2);
328    evas_object_hide(o_menu_text_sel);
329    evas_object_hide(o_title);
330    evas_object_hide(o_byline);
331    mi = eina_list_nth(menu, n);
332    if (mi)
333      {
334         if ((mi->func == about_start) ||
335             (mi->func == _ui_exit) ||
336             (mi->func == _ui_all))
337           goto done;
338         if (mi->func) mi->func();
339         evas_object_hide(o_title);
340         evas_object_hide(o_byline);
341         while (p_fps == 0.0)
342           {
343              ui_loop();
344              engine_loop();
345              evas_render(evas);
346           }
347         /* This give time to delete the objects of the previous test and make
348            the result of next test more accurate. Draw back, some time is not
349            counted at all. */
350         evas_render(evas);
351         t_count++;
352         fps += p_fps;
353         wfps += (p_fps * weights[n]);
354         key_func("Escape");
355      }
356    done:
357    for (i = 1; i < ((sizeof(weights) / sizeof(double)) - 1); i++)
358      avgw += weights[i];
359    avgw /= (i - 1);   
360    if (t_count > 0)
361      {
362 //        printf("%5.2f , EVAS SPEED\n", fps / t_count);
363         printf("%5.2f , EVAS SPEED (WEIGHTED)\n", wfps / (t_count * avgw));
364      }
365 }
366
367 static void
368 _ui_select(void)
369 {
370    Eina_List *l;
371    int i;
372    void (*func) (void) = NULL;
373
374    evas_object_hide(o_menu_logo);
375    evas_object_hide(o_menu_title);
376    evas_object_hide(o_menu_icon);
377    evas_object_hide(o_menu_icon_sel);
378    evas_object_hide(o_menu_icon_sel2);
379    evas_object_hide(o_menu_text_sel);
380    evas_object_hide(o_title);
381    evas_object_hide(o_byline);
382    for (i = 0, l = menu; l; l = l->next, i++)
383      {
384         Menu_Item *mi;
385
386         mi = l->data;
387         evas_object_hide(mi->o_icon);
388         if (i == menu_sel)
389           func = mi->func;
390      }
391    menu_active = 0;
392    if (func) func();
393    evas_object_hide(o_title);
394    evas_object_hide(o_byline);
395 }
396
397 static void
398 _ui_key(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
399 {
400    Evas_Event_Key_Down *ev;
401
402    ev = event_info;
403    if (key_func)
404      {
405         key_func(ev->keyname);
406         return;
407      }
408    if ((!strcmp(ev->keyname, "Escape")) ||
409        (!strcmp(ev->keyname, "q")) ||
410        (!strcmp(ev->keyname, "Q")))
411      {
412         _ui_exit();
413      }
414    if (menu_active)
415      {
416         if (!strcmp(ev->keyname, "Left")) menu_sel++;
417         if (!strcmp(ev->keyname, "Right")) menu_sel--;
418         if (menu_sel < 0) menu_sel = 0;
419         else if ((unsigned int)menu_sel >= eina_list_count(menu)) menu_sel = eina_list_count(menu) - 1;
420         menu_anim_sel = menu_sel;
421         if (!strcmp(ev->keyname, "Return")) _ui_select();
422      }
423 }
424
425 static Evas_Coord down_x, down_y;
426 static int down_menu_sel = 0;
427
428 static void
429 _ui_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
430 {
431    Evas_Event_Mouse_Down *ev;
432
433    ev = event_info;
434    if (ev->button != 1) return;
435    if (menu_active)
436      {
437         down_x = ev->canvas.x;
438         down_y = ev->canvas.y;
439         down_menu_sel = menu_sel;
440      }
441 }
442
443 static void
444 _ui_mouse_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
445 {
446    Evas_Event_Mouse_Up *ev;
447
448    ev = event_info;
449    if (ev->button != 1) return;
450    if (menu_active)
451      {
452         Evas_Coord dx, dy;
453
454         dx = ev->canvas.x - down_x;
455         dy = ev->canvas.y - down_y;
456         if ((((dx * dx) + (dy * dy)) < (20 * 20)) &&
457             (menu_sel == down_menu_sel))
458           _ui_select();
459      }
460    else
461      {
462         evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
463         evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
464      }
465 }
466
467 static void
468 _ui_mouse_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
469 {
470    Evas_Event_Mouse_Move *ev;
471
472    ev = event_info;
473    if (ev->buttons != 1) return;
474    if (menu_active)
475      {
476         menu_sel = down_menu_sel + ((ev->cur.canvas.x - down_x) / 25);
477         /* scroll */
478         if (menu_sel < 0) menu_sel = 0;
479         else if ((unsigned int)menu_sel >= eina_list_count(menu))
480           menu_sel = eina_list_count(menu) - 1;
481         menu_anim_sel = menu_sel;
482      }
483 }
484
485 static void
486 _ui_menu_item_add(char *icon, char *text, void (*func) (void))
487 {
488    Menu_Item *mi;
489
490    mi = malloc(sizeof(Menu_Item));
491    mi->o_icon = evas_object_image_add(evas);
492    evas_object_image_file_set(mi->o_icon, build_path(icon), NULL);
493    evas_object_resize(mi->o_icon, 32, 32);
494    evas_object_image_fill_set(mi->o_icon, 0, 0, 32, 32);
495    mi->icon = strdup(icon);
496    mi->text = strdup(text);
497    mi->func = func;
498    menu = eina_list_append(menu, mi);
499    evas_object_raise(o_menu_icon_sel2);
500 }
501
502 static void
503 _ui_setup(void)
504 {
505    Evas_Object *o;
506    Evas_Coord x, y, w, h;
507    time_t t0, t;
508
509    o = evas_object_rectangle_add(evas);
510    evas_object_move(o, 0, 0);
511    evas_object_resize(o, win_w, win_h);
512    evas_object_color_set(o, 0, 0, 0, 0);
513    evas_object_layer_set(o, 1000);
514    evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _ui_key, NULL);
515    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _ui_mouse_down, NULL);
516    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _ui_mouse_up, NULL);
517    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _ui_mouse_move, NULL);
518    evas_object_focus_set(o, 1);
519    evas_object_show(o);
520    o_bg = o;
521
522    o = evas_object_rectangle_add(evas);
523    evas_object_move(o, 0, 0);
524    evas_object_resize(o, win_w, win_h);
525    evas_object_color_set(o, 255, 255, 255, 255);
526    evas_object_layer_set(o, -99);
527    evas_object_show(o);
528    o_wallpaper = o;
529
530    o = evas_object_text_add(evas);
531    evas_object_text_font_set(o, "Vera-Bold", 10);
532    evas_object_text_text_set(o, "EXPEDITE");
533    evas_object_layer_set(o, 100);
534    evas_object_color_set(o, 0, 0, 0, 100);
535    evas_object_pass_events_set(o, 1);
536    evas_object_geometry_get(o, NULL, NULL, &w, &h);
537    x = (win_w - w) / 2;
538    y = 0;
539    evas_object_move(o, x, y);
540    evas_object_show(o);
541    o_title = o;
542
543    o = evas_object_text_add(evas);
544    evas_object_text_font_set(o, "Vera", 9);
545    evas_object_text_text_set(o, "LEFT/RIGHT - select, ENTER - select, ESCAPE - exit.");
546    evas_object_layer_set(o, 100);
547    evas_object_color_set(o, 0, 0, 0, 60);
548    evas_object_pass_events_set(o, 1);
549    evas_object_geometry_get(o, NULL, NULL, &w, NULL);
550    x = (win_w - w) / 2;
551    y = h + 2;
552    evas_object_move(o, x, y);
553    evas_object_show(o);
554    o_byline = o;
555
556    o = evas_object_image_add(evas);
557    evas_object_move(o, (win_w - 120) / 2, ((win_h - 160) / 2));
558    evas_object_image_file_set(o, build_path("e-logo.png"), NULL);
559    evas_object_image_fill_set(o, 0, 0, 120, 160);
560    evas_object_resize(o, 120, 160);
561    evas_object_layer_set(o, -98);
562    evas_object_color_set(o, 255, 255, 255, 255);
563    evas_object_show(o);
564    o_menu_logo = o;
565
566    o = evas_object_image_add(evas);
567    evas_object_move(o, win_w - 128, - 128);
568    evas_object_image_fill_set(o, 0, 0, 256, 256);
569    evas_object_resize(o, 256, 256);
570    evas_object_show(o);
571    o_menu_icon = o;
572
573    o = evas_object_image_add(evas);
574    evas_object_move(o, 0, 0);
575    evas_object_image_file_set(o, build_path("icon_sel.png"), NULL);
576    evas_object_resize(o, 48, 48);
577    evas_object_image_fill_set(o, 0, 0, 48, 48);
578    o_menu_icon_sel = o;
579
580    o = evas_object_image_add(evas);
581    evas_object_move(o, 0, 0);
582    evas_object_image_file_set(o, build_path("text_sel.png"), NULL);
583    evas_object_resize(o, 96, 32);
584    evas_object_image_fill_set(o, 0, 0, 96, 32);
585    evas_object_image_border_set(o, 7, 7, 7, 7);
586    o_menu_text_sel = o;
587
588    o = evas_object_text_add(evas);
589    evas_object_text_font_set(o, "Vera", 10);
590    evas_object_text_text_set(o, "");
591    evas_object_color_set(o, 0, 0, 0, 100);
592    evas_object_pass_events_set(o, 1);
593    evas_object_geometry_get(o, NULL, NULL, &w, &h);
594    x = (win_w - w) / 2;
595    y = (win_h - h) / 2;
596    evas_object_move(o, x, y);
597    o_menu_title = o;
598
599    _ui_menu_item_add("e.png", "About", about_start);
600    _ui_menu_item_add("e.png", "All Tests", _ui_all);
601 #define UI
602 #include "tests.h"
603 #undef UI
604    _ui_menu_item_add("exit.png", "Exit", _ui_exit);
605
606 #ifdef HAVE_SYNC
607    /* make sure disk io isn't going to turn up unexpectedly */
608    sync();
609    sync();
610    sync();
611 #endif
612    /* warm up the cpu with some spinning */
613    if (run_all)
614      {
615         t0 = time(NULL);
616         for (;;)
617           {
618              t = time(NULL);
619              if (t - t0 > 2) break;
620           }
621      }
622
623    if (run_all)
624      {
625         _ui_all();
626      }
627    else if (run_test > 0)
628      {
629         _ui_num(run_test);
630      }
631    else if (list_test > 0)
632      {
633         Eina_List *l;
634         int i;
635
636         for (l = menu, i = -1; l; l = l->next, i++)
637           {
638              Menu_Item *mi;
639
640              mi = l->data;
641              if (i > 0)
642                printf("%3i - %s (Weight %0.2lf)\n", i, mi->text, weights[i]);
643           }
644      }
645    else
646      {
647         menu_active = 1;
648      }
649
650    if (exit_after_test)
651     _ui_exit();
652
653 }
654
655 void
656 ui_args(int argc, char **argv)
657 {
658    int i;
659
660    for (i = 1; i < argc; i++)
661      {
662         if (!strcmp(argv[i], "-a"))
663           {
664              run_all = 1;
665              exit_after_test = 1;
666           }
667         else if ((!strcmp(argv[i], "-t")) && (i < (argc - 1)))
668           {
669              run_test = atoi(argv[i + 1]) + 1;
670              exit_after_test = 1;
671              if (run_test < 2) run_test = 2;
672           }
673         else if (!strcmp(argv[i], "-l"))
674           {
675              list_test = 1;
676           }
677      }
678    _ui_setup();
679    start = get_time();
680 }
681
682 void
683 ui_loop(void)
684 {
685    static int first = 1;
686    static double pt = 0.0;
687    double t, t2;
688
689    evas_object_resize(o_bg, win_w, win_h);
690    evas_object_resize(o_wallpaper, win_w, win_h);
691    if (loop_func)
692      {
693         t = get_time();
694         f_loop++;
695         f_start++;
696         if ((t - t_loop) >= 1.0)
697           {
698 //           ui_fps((double)f_loop / (t - t_loop));
699              t_loop = t;
700              f_loop = 0;
701           }
702         loop_func(t - t_start, f_start);
703         return;
704      }
705    t2 = get_time();
706    if (first)
707      {
708         t = 0.1;
709         pt = t2;
710      }
711    else
712      {
713         t = t2 - pt;
714         pt = t2;
715      }
716    first = 0;
717
718    /* menu layout */
719    if (menu_active)
720      {
721         Eina_List *l;
722         int i;
723         static double tr = 0.0;
724         double tt;
725
726         tt = t;
727         tt += tr;
728         while (tt > 0.001)
729           {
730              menu_anim = (menu_anim * 0.995) + (menu_anim_sel * 0.005);
731              tt -= 0.001;
732           }
733         tr = tt;
734         for (i = 0, l = menu; l; l = l->next, i++)
735           {
736              char buf[4096];
737              Menu_Item *mi;
738              Evas_Coord x, y, w, h, tw, th;
739              Evas_Coord len;
740              double a;
741              Evas_Object *o;
742
743              mi = l->data;
744              o = mi->o_icon;
745              evas_object_geometry_get(o_menu_logo, NULL, NULL, &w, &h);
746              len = ((w * 3) + 10) / 4;
747              evas_object_geometry_get(o, NULL, NULL, &w, &h);
748              x = (win_w / 2)
749                + (sin((menu_anim - (double)i) * 0.33) * len)
750                  - (w / 2);
751              y = (win_h / 2)
752                + (cos((menu_anim - (double)i) * 0.33) * len)
753                  - (h / 2);
754              evas_object_move(o, x, y);
755              a = menu_anim - (double)i;
756              if (a < 0) a = -a;
757              a = 255 - (30 * a);
758              evas_object_color_set(o, a, a, a, a);
759              evas_object_show(o);
760
761              if (i == menu_sel)
762                {
763                   a = menu_anim - (double)i;
764                   if (a < 0) a = -a;
765                   a = 255 - (255 * a);
766
767                   o = o_menu_icon_sel;
768                   evas_object_move(o, x - ((48 - w) / 2), y - ((48 - h) / 2));
769                   evas_object_color_set(o, a, a, a, a);
770
771                   o = o_menu_title;
772                   evas_object_color_set(o, a, a, a, a);
773                   evas_object_text_text_set(o, mi->text);
774                   evas_object_geometry_get(o, NULL, NULL, &tw, &th);
775                   x = (win_w - tw) / 2;
776                   y = (win_h / 2) + len + 48;
777                   evas_object_move(o, x, y);
778
779                                  
780                   o = o_menu_text_sel;
781                   w = tw + 24;
782                   h = 28;
783                   x = x - 12;
784                   y = y + ((th - h) / 2);
785                   evas_object_move(o, x, y);
786                   evas_object_resize(o, w, h);
787                   evas_object_image_fill_set(o, 0, 0, w, h);
788                   evas_object_color_set(o, a, a, a, a);
789
790                   o = o_menu_icon;
791                   snprintf(buf, 4096, "%s%s", data_dir, mi->icon);
792                   evas_object_image_file_set(o, buf, NULL);
793                   evas_object_color_set(o, a / 2, a / 2, a / 2, a / 2);
794                }
795           }
796         evas_object_move(o_menu_logo, (win_w - 120) / 2, ((win_h - 160) / 2));
797         evas_object_show(o_menu_logo);
798         evas_object_show(o_menu_title);
799         evas_object_show(o_menu_icon);
800         evas_object_show(o_menu_icon_sel);
801         evas_object_show(o_menu_icon_sel2);
802         evas_object_show(o_menu_text_sel);
803      }
804    else
805      {
806      }
807 }
808
809 void
810 ui_menu(void)
811 {
812    evas_object_show(o_title);
813    evas_object_show(o_byline);
814    evas_object_text_text_set
815      (o_byline, "LEFT/RIGHT - select, ENTER - select, ESCAPE - exit.");
816    menu_active = 1;
817    key_func = NULL;
818    loop_func = NULL;
819 }
820
821 void
822 ui_func_set(void (*kfunc) (char *key), void (*lfunc) (double t, int f))
823 {
824    key_func = kfunc;
825    loop_func = lfunc;
826    t_loop = t_start = get_time();
827    f_loop = f_start = 0;
828    ui_fps(0.0);
829 }
830
831
832 void
833 ui_fps(double fps)
834 {
835    /*
836    char buf[256];
837
838    snprintf(buf, sizeof(buf), "ESCAPE - exit, FPS: %4.3f", fps);
839    evas_object_text_text_set(o_byline, buf);
840     */
841    p_fps = fps;
842 }