@gamely/gly-engine-lite 0.0.17 → 0.0.18
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 +219 -146
- package/package.json +1 -1
package/dist/main.lua
CHANGED
|
@@ -1,50 +1,94 @@
|
|
|
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
|
|
2
|
+
local src_version_561fa16ca630 = nil
|
|
3
|
+
local src_lib_common_module_561fa16cab70 = nil
|
|
4
|
+
local src_lib_engine_api_encoder_561fa16cb2c0 = nil
|
|
5
|
+
local src_lib_engine_api_app_561fa16cff00 = nil
|
|
6
|
+
local src_lib_engine_api_hash_561fa16d0530 = nil
|
|
7
|
+
local src_lib_engine_api_http_561fa16d0b50 = nil
|
|
8
|
+
local src_lib_engine_api_i18n_561fa16d10f0 = nil
|
|
9
|
+
local src_lib_engine_api_key_561fa16d1700 = nil
|
|
10
|
+
local src_lib_engine_api_math_561fa16c5900 = nil
|
|
11
|
+
local src_lib_engine_api_array_561fa16c1450 = nil
|
|
12
|
+
local src_lib_engine_api_media_561fa16cce10 = nil
|
|
13
|
+
local src_lib_engine_draw_fps_561fa16c6900 = nil
|
|
14
|
+
local src_lib_engine_draw_text_561fa16c8d50 = nil
|
|
15
|
+
local src_lib_engine_draw_poly_561fa16ca270 = nil
|
|
16
|
+
local src_lib_engine_raw_memory_561fa16caab0 = nil
|
|
17
|
+
local src_lib_object_root_561fa16cb030 = nil
|
|
18
|
+
local src_lib_object_color_561fa16d0260 = nil
|
|
19
|
+
local src_lib_object_std_561fa16c9dc0 = nil
|
|
20
|
+
local src_lib_util_pipeline_561fa16c26b0 = nil
|
|
21
|
+
local src_lib_util_decorator_561fa16bfce0 = nil
|
|
22
|
+
local function main_561fa16ca3f0()
|
|
23
|
+
local version = src_version_561fa16ca630()
|
|
24
|
+
local zeebo_module = src_lib_common_module_561fa16cab70()
|
|
25
|
+
local engine_encoder = src_lib_engine_api_encoder_561fa16cb2c0()
|
|
26
|
+
local engine_game = src_lib_engine_api_app_561fa16cff00()
|
|
27
|
+
local engine_hash = src_lib_engine_api_hash_561fa16d0530()
|
|
28
|
+
local engine_http = src_lib_engine_api_http_561fa16d0b50()
|
|
29
|
+
local engine_i18n = src_lib_engine_api_i18n_561fa16d10f0()
|
|
30
|
+
local engine_key = src_lib_engine_api_key_561fa16d1700()
|
|
31
|
+
local engine_math = src_lib_engine_api_math_561fa16c5900()
|
|
32
|
+
local engine_array = src_lib_engine_api_array_561fa16c1450()
|
|
33
|
+
local engine_media = src_lib_engine_api_media_561fa16cce10()
|
|
34
|
+
local engine_draw_fps = src_lib_engine_draw_fps_561fa16c6900()
|
|
35
|
+
local engine_draw_text = src_lib_engine_draw_text_561fa16c8d50()
|
|
36
|
+
local engine_draw_poly = src_lib_engine_draw_poly_561fa16ca270()
|
|
37
|
+
local engine_raw_memory = src_lib_engine_raw_memory_561fa16caab0()
|
|
38
|
+
local application_default = src_lib_object_root_561fa16cb030()
|
|
39
|
+
local color = src_lib_object_color_561fa16d0260()
|
|
40
|
+
local std = src_lib_object_std_561fa16c9dc0()
|
|
39
41
|
local application = application_default
|
|
40
42
|
local engine = {
|
|
41
43
|
keyboard = function(a, b, c, d) end,
|
|
42
44
|
current = application_default,
|
|
43
45
|
root = application_default
|
|
44
46
|
}
|
|
47
|
+
local cfg_system = {
|
|
48
|
+
exit = native_system_exit,
|
|
49
|
+
reset = native_system_reset,
|
|
50
|
+
title = native_system_title,
|
|
51
|
+
get_fps = native_system_get_fps,
|
|
52
|
+
get_secret = native_system_get_secret,
|
|
53
|
+
get_language = native_system_get_language
|
|
54
|
+
}
|
|
55
|
+
local cfg_media = {
|
|
56
|
+
position=native_media_position,
|
|
57
|
+
resize=native_media_resize,
|
|
58
|
+
pause=native_media_pause,
|
|
59
|
+
load=native_media_load,
|
|
60
|
+
play=native_media_play
|
|
61
|
+
}
|
|
62
|
+
local cfg_poly = {
|
|
63
|
+
repeats = {
|
|
64
|
+
native_cfg_poly_repeat_0 or false,
|
|
65
|
+
native_cfg_poly_repeat_1 or false,
|
|
66
|
+
native_cfg_poly_repeat_2 or false
|
|
67
|
+
},
|
|
68
|
+
triangle = native_draw_triangle,
|
|
69
|
+
poly2 = native_draw_poly2,
|
|
70
|
+
poly = native_draw_poly,
|
|
71
|
+
line = native_draw_line
|
|
72
|
+
}
|
|
45
73
|
local cfg_text = {
|
|
46
74
|
font_previous = native_text_font_previous
|
|
47
75
|
}
|
|
76
|
+
local cfg_http = {
|
|
77
|
+
ssl = native_http_has_ssl,
|
|
78
|
+
handler = native_http_handler
|
|
79
|
+
}
|
|
80
|
+
local cfg_base64 = {
|
|
81
|
+
decode = native_base64_decode,
|
|
82
|
+
encode = native_base64_encode
|
|
83
|
+
}
|
|
84
|
+
local cfg_json = {
|
|
85
|
+
decode = native_json_decode,
|
|
86
|
+
encode = native_json_encode
|
|
87
|
+
}
|
|
88
|
+
local cfg_xml = {
|
|
89
|
+
decode = native_xml_decode,
|
|
90
|
+
encode = native_xml_encode
|
|
91
|
+
}
|
|
48
92
|
function native_callback_loop(dt)
|
|
49
93
|
std.milis = std.milis + dt
|
|
50
94
|
std.delta = dt
|
|
@@ -91,28 +135,30 @@ std.text.font_default=native_text_font_default
|
|
|
91
135
|
std.draw.clear=function(tint)
|
|
92
136
|
native_draw_clear(tint, 0, 0, application.data.width, application.data.height)
|
|
93
137
|
end
|
|
138
|
+
engine.root = application
|
|
94
139
|
zeebo_module.require(std, application, engine)
|
|
95
140
|
:package('@memory', engine_raw_memory)
|
|
96
|
-
:package('@game', engine_game,
|
|
141
|
+
:package('@game', engine_game, cfg_system)
|
|
97
142
|
:package('@math', engine_math)
|
|
98
143
|
:package('@array', engine_array)
|
|
99
144
|
:package('@key', engine_key, {})
|
|
100
145
|
:package('@draw.fps', engine_draw_fps)
|
|
101
146
|
:package('@draw.text', engine_draw_text, cfg_text)
|
|
102
|
-
:package('@draw.poly', engine_draw_poly,
|
|
147
|
+
:package('@draw.poly', engine_draw_poly, cfg_poly)
|
|
103
148
|
:package('@color', color)
|
|
104
149
|
:package('math', engine_math.clib)
|
|
105
150
|
:package('math.random', engine_math.clib_random)
|
|
106
|
-
:package('http', engine_http,
|
|
107
|
-
:package('
|
|
108
|
-
:package('
|
|
109
|
-
:package('
|
|
110
|
-
:package('
|
|
151
|
+
:package('http', engine_http, cfg_http)
|
|
152
|
+
:package('base64', engine_encoder, cfg_base64)
|
|
153
|
+
:package('json', engine_encoder, cfg_json)
|
|
154
|
+
:package('xml', engine_encoder, cfg_xml)
|
|
155
|
+
:package('i18n', engine_i18n, cfg_system)
|
|
156
|
+
:package('hash', engine_hash, cfg_system)
|
|
157
|
+
:package('media', engine_media, cfg_media)
|
|
111
158
|
:run()
|
|
112
159
|
application.data.width, std.app.width = width, width
|
|
113
160
|
application.data.height, std.app.height = height, height
|
|
114
161
|
std.app.title(application.meta.title..' - '..application.meta.version)
|
|
115
|
-
engine.root = application
|
|
116
162
|
engine.current = application
|
|
117
163
|
application.callbacks.init(std, application.data)
|
|
118
164
|
end
|
|
@@ -126,13 +172,13 @@ version=version
|
|
|
126
172
|
}
|
|
127
173
|
return P
|
|
128
174
|
end
|
|
129
|
-
|
|
130
|
-
return '0.0.
|
|
175
|
+
src_version_561fa16ca630 = function()
|
|
176
|
+
return '0.0.18'
|
|
131
177
|
end
|
|
132
178
|
--
|
|
133
|
-
|
|
134
|
-
local zeebo_pipeline =
|
|
135
|
-
local application_default =
|
|
179
|
+
src_lib_common_module_561fa16cab70 = function()
|
|
180
|
+
local zeebo_pipeline = src_lib_util_pipeline_561fa16c26b0()
|
|
181
|
+
local application_default = src_lib_object_root_561fa16cb030()
|
|
136
182
|
local function default(application, defaults)
|
|
137
183
|
if not application then return nil end
|
|
138
184
|
local index = 1
|
|
@@ -330,7 +376,7 @@ require = require
|
|
|
330
376
|
return P
|
|
331
377
|
end
|
|
332
378
|
--
|
|
333
|
-
|
|
379
|
+
src_lib_engine_api_encoder_561fa16cb2c0 = function()
|
|
334
380
|
local function install(std, engine, library, name)
|
|
335
381
|
std = std or {}
|
|
336
382
|
std[name] = {
|
|
@@ -345,8 +391,8 @@ install=install
|
|
|
345
391
|
return P
|
|
346
392
|
end
|
|
347
393
|
--
|
|
348
|
-
|
|
349
|
-
local util_decorator =
|
|
394
|
+
src_lib_engine_api_app_561fa16cff00 = function()
|
|
395
|
+
local util_decorator = src_lib_util_decorator_561fa16bfce0()
|
|
350
396
|
local function reset(std, engine)
|
|
351
397
|
if std.node then
|
|
352
398
|
std.bus.emit('exit')
|
|
@@ -377,7 +423,7 @@ end)
|
|
|
377
423
|
std.app.title = util_decorator.prefix1(config.set_title, title)
|
|
378
424
|
std.app.exit = util_decorator.prefix1(std, exit)
|
|
379
425
|
std.app.reset = util_decorator.prefix2(std, engine, reset)
|
|
380
|
-
std.app.get_fps = config.
|
|
426
|
+
std.app.get_fps = config.get_fps
|
|
381
427
|
return std.app
|
|
382
428
|
end
|
|
383
429
|
local P = {
|
|
@@ -386,7 +432,7 @@ install=install
|
|
|
386
432
|
return P
|
|
387
433
|
end
|
|
388
434
|
--
|
|
389
|
-
|
|
435
|
+
src_lib_engine_api_hash_561fa16d0530 = function()
|
|
390
436
|
local function djb2(digest)
|
|
391
437
|
local index = 1
|
|
392
438
|
local hash = 5381
|
|
@@ -399,27 +445,12 @@ hash = string.format('%08x', hash)
|
|
|
399
445
|
hash = tonumber(hash:sub(#hash - 7), 16)
|
|
400
446
|
return hash
|
|
401
447
|
end
|
|
402
|
-
local function
|
|
403
|
-
local
|
|
404
|
-
local digest = ''
|
|
405
|
-
while index <= #all_your_secrets do
|
|
406
|
-
local value = all_your_secrets[index]
|
|
407
|
-
if type(value) == 'function' then
|
|
408
|
-
digest = digest..tostring(value())
|
|
409
|
-
else
|
|
410
|
-
digest = digest..tostring(value)
|
|
411
|
-
end
|
|
412
|
-
index = index + 1
|
|
413
|
-
end
|
|
414
|
-
return djb2(digest)
|
|
415
|
-
end
|
|
416
|
-
local function install(std, engine, all_your_secrets)
|
|
417
|
-
local id = fingerprint(all_your_secrets or {'not secret!'})
|
|
448
|
+
local function install(std, engine, cfg_system)
|
|
449
|
+
local id = djb2(cfg_system.get_secret())
|
|
418
450
|
std = std or {}
|
|
419
451
|
std.hash = std.hash or {}
|
|
420
452
|
std.hash.djb2 = djb2
|
|
421
453
|
std.hash.fingerprint = function() return id end
|
|
422
|
-
return {hash=std.hash}
|
|
423
454
|
end
|
|
424
455
|
local P = {
|
|
425
456
|
install = install
|
|
@@ -427,8 +458,8 @@ install = install
|
|
|
427
458
|
return P
|
|
428
459
|
end
|
|
429
460
|
--
|
|
430
|
-
|
|
431
|
-
local zeebo_pipeline =
|
|
461
|
+
src_lib_engine_api_http_561fa16d0b50 = function()
|
|
462
|
+
local zeebo_pipeline = src_lib_util_pipeline_561fa16c26b0()
|
|
432
463
|
local function fast(self)
|
|
433
464
|
self.speed = '_fast'
|
|
434
465
|
return self
|
|
@@ -457,7 +488,7 @@ local function failed(self, handler_func)
|
|
|
457
488
|
self.failed_handler = handler_func
|
|
458
489
|
return self
|
|
459
490
|
end
|
|
460
|
-
local function
|
|
491
|
+
local function http_error(self, handler_func)
|
|
461
492
|
self.error_handler = handler_func
|
|
462
493
|
return self
|
|
463
494
|
end
|
|
@@ -488,7 +519,7 @@ param = param,
|
|
|
488
519
|
header = header,
|
|
489
520
|
success = success,
|
|
490
521
|
failed = failed,
|
|
491
|
-
error =
|
|
522
|
+
error = http_error,
|
|
492
523
|
run = zeebo_pipeline.run,
|
|
493
524
|
protocol_handler = protocol_handler
|
|
494
525
|
}
|
|
@@ -529,7 +560,10 @@ return self
|
|
|
529
560
|
end
|
|
530
561
|
end
|
|
531
562
|
local function install(std, engine, protocol)
|
|
532
|
-
local protocol_handler = protocol.handler
|
|
563
|
+
local protocol_handler = protocol and protocol.handler
|
|
564
|
+
if not protocol_handler then
|
|
565
|
+
error('missing protocol handler')
|
|
566
|
+
end
|
|
533
567
|
std.http = std.http or {}
|
|
534
568
|
std.http.get=request('GET', std, engine, protocol_handler)
|
|
535
569
|
std.http.head=request('HEAD', std, engine, protocol_handler)
|
|
@@ -550,7 +584,7 @@ install=install
|
|
|
550
584
|
return P
|
|
551
585
|
end
|
|
552
586
|
--
|
|
553
|
-
|
|
587
|
+
src_lib_engine_api_i18n_561fa16d10f0 = function()
|
|
554
588
|
local language = 'en-US'
|
|
555
589
|
local language_default = 'en-US'
|
|
556
590
|
local language_list = {}
|
|
@@ -607,21 +641,24 @@ return function (x, y, text, a, b, c)
|
|
|
607
641
|
return func(x, y, get_text(text), a, b, c)
|
|
608
642
|
end
|
|
609
643
|
end
|
|
610
|
-
local function
|
|
611
|
-
std.bus.listen('ret_i18n', function(result)
|
|
612
|
-
update_languages(result)
|
|
613
|
-
end)
|
|
614
|
-
std.bus.emit_next('i18n')
|
|
615
|
-
end
|
|
616
|
-
local function install(std, engine, system_language)
|
|
644
|
+
local function install(std, engine, cfg)
|
|
617
645
|
if not (std and std.text and std.text.print) then
|
|
618
646
|
error('missing draw text')
|
|
619
647
|
end
|
|
620
648
|
local old_put = std.text.put
|
|
621
649
|
local old_print = std.text.print
|
|
622
650
|
local old_print_ex = std.text.print_ex
|
|
623
|
-
|
|
624
|
-
|
|
651
|
+
local callback_lang = function(result)
|
|
652
|
+
update_languages(result)
|
|
653
|
+
if cfg and cfg.get_language then
|
|
654
|
+
set_language(cfg.get_language())
|
|
655
|
+
end
|
|
656
|
+
end
|
|
657
|
+
if not std.node and engine.root.callbacks.i18n then
|
|
658
|
+
callback_lang(engine.root.callbacks.i18n())
|
|
659
|
+
else
|
|
660
|
+
std.bus.listen('ret_i18n', callback_lang)
|
|
661
|
+
std.bus.emit_next('i18n')
|
|
625
662
|
end
|
|
626
663
|
std.text.put = decorator_draw_text(old_put)
|
|
627
664
|
std.text.print = decorator_draw_text(old_print)
|
|
@@ -632,23 +669,14 @@ std.i18n.get_language = get_language
|
|
|
632
669
|
std.i18n.set_language = set_language
|
|
633
670
|
std.i18n.back = back_language
|
|
634
671
|
std.i18n.next = next_language
|
|
635
|
-
return {
|
|
636
|
-
std={
|
|
637
|
-
i18n=std.i18n,
|
|
638
|
-
draw={
|
|
639
|
-
text=std.draw.text
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
672
|
end
|
|
644
673
|
local P = {
|
|
645
|
-
event_bus=event_bus,
|
|
646
674
|
install=install
|
|
647
675
|
}
|
|
648
676
|
return P
|
|
649
677
|
end
|
|
650
678
|
--
|
|
651
|
-
|
|
679
|
+
src_lib_engine_api_key_561fa16d1700 = function()
|
|
652
680
|
local function real_key(std, engine, rkey, rvalue)
|
|
653
681
|
local value = rvalue == 1 or rvalue == true
|
|
654
682
|
local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
|
|
@@ -686,7 +714,7 @@ install = install
|
|
|
686
714
|
return P
|
|
687
715
|
end
|
|
688
716
|
--
|
|
689
|
-
|
|
717
|
+
src_lib_engine_api_math_561fa16c5900 = function()
|
|
690
718
|
local function abs(value)
|
|
691
719
|
if value < 0 then
|
|
692
720
|
return -value
|
|
@@ -705,10 +733,6 @@ end
|
|
|
705
733
|
local function clamp2(value, value_min, value_max)
|
|
706
734
|
return (value - value_min) % (value_max - value_min + 1) + value_min
|
|
707
735
|
end
|
|
708
|
-
local function cycle(passed, duration)
|
|
709
|
-
local endtime = (passed) % duration
|
|
710
|
-
return ((endtime == 0 and (passed % (duration * 2)) or endtime)) / duration
|
|
711
|
-
end
|
|
712
736
|
local function dir(value, alpha)
|
|
713
737
|
alpha = alpha or 0
|
|
714
738
|
if value < -alpha then
|
|
@@ -720,11 +744,15 @@ return 0
|
|
|
720
744
|
end
|
|
721
745
|
end
|
|
722
746
|
local function dis(x1,y1,x2,y2)
|
|
723
|
-
|
|
747
|
+
local sqr = 1/2
|
|
748
|
+
return ((x2 - x1) ^ 2 + (y2 - y1) ^ 2) ^ (sqr ~= 0 and sqr or 1)
|
|
724
749
|
end
|
|
725
750
|
local function dis2(x1,y1,x2,y2)
|
|
726
751
|
return (x2 - x1) ^ 2 + (y2 - y1) ^ 2
|
|
727
752
|
end
|
|
753
|
+
local function dis3(x1,y1,x2,y2)
|
|
754
|
+
return abs(x1 - x2) + abs(x2 - y2)
|
|
755
|
+
end
|
|
728
756
|
local function lerp(a, b, alpha)
|
|
729
757
|
return a + alpha * ( b - a )
|
|
730
758
|
end
|
|
@@ -765,31 +793,20 @@ index = index + 1
|
|
|
765
793
|
end
|
|
766
794
|
return min_value
|
|
767
795
|
end
|
|
768
|
-
local function saw(value)
|
|
769
|
-
if value < 0.25 then
|
|
770
|
-
return value * 4
|
|
771
|
-
elseif value < 0.50 then
|
|
772
|
-
return 1 - ((value - 0.25) * 4)
|
|
773
|
-
elseif value < 0.75 then
|
|
774
|
-
return ((value - 0.50) * 4) * (-1)
|
|
775
|
-
end
|
|
776
|
-
return ((value - 0.75) * 4) - 1
|
|
777
|
-
end
|
|
778
796
|
local function install(std)
|
|
779
797
|
std = std or {}
|
|
780
798
|
std.math = std.math or {}
|
|
781
799
|
std.math.abs=abs
|
|
782
800
|
std.math.clamp=clamp
|
|
783
801
|
std.math.clamp2=clamp2
|
|
784
|
-
std.math.cycle=cycle
|
|
785
802
|
std.math.dir=dir
|
|
786
803
|
std.math.dis=dis
|
|
787
804
|
std.math.dis2=dis2
|
|
805
|
+
std.math.dis3=dis3
|
|
788
806
|
std.math.lerp=lerp
|
|
789
807
|
std.math.map=map
|
|
790
808
|
std.math.max=max
|
|
791
809
|
std.math.min=min
|
|
792
|
-
std.math.saw=saw
|
|
793
810
|
return std.math
|
|
794
811
|
end
|
|
795
812
|
local function install_clib(std)
|
|
@@ -844,8 +861,8 @@ install = install_clib_random
|
|
|
844
861
|
return P;
|
|
845
862
|
end
|
|
846
863
|
--
|
|
847
|
-
|
|
848
|
-
local util_decorator =
|
|
864
|
+
src_lib_engine_api_array_561fa16c1450 = function()
|
|
865
|
+
local util_decorator = src_lib_util_decorator_561fa16bfce0()
|
|
849
866
|
local function array_map(array, func)
|
|
850
867
|
local res = {}
|
|
851
868
|
local index = 1
|
|
@@ -955,17 +972,6 @@ index = index + 1
|
|
|
955
972
|
end
|
|
956
973
|
return true
|
|
957
974
|
end
|
|
958
|
-
local function array_compare(array, func)
|
|
959
|
-
local index = 1
|
|
960
|
-
local length = #array
|
|
961
|
-
while index < length do
|
|
962
|
-
if not func(array[index], array[index + 1]) then
|
|
963
|
-
return false
|
|
964
|
-
end
|
|
965
|
-
index = index + 1
|
|
966
|
-
end
|
|
967
|
-
return true
|
|
968
|
-
end
|
|
969
975
|
local function array_pipeline(std, array)
|
|
970
976
|
local decorator_iterator = function(func)
|
|
971
977
|
return function(self, func2, extra)
|
|
@@ -991,7 +997,6 @@ first = decorator_reduce(array_first),
|
|
|
991
997
|
last = decorator_reduce(array_last),
|
|
992
998
|
some = decorator_reduce(array_some),
|
|
993
999
|
every = decorator_reduce(array_every),
|
|
994
|
-
compare = decorator_reduce(array_compare),
|
|
995
1000
|
table = function(self) return self.array end,
|
|
996
1001
|
json = function(self) return std.json.encode(self.array) end
|
|
997
1002
|
}
|
|
@@ -1008,7 +1013,6 @@ lib.first = array_first
|
|
|
1008
1013
|
lib.last = array_last
|
|
1009
1014
|
lib.some = array_some
|
|
1010
1015
|
lib.every = array_every
|
|
1011
|
-
lib.compare = array_compare
|
|
1012
1016
|
lib.from = util_decorator.prefix1(std, array_pipeline)
|
|
1013
1017
|
std[name] = lib
|
|
1014
1018
|
end
|
|
@@ -1018,7 +1022,76 @@ install = install
|
|
|
1018
1022
|
return P
|
|
1019
1023
|
end
|
|
1020
1024
|
--
|
|
1021
|
-
|
|
1025
|
+
src_lib_engine_api_media_561fa16cce10 = function()
|
|
1026
|
+
local util_decorator = src_lib_util_decorator_561fa16bfce0()
|
|
1027
|
+
local function media_add(func, self, src)
|
|
1028
|
+
func(self.id - 1, src)
|
|
1029
|
+
return self
|
|
1030
|
+
end
|
|
1031
|
+
local function media_play(func, self)
|
|
1032
|
+
func(self.id - 1)
|
|
1033
|
+
return self
|
|
1034
|
+
end
|
|
1035
|
+
local function media_pause(func, self)
|
|
1036
|
+
func(self.id - 1)
|
|
1037
|
+
return self
|
|
1038
|
+
end
|
|
1039
|
+
local function media_resize(func, self, width, height)
|
|
1040
|
+
func(self.id - 1, width, height)
|
|
1041
|
+
return self
|
|
1042
|
+
end
|
|
1043
|
+
local function media_position(func, self, pos_x, pos_y)
|
|
1044
|
+
func(self.id - 1, pos_x, pos_y)
|
|
1045
|
+
return self
|
|
1046
|
+
end
|
|
1047
|
+
local channels = {}
|
|
1048
|
+
local function media_channel(std, handler)
|
|
1049
|
+
return function(id)
|
|
1050
|
+
id = id or 1
|
|
1051
|
+
if 0 >= id or id > 8 then
|
|
1052
|
+
error('Please, do not do that!')
|
|
1053
|
+
end
|
|
1054
|
+
if not channels[id] then
|
|
1055
|
+
channels[id] = {
|
|
1056
|
+
id = id,
|
|
1057
|
+
add = util_decorator.prefix1(handler.load, media_add),
|
|
1058
|
+
play = util_decorator.prefix1(handler.play, media_play),
|
|
1059
|
+
pause = util_decorator.prefix1(handler.pause, media_pause),
|
|
1060
|
+
resize = util_decorator.prefix1(handler.resize, media_resize),
|
|
1061
|
+
position = util_decorator.prefix1(handler.position, media_position)
|
|
1062
|
+
}
|
|
1063
|
+
if std.node then
|
|
1064
|
+
channels[id].node = std.node.load({})
|
|
1065
|
+
channels[id].apply = function()
|
|
1066
|
+
local node = channels[id].node
|
|
1067
|
+
local depth = 0
|
|
1068
|
+
local offset_x = 0
|
|
1069
|
+
local offset_y = 0
|
|
1070
|
+
while node and depth < 100 do
|
|
1071
|
+
offset_x = offset_x + node.config.offset_x
|
|
1072
|
+
offset_y = offset_y + node.config.offset_y
|
|
1073
|
+
node = node.config.parent
|
|
1074
|
+
depth = depth + 1
|
|
1075
|
+
end
|
|
1076
|
+
media_position(handler.position, channels[id], offset_x, offset_y)
|
|
1077
|
+
media_resize(handler.resize, channels[id], channels[id].node.data.width, channels[id].node.data.height)
|
|
1078
|
+
end
|
|
1079
|
+
end
|
|
1080
|
+
end
|
|
1081
|
+
return channels[id]
|
|
1082
|
+
end
|
|
1083
|
+
end
|
|
1084
|
+
local function install(std, engine, handlers)
|
|
1085
|
+
std.media = std.media or {}
|
|
1086
|
+
std.media.video = media_channel(std, handlers)
|
|
1087
|
+
end
|
|
1088
|
+
local P = {
|
|
1089
|
+
install=install
|
|
1090
|
+
}
|
|
1091
|
+
return P
|
|
1092
|
+
end
|
|
1093
|
+
--
|
|
1094
|
+
src_lib_engine_draw_fps_561fa16c6900 = function()
|
|
1022
1095
|
local function draw_fps(std, engine, show, pos_x, pos_y)
|
|
1023
1096
|
if show < 1 then return end
|
|
1024
1097
|
local x = engine.current.config.offset_x + pos_x
|
|
@@ -1035,19 +1108,19 @@ if show >= 3 then
|
|
|
1035
1108
|
std.draw.rect(0, x + 96, y, 40, 24)
|
|
1036
1109
|
end
|
|
1037
1110
|
std.draw.color(0x000000FF)
|
|
1038
|
-
std.
|
|
1111
|
+
std.text.font_size(16)
|
|
1039
1112
|
if show >= 3 then
|
|
1040
1113
|
local floor = std.math.floor or math.floor or function() return 'XX' end
|
|
1041
1114
|
local fps = floor((1/std.delta) * 1000)
|
|
1042
|
-
std.
|
|
1115
|
+
std.text.print(x + s, y, fps)
|
|
1043
1116
|
s = s + 46
|
|
1044
1117
|
end
|
|
1045
1118
|
if show >= 1 then
|
|
1046
|
-
std.
|
|
1119
|
+
std.text.print(x + s, y, engine.fps)
|
|
1047
1120
|
s = s + 46
|
|
1048
1121
|
end
|
|
1049
1122
|
if show >= 2 then
|
|
1050
|
-
std.
|
|
1123
|
+
std.text.print(x + s, y, engine.root.config.fps_max)
|
|
1051
1124
|
s = s + 46
|
|
1052
1125
|
end
|
|
1053
1126
|
end
|
|
@@ -1070,8 +1143,8 @@ install=install
|
|
|
1070
1143
|
return P
|
|
1071
1144
|
end
|
|
1072
1145
|
--
|
|
1073
|
-
|
|
1074
|
-
local util_decorator =
|
|
1146
|
+
src_lib_engine_draw_text_561fa16c8d50 = function()
|
|
1147
|
+
local util_decorator = src_lib_util_decorator_561fa16bfce0()
|
|
1075
1148
|
local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
|
|
1076
1149
|
size = size or 2
|
|
1077
1150
|
local hem = engine.current.data.width / 80
|
|
@@ -1098,7 +1171,7 @@ install=install
|
|
|
1098
1171
|
return P
|
|
1099
1172
|
end
|
|
1100
1173
|
--
|
|
1101
|
-
|
|
1174
|
+
src_lib_engine_draw_poly_561fa16ca270 = function()
|
|
1102
1175
|
local function decorator_poo(object, func)
|
|
1103
1176
|
if not object or not func then return func end
|
|
1104
1177
|
return function(a, b, c, d)
|
|
@@ -1205,7 +1278,7 @@ install=install
|
|
|
1205
1278
|
return P
|
|
1206
1279
|
end
|
|
1207
1280
|
--
|
|
1208
|
-
|
|
1281
|
+
src_lib_engine_raw_memory_561fa16caab0 = function()
|
|
1209
1282
|
local memory_dict_unload = {}
|
|
1210
1283
|
local memory_dict = {}
|
|
1211
1284
|
local memory_list = {}
|
|
@@ -1254,7 +1327,7 @@ install=install
|
|
|
1254
1327
|
return P
|
|
1255
1328
|
end
|
|
1256
1329
|
--
|
|
1257
|
-
|
|
1330
|
+
src_lib_object_root_561fa16cb030 = function()
|
|
1258
1331
|
local P = {
|
|
1259
1332
|
data={
|
|
1260
1333
|
width=1280,
|
|
@@ -1273,7 +1346,7 @@ config = {
|
|
|
1273
1346
|
offset_x = 0,
|
|
1274
1347
|
offset_y = 0,
|
|
1275
1348
|
require = '',
|
|
1276
|
-
fps_max =
|
|
1349
|
+
fps_max = 60,
|
|
1277
1350
|
fps_show = 0,
|
|
1278
1351
|
fps_drop = 5,
|
|
1279
1352
|
fps_time = 5
|
|
@@ -1284,7 +1357,7 @@ callbacks={
|
|
|
1284
1357
|
return P;
|
|
1285
1358
|
end
|
|
1286
1359
|
--
|
|
1287
|
-
|
|
1360
|
+
src_lib_object_color_561fa16d0260 = function()
|
|
1288
1361
|
local white = 0xFFFFFFFF
|
|
1289
1362
|
local lightgray = 0xC8CCCCFF
|
|
1290
1363
|
local gray = 0x828282FF
|
|
@@ -1346,7 +1419,7 @@ install = install
|
|
|
1346
1419
|
return P
|
|
1347
1420
|
end
|
|
1348
1421
|
--
|
|
1349
|
-
|
|
1422
|
+
src_lib_object_std_561fa16c9dc0 = function()
|
|
1350
1423
|
local P = {
|
|
1351
1424
|
milis = 0,
|
|
1352
1425
|
delta = 0,
|
|
@@ -1407,7 +1480,7 @@ d=false
|
|
|
1407
1480
|
return P;
|
|
1408
1481
|
end
|
|
1409
1482
|
--
|
|
1410
|
-
|
|
1483
|
+
src_lib_util_pipeline_561fa16c26b0 = function()
|
|
1411
1484
|
local function pipe(self)
|
|
1412
1485
|
return function()
|
|
1413
1486
|
self:run()
|
|
@@ -1457,7 +1530,7 @@ run=run
|
|
|
1457
1530
|
return P
|
|
1458
1531
|
end
|
|
1459
1532
|
--
|
|
1460
|
-
|
|
1533
|
+
src_lib_util_decorator_561fa16bfce0 = function()
|
|
1461
1534
|
local function decorator_prefix3(zig, zag, zom, func)
|
|
1462
1535
|
return function (a, b, c, d, e, f)
|
|
1463
1536
|
return func(zig, zag, zom, a, b, c, d, e, f)
|
|
@@ -1507,4 +1580,4 @@ prefix1 = decorator_prefix1
|
|
|
1507
1580
|
return P
|
|
1508
1581
|
end
|
|
1509
1582
|
--
|
|
1510
|
-
return
|
|
1583
|
+
return main_561fa16ca3f0()
|