summaryrefslogtreecommitdiff
path: root/tests/proxy_text_fixed.lua
blob: 08e9d5105699b375d11f5e26d3428b401b083cad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
local ffi = require("ffi")
local ffi_new = ffi.new
local util = require("util")
local levas = util.get_lib("evas")

local sin, cos = util.sin, util.cos

return function(ui)
    return "text.png", "Proxy Text Fixed", 10.000, function()
        local itern        = 128
        local slow         = 5
        local o_texts      = {}
        local win_w, win_h = ui.win_w, ui.win_h
        local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
        ui.func_set(util.del_objs(o_texts), function(t, f)
            for i = 1, itern do
                local o = o_texts[i]
                levas.evas_object_geometry_get(o, nil, nil, w, h)
                local x = (win_w / 2) - (w[0] / 2)
                    + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (w[0] / 2)
                local y = (win_h / 2) - (h[0] / 2)
                    + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (w[0] / 2)
                levas.evas_object_move(o, x, y)
            end
        end)
        local evas = ui.evas
        local st = levas.EVAS_TEXT_STYLE_SHADOW
        local i = 0
        while i <= levas.EVAS_TEXT_STYLE_FAR_SOFT_SHADOW do
            local o = levas.evas_object_text_add(evas)
            o_texts[i + 1] = o
            levas.evas_object_text_font_set(o, "Vera-Bold", 20)
            levas.evas_object_text_text_set(o, "This is a test string")
            levas.evas_object_text_style_set(o, st)
            levas.evas_object_color_set(o, 255, 255, 255, 255)
            levas.evas_object_text_shadow_color_set(o, 0, 0, 0, 24)
            levas.evas_object_text_glow_color_set(o, 100, 80, 40, 100)
            levas.evas_object_text_glow2_color_set(o, 50, 10, 5, 50)
            levas.evas_object_text_outline_color_set(o, 0, 0, 0, 255)
            levas.evas_object_show(o)
            st = st + 1
            i = i + 1
        end
        st = i
        while i < itern do
            local s = o_texts[(i % st) + 1]
            local o = levas.evas_object_image_add(evas)
            o_texts[i + 1] = o
            levas.evas_object_image_source_set(o, s)
            levas.evas_object_geometry_get(s, nil, nil, w, h)
            levas.evas_object_resize(o, w[0], h[0])
            levas.evas_object_image_fill_set(o, 0, 0, w[0], h[0])
            levas.evas_object_show(o)
            i = i + 1
        end
    end
end