@gamely/gly-engine-lite 0.2.7 → 0.3.0
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 +118 -70
- package/package.json +1 -1
package/dist/main.lua
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
local
|
|
2
|
-
local
|
|
1
|
+
local b2560 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
|
|
2
|
+
local r2560 = function(i, f)
|
|
3
3
|
return function()
|
|
4
4
|
local c = f()
|
|
5
|
-
|
|
5
|
+
b2560[i] = function() return c end
|
|
6
6
|
return c
|
|
7
7
|
end
|
|
8
8
|
end
|
|
9
9
|
local math = ((function() local x, y = pcall(require, 'math'); return x and y end)()) or _G.math
|
|
10
|
-
local function
|
|
11
|
-
local version =
|
|
12
|
-
local loadcore =
|
|
13
|
-
local loadgame =
|
|
14
|
-
local engine_encoder =
|
|
15
|
-
local engine_game =
|
|
16
|
-
local engine_hash =
|
|
17
|
-
local engine_http =
|
|
18
|
-
local engine_i18n =
|
|
19
|
-
local engine_key =
|
|
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
|
|
10
|
+
local function m2560()
|
|
11
|
+
local version = b2560[1]('source_version')
|
|
12
|
+
local loadcore = b2560[2]('source_shared_engine_loadcore')
|
|
13
|
+
local loadgame = b2560[3]('source_shared_engine_loadgame')
|
|
14
|
+
local engine_encoder = b2560[4]('source_engine_api_data_encoder')
|
|
15
|
+
local engine_game = b2560[5]('source_engine_api_system_app')
|
|
16
|
+
local engine_hash = b2560[6]('source_engine_api_data_hash')
|
|
17
|
+
local engine_http = b2560[7]('source_engine_api_io_http')
|
|
18
|
+
local engine_i18n = b2560[8]('source_engine_api_data_i18n')
|
|
19
|
+
local engine_key = b2560[9]('source_engine_api_system_key')
|
|
20
|
+
local engine_env = b2560[10]('source_engine_api_system_getenv')
|
|
21
|
+
local engine_log = b2560[11]('source_engine_api_debug_log')
|
|
22
|
+
local engine_math = b2560[12]('source_engine_api_math_basic')
|
|
23
|
+
local engine_math_clib = b2560[13]('source_engine_api_math_clib')
|
|
24
|
+
local engine_math_random = b2560[14]('source_engine_api_math_random')
|
|
25
|
+
local engine_array = b2560[15]('source_engine_api_data_array')
|
|
26
|
+
local engine_media = b2560[16]('source_engine_api_io_media')
|
|
27
|
+
local engine_api_draw_fps = b2560[17]('source_engine_api_draw_fps')
|
|
28
|
+
local engine_api_draw_text = b2560[18]('source_engine_api_draw_text')
|
|
29
|
+
local engine_api_draw_poly = b2560[19]('source_engine_api_draw_poly')
|
|
30
|
+
local engine_raw_memory = b2560[20]('source_engine_api_raw_memory')
|
|
31
|
+
local callback_http = b2560[21]('source_engine_protocol_http_callback')
|
|
32
|
+
local application_default = b2560[22]('source_shared_var_object_root')
|
|
33
|
+
local color = b2560[23]('source_engine_api_system_color')
|
|
34
|
+
local std = b2560[24]('source_shared_var_object_std')
|
|
34
35
|
local application = application_default
|
|
35
36
|
local engine = {
|
|
36
37
|
keyboard = function(a, b, c, d) end,
|
|
@@ -96,6 +97,9 @@ local cfg_xml = {
|
|
|
96
97
|
decode = native_xml_decode,
|
|
97
98
|
encode = native_xml_encode
|
|
98
99
|
}
|
|
100
|
+
local cfg_env = {
|
|
101
|
+
get_env = native_system_get_env
|
|
102
|
+
}
|
|
99
103
|
function native_callback_loop(dt)
|
|
100
104
|
std.milis = std.milis + dt
|
|
101
105
|
std.delta = dt
|
|
@@ -160,6 +164,7 @@ loadcore.setup(std, application, engine)
|
|
|
160
164
|
:package('@draw.poly', engine_api_draw_poly, cfg_poly)
|
|
161
165
|
:package('@color', color)
|
|
162
166
|
:package('@log', engine_log, cfg_log)
|
|
167
|
+
:package('@env', engine_env, cfg_env)
|
|
163
168
|
:package('math', engine_math_clib)
|
|
164
169
|
:package('math.random', engine_math_random)
|
|
165
170
|
:package('http', engine_http, cfg_http)
|
|
@@ -188,12 +193,12 @@ version=version
|
|
|
188
193
|
}
|
|
189
194
|
return P
|
|
190
195
|
end
|
|
191
|
-
|
|
192
|
-
return '0.
|
|
196
|
+
b2560[1] = r2560(1, function()
|
|
197
|
+
return '0.3.0'
|
|
193
198
|
end)
|
|
194
|
-
|
|
195
|
-
local zeebo_pipeline =
|
|
196
|
-
local requires =
|
|
199
|
+
b2560[2] = r2560(2, function()
|
|
200
|
+
local zeebo_pipeline = b2560[25]('source_shared_functional_pipeline')
|
|
201
|
+
local requires = b2560[26]('source_shared_string_dsl_requires')
|
|
197
202
|
local function step_install_libsys(self, lib_name, library, custom, is_system)
|
|
198
203
|
if not is_system then return end
|
|
199
204
|
local ok, msg = pcall(function()
|
|
@@ -274,9 +279,9 @@ setup = setup
|
|
|
274
279
|
}
|
|
275
280
|
return P
|
|
276
281
|
end)
|
|
277
|
-
|
|
278
|
-
local eval_file =
|
|
279
|
-
local eval_code =
|
|
282
|
+
b2560[3] = r2560(3, function()
|
|
283
|
+
local eval_file = b2560[27]('source_shared_string_eval_file')
|
|
284
|
+
local eval_code = b2560[28]('source_shared_string_eval_code')
|
|
280
285
|
local has_io_open = io and io.open
|
|
281
286
|
local function normalize(app, base)
|
|
282
287
|
if not app then return nil end
|
|
@@ -348,7 +353,7 @@ script = script
|
|
|
348
353
|
}
|
|
349
354
|
return P
|
|
350
355
|
end)
|
|
351
|
-
|
|
356
|
+
b2560[4] = r2560(4, function()
|
|
352
357
|
local function install(std, engine, library, name)
|
|
353
358
|
std = std or {}
|
|
354
359
|
std[name] = {
|
|
@@ -362,8 +367,8 @@ install=install
|
|
|
362
367
|
}
|
|
363
368
|
return P
|
|
364
369
|
end)
|
|
365
|
-
|
|
366
|
-
local util_decorator =
|
|
370
|
+
b2560[5] = r2560(5, function()
|
|
371
|
+
local util_decorator = b2560[29]('source_shared_functional_decorator')
|
|
367
372
|
local function reset(std, engine)
|
|
368
373
|
if std.node then
|
|
369
374
|
std.bus.emit('exit')
|
|
@@ -402,7 +407,7 @@ install=install
|
|
|
402
407
|
}
|
|
403
408
|
return P
|
|
404
409
|
end)
|
|
405
|
-
|
|
410
|
+
b2560[6] = r2560(6, function()
|
|
406
411
|
local function djb2(digest)
|
|
407
412
|
local index = 1
|
|
408
413
|
local hash = 5381
|
|
@@ -425,8 +430,8 @@ install = install
|
|
|
425
430
|
}
|
|
426
431
|
return P
|
|
427
432
|
end)
|
|
428
|
-
|
|
429
|
-
local zeebo_pipeline =
|
|
433
|
+
b2560[7] = r2560(7, function()
|
|
434
|
+
local zeebo_pipeline = b2560[25]('source_shared_functional_pipeline')
|
|
430
435
|
local function json(self)
|
|
431
436
|
self.options['json'] = true
|
|
432
437
|
return self
|
|
@@ -583,7 +588,7 @@ install=install
|
|
|
583
588
|
}
|
|
584
589
|
return P
|
|
585
590
|
end)
|
|
586
|
-
|
|
591
|
+
b2560[8] = r2560(8, function()
|
|
587
592
|
local language = 'en-US'
|
|
588
593
|
local language_default = 'en-US'
|
|
589
594
|
local language_list = {}
|
|
@@ -674,7 +679,7 @@ install=install
|
|
|
674
679
|
}
|
|
675
680
|
return P
|
|
676
681
|
end)
|
|
677
|
-
|
|
682
|
+
b2560[9] = r2560(9, function()
|
|
678
683
|
local function real_key(std, engine, rkey, rvalue)
|
|
679
684
|
local value = rvalue == 1 or rvalue == true
|
|
680
685
|
local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
|
|
@@ -710,8 +715,51 @@ install = install
|
|
|
710
715
|
}
|
|
711
716
|
return P
|
|
712
717
|
end)
|
|
713
|
-
|
|
714
|
-
local
|
|
718
|
+
b2560[10] = r2560(10, function()
|
|
719
|
+
local function setenv(engine)
|
|
720
|
+
return function(varname, value)
|
|
721
|
+
if engine.root ~= engine.current then
|
|
722
|
+
error('unauthorized set environment', 0)
|
|
723
|
+
end
|
|
724
|
+
if varname then
|
|
725
|
+
engine.overrides_envs[varname] = tostring(value)
|
|
726
|
+
end
|
|
727
|
+
end
|
|
728
|
+
end
|
|
729
|
+
local function getenv(engine, get_env)
|
|
730
|
+
return function(varname)
|
|
731
|
+
local game_envs = engine.root and engine.root.envs
|
|
732
|
+
local core_envs = engine.envs
|
|
733
|
+
if not (varname or #varname > 0) then
|
|
734
|
+
return nil
|
|
735
|
+
end
|
|
736
|
+
if engine.overrides_envs[varname] then
|
|
737
|
+
return engine.overrides_envs[varname]
|
|
738
|
+
end
|
|
739
|
+
if game_envs and game_envs[varname] then
|
|
740
|
+
return game_envs[varname]
|
|
741
|
+
end
|
|
742
|
+
if core_envs and core_envs[varname] then
|
|
743
|
+
return core_envs[varname]
|
|
744
|
+
end
|
|
745
|
+
if get_env then
|
|
746
|
+
return get_env(varname)
|
|
747
|
+
end
|
|
748
|
+
return nil
|
|
749
|
+
end
|
|
750
|
+
end
|
|
751
|
+
local function install(std, engine, cfg)
|
|
752
|
+
engine.overrides_envs = {}
|
|
753
|
+
std.getenv = getenv(engine, cfg.get_env)
|
|
754
|
+
std.setenv = setenv(engine)
|
|
755
|
+
end
|
|
756
|
+
local P = {
|
|
757
|
+
install = install
|
|
758
|
+
}
|
|
759
|
+
return P
|
|
760
|
+
end)
|
|
761
|
+
b2560[11] = r2560(11, function()
|
|
762
|
+
local util_decorator = b2560[29]('source_shared_functional_decorator')
|
|
715
763
|
local logging_types = {
|
|
716
764
|
'none', 'fatal', 'error', 'warn', 'debug', 'info'
|
|
717
765
|
}
|
|
@@ -756,7 +804,7 @@ install = install
|
|
|
756
804
|
}
|
|
757
805
|
return P
|
|
758
806
|
end)
|
|
759
|
-
|
|
807
|
+
b2560[12] = r2560(12, function()
|
|
760
808
|
local function abs(value)
|
|
761
809
|
if value < 0 then
|
|
762
810
|
return -value
|
|
@@ -854,7 +902,7 @@ install = install
|
|
|
854
902
|
}
|
|
855
903
|
return P
|
|
856
904
|
end)
|
|
857
|
-
|
|
905
|
+
b2560[13] = r2560(13, function()
|
|
858
906
|
local function install(std)
|
|
859
907
|
assert(math and (1/2 ~= 0))
|
|
860
908
|
std.math = std.math or {}
|
|
@@ -889,7 +937,7 @@ install = install
|
|
|
889
937
|
}
|
|
890
938
|
return P
|
|
891
939
|
end)
|
|
892
|
-
|
|
940
|
+
b2560[14] = r2560(14, function()
|
|
893
941
|
local function install(std)
|
|
894
942
|
assert(math and (1/2 ~= 0))
|
|
895
943
|
std.math = std.math or {}
|
|
@@ -905,8 +953,8 @@ install = install
|
|
|
905
953
|
}
|
|
906
954
|
return P
|
|
907
955
|
end)
|
|
908
|
-
|
|
909
|
-
local util_decorator =
|
|
956
|
+
b2560[15] = r2560(15, function()
|
|
957
|
+
local util_decorator = b2560[29]('source_shared_functional_decorator')
|
|
910
958
|
local function array_map(array, func)
|
|
911
959
|
local res = {}
|
|
912
960
|
local index = 1
|
|
@@ -1066,7 +1114,7 @@ install = install
|
|
|
1066
1114
|
}
|
|
1067
1115
|
return P
|
|
1068
1116
|
end)
|
|
1069
|
-
|
|
1117
|
+
b2560[16] = r2560(16, function()
|
|
1070
1118
|
local function media_create(node, channels, handler)
|
|
1071
1119
|
local decorator = function(func)
|
|
1072
1120
|
func = func or function() end
|
|
@@ -1111,7 +1159,7 @@ install=install
|
|
|
1111
1159
|
}
|
|
1112
1160
|
return P
|
|
1113
1161
|
end)
|
|
1114
|
-
|
|
1162
|
+
b2560[17] = r2560(17, function()
|
|
1115
1163
|
local function draw_fps(std, engine, show, pos_x, pos_y)
|
|
1116
1164
|
if show < 1 then return end
|
|
1117
1165
|
local x = engine.current.config.offset_x + pos_x
|
|
@@ -1159,8 +1207,8 @@ install=install
|
|
|
1159
1207
|
}
|
|
1160
1208
|
return P
|
|
1161
1209
|
end)
|
|
1162
|
-
|
|
1163
|
-
local util_decorator =
|
|
1210
|
+
b2560[18] = r2560(18, function()
|
|
1211
|
+
local util_decorator = b2560[29]('source_shared_functional_decorator')
|
|
1164
1212
|
local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
|
|
1165
1213
|
size = size or 2
|
|
1166
1214
|
local hem = engine.current.data.width / 80
|
|
@@ -1188,7 +1236,7 @@ install=install
|
|
|
1188
1236
|
}
|
|
1189
1237
|
return P
|
|
1190
1238
|
end)
|
|
1191
|
-
|
|
1239
|
+
b2560[19] = r2560(19, function()
|
|
1192
1240
|
local function decorator_poo(object, func)
|
|
1193
1241
|
if not object or not func then return func end
|
|
1194
1242
|
return function(a, b, c, d)
|
|
@@ -1294,7 +1342,7 @@ install=install
|
|
|
1294
1342
|
}
|
|
1295
1343
|
return P
|
|
1296
1344
|
end)
|
|
1297
|
-
|
|
1345
|
+
b2560[20] = r2560(20, function()
|
|
1298
1346
|
local memory_dict_unload = {}
|
|
1299
1347
|
local memory_dict = {}
|
|
1300
1348
|
local memory_list = {}
|
|
@@ -1348,9 +1396,9 @@ install=install
|
|
|
1348
1396
|
}
|
|
1349
1397
|
return P
|
|
1350
1398
|
end)
|
|
1351
|
-
|
|
1352
|
-
local str_http =
|
|
1353
|
-
local str_url =
|
|
1399
|
+
b2560[21] = r2560(21, function()
|
|
1400
|
+
local str_http = b2560[31]('source_shared_string_encode_http')
|
|
1401
|
+
local str_url = b2560[32]('source_shared_string_encode_url')
|
|
1354
1402
|
local callbacks = {
|
|
1355
1403
|
['async-promise'] = function(self)
|
|
1356
1404
|
return self:promise()
|
|
@@ -1419,7 +1467,7 @@ func = native_http_callback
|
|
|
1419
1467
|
}
|
|
1420
1468
|
return P
|
|
1421
1469
|
end)
|
|
1422
|
-
|
|
1470
|
+
b2560[22] = r2560(22, function()
|
|
1423
1471
|
local P = {
|
|
1424
1472
|
data={
|
|
1425
1473
|
width=1280,
|
|
@@ -1448,7 +1496,7 @@ callbacks={
|
|
|
1448
1496
|
}
|
|
1449
1497
|
return P;
|
|
1450
1498
|
end)
|
|
1451
|
-
|
|
1499
|
+
b2560[23] = r2560(23, function()
|
|
1452
1500
|
local function install(std)
|
|
1453
1501
|
std.color = std.color or {}
|
|
1454
1502
|
std.color.white = 0xFFFFFFFF
|
|
@@ -1482,7 +1530,7 @@ install = install
|
|
|
1482
1530
|
}
|
|
1483
1531
|
return P
|
|
1484
1532
|
end)
|
|
1485
|
-
|
|
1533
|
+
b2560[24] = r2560(24, function()
|
|
1486
1534
|
local P = {
|
|
1487
1535
|
milis = 0,
|
|
1488
1536
|
delta = 0,
|
|
@@ -1549,7 +1597,7 @@ any=false
|
|
|
1549
1597
|
}
|
|
1550
1598
|
return P;
|
|
1551
1599
|
end)
|
|
1552
|
-
|
|
1600
|
+
b2560[25] = r2560(25, function()
|
|
1553
1601
|
local function pipe(self)
|
|
1554
1602
|
return function()
|
|
1555
1603
|
self:run()
|
|
@@ -1598,7 +1646,7 @@ run=run
|
|
|
1598
1646
|
}
|
|
1599
1647
|
return P
|
|
1600
1648
|
end)
|
|
1601
|
-
|
|
1649
|
+
b2560[26] = r2560(26, function()
|
|
1602
1650
|
local function encode(dsl_string)
|
|
1603
1651
|
local spec = {
|
|
1604
1652
|
list = {},
|
|
@@ -1646,7 +1694,7 @@ should_import = should_import
|
|
|
1646
1694
|
}
|
|
1647
1695
|
return P
|
|
1648
1696
|
end)
|
|
1649
|
-
|
|
1697
|
+
b2560[27] = r2560(27, function()
|
|
1650
1698
|
local function script(src)
|
|
1651
1699
|
local ok, app = false, nil
|
|
1652
1700
|
if require then
|
|
@@ -1671,7 +1719,7 @@ script = script,
|
|
|
1671
1719
|
}
|
|
1672
1720
|
return P
|
|
1673
1721
|
end)
|
|
1674
|
-
|
|
1722
|
+
b2560[28] = r2560(28, function()
|
|
1675
1723
|
local function script(src)
|
|
1676
1724
|
local loader = loadstring or load
|
|
1677
1725
|
if not loader then
|
|
@@ -1691,7 +1739,7 @@ script = script,
|
|
|
1691
1739
|
}
|
|
1692
1740
|
return P
|
|
1693
1741
|
end)
|
|
1694
|
-
|
|
1742
|
+
b2560[29] = r2560(29, function()
|
|
1695
1743
|
local function decorator_prefix3(zig, zag, zom, func)
|
|
1696
1744
|
return function (a, b, c, d, e, f)
|
|
1697
1745
|
return func(zig, zag, zom, a, b, c, d, e, f)
|
|
@@ -1748,7 +1796,7 @@ prefix1_t = table_prefix1
|
|
|
1748
1796
|
}
|
|
1749
1797
|
return P
|
|
1750
1798
|
end)
|
|
1751
|
-
|
|
1799
|
+
b2560[31] = r2560(31, function()
|
|
1752
1800
|
local function is_ok(status)
|
|
1753
1801
|
return (status and 200 <= status and status < 300) or false
|
|
1754
1802
|
end
|
|
@@ -1894,7 +1942,7 @@ get_user_agent=get_user_agent,
|
|
|
1894
1942
|
create_request=create_request
|
|
1895
1943
|
}
|
|
1896
1944
|
end)
|
|
1897
|
-
|
|
1945
|
+
b2560[32] = r2560(32, function()
|
|
1898
1946
|
local function search_param(param_list, param_dict)
|
|
1899
1947
|
local index, params = 1, ''
|
|
1900
1948
|
while param_list and param_dict and index <= #param_list do
|
|
@@ -1915,4 +1963,4 @@ search_param = search_param
|
|
|
1915
1963
|
}
|
|
1916
1964
|
return P
|
|
1917
1965
|
end)
|
|
1918
|
-
return
|
|
1966
|
+
return m2560()
|