Update to latest upstream code
[platform/upstream/expedite.git] / src / bin / text_styles_different_strings.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME text_styles_different_strings_start
7 #define NAME "Text Styles Different Strings"
8 #define ICON "text.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 /* standard var */
15 static int done = 0;
16
17 /* private data */
18 static Evas_Object *o_texts[OBNUM];
19
20 /* setup */
21 static void _setup(void)
22 {
23    int i;
24    Evas_Object *o;
25    Evas_Text_Style_Type st;
26    char buf[1024];
27    const char *strs[] = {
28       "Big", "Smelly", "Fish", "Pants", "Octopus", "Garden", "There", "I",
29         "Am", "You", "Are", "Erogenous", "We", "Stick", "Wet", "Fishy",
30         "Fiddly", "Family", "Lair", "Monkeys", "Magazine"
31    };
32
33    srnd();
34    st = EVAS_TEXT_STYLE_SHADOW;
35    for (i = 0; i < OBNUM; i++)
36      {
37         o = evas_object_text_add(evas);
38         o_texts[i] = o;
39         efl_text_font_family_set(o, "Vera-Bold");
40         efl_text_font_size_set(o, 20);
41         snprintf(buf, sizeof(buf), "%s %s %s %s.",
42                  strs[rnd() % (sizeof(strs) / sizeof(char *))],
43                  strs[rnd() % (sizeof(strs) / sizeof(char *))],
44                  strs[rnd() % (sizeof(strs) / sizeof(char *))],
45                  strs[rnd() % (sizeof(strs) / sizeof(char *))]);
46         efl_text_set(o, buf);
47         evas_object_text_style_set(o, st);
48         efl_gfx_color_set(o, 255, 255, 255, 255);
49         evas_object_text_shadow_color_set(o, 0, 0, 0, 24);
50         evas_object_text_glow_color_set(o, 100, 80, 40, 100);
51         evas_object_text_glow2_color_set(o, 50, 10, 5, 50);
52         evas_object_text_outline_color_set(o, 0, 0, 0, 255);
53         efl_gfx_entity_visible_set(o, EINA_TRUE);
54         st++;
55         if (st > EVAS_TEXT_STYLE_FAR_SOFT_SHADOW) st = EVAS_TEXT_STYLE_SHADOW;
56      }
57    done = 0;
58 }
59
60 /* cleanup */
61 static void _cleanup(void)
62 {
63    int i;
64    for (i = 0; i < OBNUM; i++) efl_del(o_texts[i]);
65 }
66
67 /* loop - do things */
68 static void _loop(double t, int f)
69 {
70    int i;
71    Evas_Coord x, y, w, h;
72    for (i = 0; i < OBNUM; i++)
73      {
74         exp_size_get(o_texts[i], &w, &h);
75         x = (win_w / 2) - (w / 2);
76         x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
77         y = (win_h / 2) - (h / 2);
78         y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (w / 2);
79         efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y));
80      }
81    FPS_STD(NAME);
82 }
83
84 /* prepend special key handlers if interactive (before STD) */
85 static void _key(const char *key)
86 {
87    KEY_STD;
88 }
89
90
91
92
93
94
95
96
97
98
99
100
101 /* template stuff - ignore */
102 # endif
103 #endif
104
105 #ifdef UI
106 _ui_menu_item_add(ICON, NAME, FNAME);
107 #endif
108
109 #ifdef PROTO
110 void FNAME(void);
111 #endif
112
113 #ifndef PROTO
114 # ifndef UI
115 void FNAME(void)
116 {
117    ui_func_set(_key, _loop);
118    _setup();
119 }
120 # endif
121 #endif
122 #undef FNAME
123 #undef NAME
124 #undef ICON