@gamely/gly-engine-lite 0.0.21 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.lua +107 -101
- package/package.json +1 -1
package/dist/main.lua
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
local math = ((function() local x, y = pcall(require, 'math'); return x and y end)()) or _G.math
|
|
2
|
-
local
|
|
3
|
-
local
|
|
4
|
-
local
|
|
5
|
-
local
|
|
6
|
-
local
|
|
7
|
-
local
|
|
8
|
-
local
|
|
9
|
-
local
|
|
10
|
-
local
|
|
11
|
-
local
|
|
12
|
-
local
|
|
13
|
-
local
|
|
14
|
-
local
|
|
15
|
-
local
|
|
16
|
-
local
|
|
17
|
-
local
|
|
18
|
-
local
|
|
19
|
-
local
|
|
20
|
-
local
|
|
21
|
-
local
|
|
22
|
-
local
|
|
23
|
-
local
|
|
24
|
-
local
|
|
25
|
-
local
|
|
26
|
-
local
|
|
27
|
-
local
|
|
28
|
-
local
|
|
29
|
-
local
|
|
30
|
-
local
|
|
31
|
-
local
|
|
32
|
-
local
|
|
33
|
-
local
|
|
34
|
-
local
|
|
35
|
-
local
|
|
36
|
-
local
|
|
37
|
-
local
|
|
38
|
-
local
|
|
39
|
-
local
|
|
40
|
-
local
|
|
41
|
-
local
|
|
42
|
-
local
|
|
43
|
-
local
|
|
44
|
-
local
|
|
45
|
-
local
|
|
2
|
+
local source_version_55e9adc93630 = nil
|
|
3
|
+
local source_shared_module_55e9adcfcee0 = nil
|
|
4
|
+
local source_engine_api_data_encoder_55e9adcde7b0 = nil
|
|
5
|
+
local source_engine_api_system_app_55e9add022a0 = nil
|
|
6
|
+
local source_engine_api_data_hash_55e9adcec2d0 = nil
|
|
7
|
+
local source_engine_api_io_http_55e9add09cc0 = nil
|
|
8
|
+
local source_engine_api_data_i18n_55e9adcfb4b0 = nil
|
|
9
|
+
local source_engine_api_system_key_55e9adcdd690 = nil
|
|
10
|
+
local source_engine_api_debug_log_55e9adc93400 = nil
|
|
11
|
+
local source_engine_api_system_math_55e9add12fd0 = nil
|
|
12
|
+
local source_engine_api_data_array_55e9add03280 = nil
|
|
13
|
+
local source_engine_api_io_media_55e9add024e0 = nil
|
|
14
|
+
local source_engine_api_draw_fps_55e9add01370 = nil
|
|
15
|
+
local source_engine_api_draw_text_55e9adcfd720 = nil
|
|
16
|
+
local source_engine_api_draw_poly_55e9add12880 = nil
|
|
17
|
+
local source_engine_api_raw_memory_55e9add0b7e0 = nil
|
|
18
|
+
local source_engine_protocol_http_callback_55e9adcfea60 = nil
|
|
19
|
+
local source_shared_var_object_root_55e9add070f0 = nil
|
|
20
|
+
local source_engine_api_system_color_55e9adc94310 = nil
|
|
21
|
+
local source_shared_var_object_std_55e9adc94a00 = nil
|
|
22
|
+
local source_shared_functional_pipeline_55e9adca5c50 = nil
|
|
23
|
+
local source_shared_functional_decorator_55e9adca5750 = nil
|
|
24
|
+
local source_shared_string_encode_http_55e9add02410 = nil
|
|
25
|
+
local source_shared_string_encode_url_55e9adca91f0 = nil
|
|
26
|
+
local function main_55e9adc932d0()
|
|
27
|
+
local version = source_version_55e9adc93630()
|
|
28
|
+
local zeebo_module = source_shared_module_55e9adcfcee0()
|
|
29
|
+
local engine_encoder = source_engine_api_data_encoder_55e9adcde7b0()
|
|
30
|
+
local engine_game = source_engine_api_system_app_55e9add022a0()
|
|
31
|
+
local engine_hash = source_engine_api_data_hash_55e9adcec2d0()
|
|
32
|
+
local engine_http = source_engine_api_io_http_55e9add09cc0()
|
|
33
|
+
local engine_i18n = source_engine_api_data_i18n_55e9adcfb4b0()
|
|
34
|
+
local engine_key = source_engine_api_system_key_55e9adcdd690()
|
|
35
|
+
local engine_log = source_engine_api_debug_log_55e9adc93400()
|
|
36
|
+
local engine_math = source_engine_api_system_math_55e9add12fd0()
|
|
37
|
+
local engine_array = source_engine_api_data_array_55e9add03280()
|
|
38
|
+
local engine_media = source_engine_api_io_media_55e9add024e0()
|
|
39
|
+
local engine_api_draw_fps = source_engine_api_draw_fps_55e9add01370()
|
|
40
|
+
local engine_api_draw_text = source_engine_api_draw_text_55e9adcfd720()
|
|
41
|
+
local engine_api_draw_poly = source_engine_api_draw_poly_55e9add12880()
|
|
42
|
+
local engine_raw_memory = source_engine_api_raw_memory_55e9add0b7e0()
|
|
43
|
+
local callback_http = source_engine_protocol_http_callback_55e9adcfea60()
|
|
44
|
+
local application_default = source_shared_var_object_root_55e9add070f0()
|
|
45
|
+
local color = source_engine_api_system_color_55e9adc94310()
|
|
46
|
+
local std = source_shared_var_object_std_55e9adc94a00()
|
|
46
47
|
local application = application_default
|
|
47
48
|
local engine = {
|
|
48
49
|
keyboard = function(a, b, c, d) end,
|
|
@@ -168,9 +169,9 @@ zeebo_module.require(std, application, engine)
|
|
|
168
169
|
:package('@math', engine_math)
|
|
169
170
|
:package('@array', engine_array)
|
|
170
171
|
:package('@key', engine_key, {})
|
|
171
|
-
:package('@draw.fps',
|
|
172
|
-
:package('@draw.text',
|
|
173
|
-
:package('@draw.poly',
|
|
172
|
+
:package('@draw.fps', engine_api_draw_fps)
|
|
173
|
+
:package('@draw.text', engine_api_draw_text, cfg_text)
|
|
174
|
+
:package('@draw.poly', engine_api_draw_poly, cfg_poly)
|
|
174
175
|
:package('@color', color)
|
|
175
176
|
:package('@log', engine_log, cfg_log)
|
|
176
177
|
:package('math', engine_math.clib)
|
|
@@ -202,13 +203,13 @@ version=version
|
|
|
202
203
|
}
|
|
203
204
|
return P
|
|
204
205
|
end
|
|
205
|
-
|
|
206
|
-
return '0.
|
|
206
|
+
source_version_55e9adc93630 = function()
|
|
207
|
+
return '0.1.1'
|
|
207
208
|
end
|
|
208
209
|
--
|
|
209
|
-
|
|
210
|
-
local zeebo_pipeline =
|
|
211
|
-
local application_default =
|
|
210
|
+
source_shared_module_55e9adcfcee0 = function()
|
|
211
|
+
local zeebo_pipeline = source_shared_functional_pipeline_55e9adca5c50()
|
|
212
|
+
local application_default = source_shared_var_object_root_55e9add070f0()
|
|
212
213
|
local function default(application, defaults)
|
|
213
214
|
if not application then return nil end
|
|
214
215
|
local index = 1
|
|
@@ -410,7 +411,7 @@ require = require
|
|
|
410
411
|
return P
|
|
411
412
|
end
|
|
412
413
|
--
|
|
413
|
-
|
|
414
|
+
source_engine_api_data_encoder_55e9adcde7b0 = function()
|
|
414
415
|
local function install(std, engine, library, name)
|
|
415
416
|
std = std or {}
|
|
416
417
|
std[name] = {
|
|
@@ -425,8 +426,8 @@ install=install
|
|
|
425
426
|
return P
|
|
426
427
|
end
|
|
427
428
|
--
|
|
428
|
-
|
|
429
|
-
local util_decorator =
|
|
429
|
+
source_engine_api_system_app_55e9add022a0 = function()
|
|
430
|
+
local util_decorator = source_shared_functional_decorator_55e9adca5750()
|
|
430
431
|
local function reset(std, engine)
|
|
431
432
|
if std.node then
|
|
432
433
|
std.bus.emit('exit')
|
|
@@ -466,17 +467,15 @@ install=install
|
|
|
466
467
|
return P
|
|
467
468
|
end
|
|
468
469
|
--
|
|
469
|
-
|
|
470
|
+
source_engine_api_data_hash_55e9adcec2d0 = function()
|
|
470
471
|
local function djb2(digest)
|
|
471
472
|
local index = 1
|
|
472
473
|
local hash = 5381
|
|
473
474
|
while index <= #digest do
|
|
474
475
|
local char = string.byte(digest, index)
|
|
475
|
-
hash = (hash * 33
|
|
476
|
+
hash = (hash * 33 + char) % 4294967296
|
|
476
477
|
index = index + 1
|
|
477
478
|
end
|
|
478
|
-
hash = string.format('%08x', hash)
|
|
479
|
-
hash = tonumber(hash:sub(#hash - 7), 16)
|
|
480
479
|
return hash
|
|
481
480
|
end
|
|
482
481
|
local function install(std, engine, cfg_system)
|
|
@@ -492,8 +491,8 @@ install = install
|
|
|
492
491
|
return P
|
|
493
492
|
end
|
|
494
493
|
--
|
|
495
|
-
|
|
496
|
-
local zeebo_pipeline =
|
|
494
|
+
source_engine_api_io_http_55e9add09cc0 = function()
|
|
495
|
+
local zeebo_pipeline = source_shared_functional_pipeline_55e9adca5c50()
|
|
497
496
|
local function json(self)
|
|
498
497
|
self.options['json'] = true
|
|
499
498
|
return self
|
|
@@ -656,7 +655,7 @@ install=install
|
|
|
656
655
|
return P
|
|
657
656
|
end
|
|
658
657
|
--
|
|
659
|
-
|
|
658
|
+
source_engine_api_data_i18n_55e9adcfb4b0 = function()
|
|
660
659
|
local language = 'en-US'
|
|
661
660
|
local language_default = 'en-US'
|
|
662
661
|
local language_list = {}
|
|
@@ -748,7 +747,7 @@ install=install
|
|
|
748
747
|
return P
|
|
749
748
|
end
|
|
750
749
|
--
|
|
751
|
-
|
|
750
|
+
source_engine_api_system_key_55e9adcdd690 = function()
|
|
752
751
|
local function real_key(std, engine, rkey, rvalue)
|
|
753
752
|
local value = rvalue == 1 or rvalue == true
|
|
754
753
|
local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
|
|
@@ -788,8 +787,8 @@ install = install
|
|
|
788
787
|
return P
|
|
789
788
|
end
|
|
790
789
|
--
|
|
791
|
-
|
|
792
|
-
local util_decorator =
|
|
790
|
+
source_engine_api_debug_log_55e9adc93400 = function()
|
|
791
|
+
local util_decorator = source_shared_functional_decorator_55e9adca5750()
|
|
793
792
|
local logging_types = {
|
|
794
793
|
'none', 'fatal', 'error', 'warn', 'debug', 'info'
|
|
795
794
|
}
|
|
@@ -835,7 +834,7 @@ install = install
|
|
|
835
834
|
return P
|
|
836
835
|
end
|
|
837
836
|
--
|
|
838
|
-
|
|
837
|
+
source_engine_api_system_math_55e9add12fd0 = function()
|
|
839
838
|
local function abs(value)
|
|
840
839
|
if value < 0 then
|
|
841
840
|
return -value
|
|
@@ -1010,8 +1009,8 @@ install = install_clib_random
|
|
|
1010
1009
|
return P;
|
|
1011
1010
|
end
|
|
1012
1011
|
--
|
|
1013
|
-
|
|
1014
|
-
local util_decorator =
|
|
1012
|
+
source_engine_api_data_array_55e9add03280 = function()
|
|
1013
|
+
local util_decorator = source_shared_functional_decorator_55e9adca5750()
|
|
1015
1014
|
local function array_map(array, func)
|
|
1016
1015
|
local res = {}
|
|
1017
1016
|
local index = 1
|
|
@@ -1172,7 +1171,7 @@ install = install
|
|
|
1172
1171
|
return P
|
|
1173
1172
|
end
|
|
1174
1173
|
--
|
|
1175
|
-
|
|
1174
|
+
source_engine_api_io_media_55e9add024e0 = function()
|
|
1176
1175
|
local function media_create(node, channels, handler)
|
|
1177
1176
|
local decorator = function(func)
|
|
1178
1177
|
func = func or function() end
|
|
@@ -1219,7 +1218,7 @@ install=install
|
|
|
1219
1218
|
return P
|
|
1220
1219
|
end
|
|
1221
1220
|
--
|
|
1222
|
-
|
|
1221
|
+
source_engine_api_draw_fps_55e9add01370 = function()
|
|
1223
1222
|
local function draw_fps(std, engine, show, pos_x, pos_y)
|
|
1224
1223
|
if show < 1 then return end
|
|
1225
1224
|
local x = engine.current.config.offset_x + pos_x
|
|
@@ -1271,8 +1270,8 @@ install=install
|
|
|
1271
1270
|
return P
|
|
1272
1271
|
end
|
|
1273
1272
|
--
|
|
1274
|
-
|
|
1275
|
-
local util_decorator =
|
|
1273
|
+
source_engine_api_draw_text_55e9adcfd720 = function()
|
|
1274
|
+
local util_decorator = source_shared_functional_decorator_55e9adca5750()
|
|
1276
1275
|
local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
|
|
1277
1276
|
size = size or 2
|
|
1278
1277
|
local hem = engine.current.data.width / 80
|
|
@@ -1299,7 +1298,7 @@ install=install
|
|
|
1299
1298
|
return P
|
|
1300
1299
|
end
|
|
1301
1300
|
--
|
|
1302
|
-
|
|
1301
|
+
source_engine_api_draw_poly_55e9add12880 = function()
|
|
1303
1302
|
local function decorator_poo(object, func)
|
|
1304
1303
|
if not object or not func then return func end
|
|
1305
1304
|
return function(a, b, c, d)
|
|
@@ -1406,7 +1405,7 @@ install=install
|
|
|
1406
1405
|
return P
|
|
1407
1406
|
end
|
|
1408
1407
|
--
|
|
1409
|
-
|
|
1408
|
+
source_engine_api_raw_memory_55e9add0b7e0 = function()
|
|
1410
1409
|
local memory_dict_unload = {}
|
|
1411
1410
|
local memory_dict = {}
|
|
1412
1411
|
local memory_list = {}
|
|
@@ -1461,8 +1460,9 @@ install=install
|
|
|
1461
1460
|
return P
|
|
1462
1461
|
end
|
|
1463
1462
|
--
|
|
1464
|
-
|
|
1465
|
-
local
|
|
1463
|
+
source_engine_protocol_http_callback_55e9adcfea60 = function()
|
|
1464
|
+
local str_http = source_shared_string_encode_http_55e9add02410()
|
|
1465
|
+
local str_url = source_shared_string_encode_url_55e9adca91f0()
|
|
1466
1466
|
local callbacks = {
|
|
1467
1467
|
['async-promise'] = function(self)
|
|
1468
1468
|
return self:promise()
|
|
@@ -1474,7 +1474,7 @@ end,
|
|
|
1474
1474
|
return self.url
|
|
1475
1475
|
end,
|
|
1476
1476
|
['get-fullurl'] = function(self)
|
|
1477
|
-
return self.url..
|
|
1477
|
+
return self.url..str_url.search_param(self.param_list, self.param_dict)
|
|
1478
1478
|
end,
|
|
1479
1479
|
['get-method'] = function(self)
|
|
1480
1480
|
return self.method
|
|
@@ -1502,7 +1502,7 @@ return self.heeader_dict[self.data] or self.heeader_dict[self.header_list[self.d
|
|
|
1502
1502
|
end,
|
|
1503
1503
|
['set-status'] = function(self, data)
|
|
1504
1504
|
self.set('status', data)
|
|
1505
|
-
self.set('ok',
|
|
1505
|
+
self.set('ok', str_http.is_ok(data))
|
|
1506
1506
|
end,
|
|
1507
1507
|
['set-error'] = function(self, data)
|
|
1508
1508
|
self.set('error', data)
|
|
@@ -1529,7 +1529,7 @@ func = native_http_callback
|
|
|
1529
1529
|
return P
|
|
1530
1530
|
end
|
|
1531
1531
|
--
|
|
1532
|
-
|
|
1532
|
+
source_shared_var_object_root_55e9add070f0 = function()
|
|
1533
1533
|
local P = {
|
|
1534
1534
|
data={
|
|
1535
1535
|
width=1280,
|
|
@@ -1559,7 +1559,7 @@ callbacks={
|
|
|
1559
1559
|
return P;
|
|
1560
1560
|
end
|
|
1561
1561
|
--
|
|
1562
|
-
|
|
1562
|
+
source_engine_api_system_color_55e9adc94310 = function()
|
|
1563
1563
|
local function install(std)
|
|
1564
1564
|
std.color = std.color or {}
|
|
1565
1565
|
std.color.white = 0xFFFFFFFF
|
|
@@ -1594,7 +1594,7 @@ install = install
|
|
|
1594
1594
|
return P
|
|
1595
1595
|
end
|
|
1596
1596
|
--
|
|
1597
|
-
|
|
1597
|
+
source_shared_var_object_std_55e9adc94a00 = function()
|
|
1598
1598
|
local P = {
|
|
1599
1599
|
milis = 0,
|
|
1600
1600
|
delta = 0,
|
|
@@ -1660,7 +1660,7 @@ any=false
|
|
|
1660
1660
|
return P;
|
|
1661
1661
|
end
|
|
1662
1662
|
--
|
|
1663
|
-
|
|
1663
|
+
source_shared_functional_pipeline_55e9adca5c50 = function()
|
|
1664
1664
|
local function pipe(self)
|
|
1665
1665
|
return function()
|
|
1666
1666
|
self:run()
|
|
@@ -1710,7 +1710,7 @@ run=run
|
|
|
1710
1710
|
return P
|
|
1711
1711
|
end
|
|
1712
1712
|
--
|
|
1713
|
-
|
|
1713
|
+
source_shared_functional_decorator_55e9adca5750 = function()
|
|
1714
1714
|
local function decorator_prefix3(zig, zag, zom, func)
|
|
1715
1715
|
return function (a, b, c, d, e, f)
|
|
1716
1716
|
return func(zig, zag, zom, a, b, c, d, e, f)
|
|
@@ -1768,7 +1768,7 @@ prefix1_t = table_prefix1
|
|
|
1768
1768
|
return P
|
|
1769
1769
|
end
|
|
1770
1770
|
--
|
|
1771
|
-
|
|
1771
|
+
source_shared_string_encode_http_55e9add02410 = function()
|
|
1772
1772
|
local function is_ok(status)
|
|
1773
1773
|
return (status and 200 <= status and status < 300) or false
|
|
1774
1774
|
end
|
|
@@ -1792,21 +1792,6 @@ end
|
|
|
1792
1792
|
local function get_user_agent()
|
|
1793
1793
|
return 'Ginga (GlyOS;SmartTv/Linux)'
|
|
1794
1794
|
end
|
|
1795
|
-
local function url_search_param(param_list, param_dict)
|
|
1796
|
-
local index, params = 1, ''
|
|
1797
|
-
while param_list and param_dict and index <= #param_list do
|
|
1798
|
-
local param = param_list[index]
|
|
1799
|
-
local value = param_dict[param]
|
|
1800
|
-
if #params == 0 then
|
|
1801
|
-
params = params..'?'
|
|
1802
|
-
else
|
|
1803
|
-
params = params..'&'
|
|
1804
|
-
end
|
|
1805
|
-
params = params..param:gsub(' ', '%20')..'='..(value or ''):gsub(' ', '%20')
|
|
1806
|
-
index = index + 1
|
|
1807
|
-
end
|
|
1808
|
-
return params
|
|
1809
|
-
end
|
|
1810
1795
|
local function create_request(method, uri)
|
|
1811
1796
|
local self = {
|
|
1812
1797
|
body_content = '',
|
|
@@ -1926,9 +1911,30 @@ is_ok_header=is_ok_header,
|
|
|
1926
1911
|
is_redirect=is_redirect,
|
|
1927
1912
|
get_content=get_content,
|
|
1928
1913
|
get_user_agent=get_user_agent,
|
|
1929
|
-
url_search_param=url_search_param,
|
|
1930
1914
|
create_request=create_request
|
|
1931
1915
|
}
|
|
1932
1916
|
end
|
|
1933
1917
|
--
|
|
1934
|
-
|
|
1918
|
+
source_shared_string_encode_url_55e9adca91f0 = function()
|
|
1919
|
+
local function search_param(param_list, param_dict)
|
|
1920
|
+
local index, params = 1, ''
|
|
1921
|
+
while param_list and param_dict and index <= #param_list do
|
|
1922
|
+
local param = param_list[index]
|
|
1923
|
+
local value = param_dict[param]
|
|
1924
|
+
if #params == 0 then
|
|
1925
|
+
params = params..'?'
|
|
1926
|
+
else
|
|
1927
|
+
params = params..'&'
|
|
1928
|
+
end
|
|
1929
|
+
params = params..param:gsub(' ', '%20')..'='..(value or ''):gsub(' ', '%20')
|
|
1930
|
+
index = index + 1
|
|
1931
|
+
end
|
|
1932
|
+
return params
|
|
1933
|
+
end
|
|
1934
|
+
local P = {
|
|
1935
|
+
search_param = search_param
|
|
1936
|
+
}
|
|
1937
|
+
return P
|
|
1938
|
+
end
|
|
1939
|
+
--
|
|
1940
|
+
return main_55e9adc932d0()
|