@gamely/gly-engine-lite 0.0.16 → 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.
Files changed (2) hide show
  1. package/dist/main.lua +382 -131
  2. package/package.json +1 -1
package/dist/main.lua CHANGED
@@ -1,48 +1,94 @@
1
1
  local math = ((function() local x, y = pcall(require, 'math'); return x and y end)()) or _G.math
2
- local core_src_version = nil
3
- local core_src_lib_common_module = nil
4
- local core_src_lib_engine_api_encoder = nil
5
- local core_src_lib_engine_api_app = nil
6
- local core_src_lib_engine_api_hash = nil
7
- local core_src_lib_engine_api_http = nil
8
- local core_src_lib_engine_api_i18n = nil
9
- local core_src_lib_engine_api_key = nil
10
- local core_src_lib_engine_api_math = nil
11
- local core_src_lib_engine_draw_fps = nil
12
- local core_src_lib_engine_draw_text = nil
13
- local core_src_lib_engine_draw_poly = nil
14
- local core_src_lib_engine_raw_memory = nil
15
- local core_src_lib_object_root = nil
16
- local core_src_lib_object_color = nil
17
- local core_src_lib_object_std = nil
18
- local core_src_lib_util_pipeline = nil
19
- local core_src_lib_util_decorator = nil
20
- local function main()
21
- local version = core_src_version()
22
- local zeebo_module = core_src_lib_common_module()
23
- local engine_encoder = core_src_lib_engine_api_encoder()
24
- local engine_game = core_src_lib_engine_api_app()
25
- local engine_hash = core_src_lib_engine_api_hash()
26
- local engine_http = core_src_lib_engine_api_http()
27
- local engine_i18n = core_src_lib_engine_api_i18n()
28
- local engine_key = core_src_lib_engine_api_key()
29
- local engine_math = core_src_lib_engine_api_math()
30
- local engine_draw_fps = core_src_lib_engine_draw_fps()
31
- local engine_draw_text = core_src_lib_engine_draw_text()
32
- local engine_draw_poly = core_src_lib_engine_draw_poly()
33
- local engine_raw_memory = core_src_lib_engine_raw_memory()
34
- local application_default = core_src_lib_object_root()
35
- local color = core_src_lib_object_color()
36
- local std = core_src_lib_object_std()
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()
37
41
  local application = application_default
38
42
  local engine = {
39
43
  keyboard = function(a, b, c, d) end,
40
44
  current = application_default,
41
45
  root = application_default
42
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
+ }
43
73
  local cfg_text = {
44
74
  font_previous = native_text_font_previous
45
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
+ }
46
92
  function native_callback_loop(dt)
47
93
  std.milis = std.milis + dt
48
94
  std.delta = dt
@@ -89,27 +135,30 @@ std.text.font_default=native_text_font_default
89
135
  std.draw.clear=function(tint)
90
136
  native_draw_clear(tint, 0, 0, application.data.width, application.data.height)
91
137
  end
138
+ engine.root = application
92
139
  zeebo_module.require(std, application, engine)
93
140
  :package('@memory', engine_raw_memory)
94
- :package('@game', engine_game, native_dict_game)
141
+ :package('@game', engine_game, cfg_system)
95
142
  :package('@math', engine_math)
143
+ :package('@array', engine_array)
96
144
  :package('@key', engine_key, {})
97
145
  :package('@draw.fps', engine_draw_fps)
98
146
  :package('@draw.text', engine_draw_text, cfg_text)
99
- :package('@draw.poly', engine_draw_poly, native_dict_poly)
147
+ :package('@draw.poly', engine_draw_poly, cfg_poly)
100
148
  :package('@color', color)
101
149
  :package('math', engine_math.clib)
102
150
  :package('math.random', engine_math.clib_random)
103
- :package('http', engine_http, native_dict_http)
104
- :package('json', engine_encoder, native_dict_json)
105
- :package('xml', engine_encoder, native_dict_xml)
106
- :package('i18n', engine_i18n, native_get_system_lang)
107
- :package('hash', engine_hash, native_dict_secret)
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)
108
158
  :run()
109
159
  application.data.width, std.app.width = width, width
110
160
  application.data.height, std.app.height = height, height
111
161
  std.app.title(application.meta.title..' - '..application.meta.version)
112
- engine.root = application
113
162
  engine.current = application
114
163
  application.callbacks.init(std, application.data)
115
164
  end
@@ -123,13 +172,13 @@ version=version
123
172
  }
124
173
  return P
125
174
  end
126
- core_src_version = function()
127
- return '0.0.16'
175
+ src_version_561fa16ca630 = function()
176
+ return '0.0.18'
128
177
  end
129
178
  --
130
- core_src_lib_common_module = function()
131
- local zeebo_pipeline = core_src_lib_util_pipeline()
132
- local application_default = core_src_lib_object_root()
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()
133
182
  local function default(application, defaults)
134
183
  if not application then return nil end
135
184
  local index = 1
@@ -243,9 +292,9 @@ if not system and not self.lib_required[name] then return end
243
292
  if not system and self.engine.lib_installed[name] then return end
244
293
  if system and self.engine.stdlib_installed[name] then return end
245
294
  local try_install = function()
246
- module.install(self.std, self.engine, custom, module_name)
295
+ module.install(self.std, self.engine, custom, name)
247
296
  if module.event_bus then
248
- module.event_bus(self.std, self.engine, custom, module_name)
297
+ module.event_bus(self.std, self.engine, custom, name)
249
298
  end
250
299
  end
251
300
  local ok, msg = pcall(try_install)
@@ -327,7 +376,7 @@ require = require
327
376
  return P
328
377
  end
329
378
  --
330
- core_src_lib_engine_api_encoder = function()
379
+ src_lib_engine_api_encoder_561fa16cb2c0 = function()
331
380
  local function install(std, engine, library, name)
332
381
  std = std or {}
333
382
  std[name] = {
@@ -342,8 +391,8 @@ install=install
342
391
  return P
343
392
  end
344
393
  --
345
- core_src_lib_engine_api_app = function()
346
- local util_decorator = core_src_lib_util_decorator()
394
+ src_lib_engine_api_app_561fa16cff00 = function()
395
+ local util_decorator = src_lib_util_decorator_561fa16bfce0()
347
396
  local function reset(std, engine)
348
397
  if std.node then
349
398
  std.bus.emit('exit')
@@ -374,7 +423,7 @@ end)
374
423
  std.app.title = util_decorator.prefix1(config.set_title, title)
375
424
  std.app.exit = util_decorator.prefix1(std, exit)
376
425
  std.app.reset = util_decorator.prefix2(std, engine, reset)
377
- std.app.get_fps = config.fps
426
+ std.app.get_fps = config.get_fps
378
427
  return std.app
379
428
  end
380
429
  local P = {
@@ -383,7 +432,7 @@ install=install
383
432
  return P
384
433
  end
385
434
  --
386
- core_src_lib_engine_api_hash = function()
435
+ src_lib_engine_api_hash_561fa16d0530 = function()
387
436
  local function djb2(digest)
388
437
  local index = 1
389
438
  local hash = 5381
@@ -396,27 +445,12 @@ hash = string.format('%08x', hash)
396
445
  hash = tonumber(hash:sub(#hash - 7), 16)
397
446
  return hash
398
447
  end
399
- local function fingerprint(all_your_secrets)
400
- local index = 1
401
- local digest = ''
402
- while index <= #all_your_secrets do
403
- local value = all_your_secrets[index]
404
- if type(value) == 'function' then
405
- digest = digest..tostring(value())
406
- else
407
- digest = digest..tostring(value)
408
- end
409
- index = index + 1
410
- end
411
- return djb2(digest)
412
- end
413
- local function install(std, engine, all_your_secrets)
414
- 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())
415
450
  std = std or {}
416
451
  std.hash = std.hash or {}
417
452
  std.hash.djb2 = djb2
418
453
  std.hash.fingerprint = function() return id end
419
- return {hash=std.hash}
420
454
  end
421
455
  local P = {
422
456
  install = install
@@ -424,8 +458,8 @@ install = install
424
458
  return P
425
459
  end
426
460
  --
427
- core_src_lib_engine_api_http = function()
428
- local zeebo_pipeline = core_src_lib_util_pipeline()
461
+ src_lib_engine_api_http_561fa16d0b50 = function()
462
+ local zeebo_pipeline = src_lib_util_pipeline_561fa16c26b0()
429
463
  local function fast(self)
430
464
  self.speed = '_fast'
431
465
  return self
@@ -454,7 +488,7 @@ local function failed(self, handler_func)
454
488
  self.failed_handler = handler_func
455
489
  return self
456
490
  end
457
- local function error(self, handler_func)
491
+ local function http_error(self, handler_func)
458
492
  self.error_handler = handler_func
459
493
  return self
460
494
  end
@@ -485,7 +519,7 @@ param = param,
485
519
  header = header,
486
520
  success = success,
487
521
  failed = failed,
488
- error = error,
522
+ error = http_error,
489
523
  run = zeebo_pipeline.run,
490
524
  protocol_handler = protocol_handler
491
525
  }
@@ -526,7 +560,10 @@ return self
526
560
  end
527
561
  end
528
562
  local function install(std, engine, protocol)
529
- 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
530
567
  std.http = std.http or {}
531
568
  std.http.get=request('GET', std, engine, protocol_handler)
532
569
  std.http.head=request('HEAD', std, engine, protocol_handler)
@@ -547,7 +584,7 @@ install=install
547
584
  return P
548
585
  end
549
586
  --
550
- core_src_lib_engine_api_i18n = function()
587
+ src_lib_engine_api_i18n_561fa16d10f0 = function()
551
588
  local language = 'en-US'
552
589
  local language_default = 'en-US'
553
590
  local language_list = {}
@@ -604,21 +641,24 @@ return function (x, y, text, a, b, c)
604
641
  return func(x, y, get_text(text), a, b, c)
605
642
  end
606
643
  end
607
- local function event_bus(std, engine)
608
- std.bus.listen('ret_i18n', function(result)
609
- update_languages(result)
610
- end)
611
- std.bus.emit_next('i18n')
612
- end
613
- local function install(std, engine, system_language)
644
+ local function install(std, engine, cfg)
614
645
  if not (std and std.text and std.text.print) then
615
646
  error('missing draw text')
616
647
  end
617
648
  local old_put = std.text.put
618
649
  local old_print = std.text.print
619
650
  local old_print_ex = std.text.print_ex
620
- if system_language then
621
- set_language(system_language())
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')
622
662
  end
623
663
  std.text.put = decorator_draw_text(old_put)
624
664
  std.text.print = decorator_draw_text(old_print)
@@ -629,23 +669,14 @@ std.i18n.get_language = get_language
629
669
  std.i18n.set_language = set_language
630
670
  std.i18n.back = back_language
631
671
  std.i18n.next = next_language
632
- return {
633
- std={
634
- i18n=std.i18n,
635
- draw={
636
- text=std.draw.text
637
- }
638
- }
639
- }
640
672
  end
641
673
  local P = {
642
- event_bus=event_bus,
643
674
  install=install
644
675
  }
645
676
  return P
646
677
  end
647
678
  --
648
- core_src_lib_engine_api_key = function()
679
+ src_lib_engine_api_key_561fa16d1700 = function()
649
680
  local function real_key(std, engine, rkey, rvalue)
650
681
  local value = rvalue == 1 or rvalue == true
651
682
  local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
@@ -683,7 +714,7 @@ install = install
683
714
  return P
684
715
  end
685
716
  --
686
- core_src_lib_engine_api_math = function()
717
+ src_lib_engine_api_math_561fa16c5900 = function()
687
718
  local function abs(value)
688
719
  if value < 0 then
689
720
  return -value
@@ -702,10 +733,6 @@ end
702
733
  local function clamp2(value, value_min, value_max)
703
734
  return (value - value_min) % (value_max - value_min + 1) + value_min
704
735
  end
705
- local function cycle(passed, duration)
706
- local endtime = (passed) % duration
707
- return ((endtime == 0 and (passed % (duration * 2)) or endtime)) / duration
708
- end
709
736
  local function dir(value, alpha)
710
737
  alpha = alpha or 0
711
738
  if value < -alpha then
@@ -717,11 +744,15 @@ return 0
717
744
  end
718
745
  end
719
746
  local function dis(x1,y1,x2,y2)
720
- return ((x2 - x1) ^ 2 + (y2 - y1) ^ 2) ^ 0.5
747
+ local sqr = 1/2
748
+ return ((x2 - x1) ^ 2 + (y2 - y1) ^ 2) ^ (sqr ~= 0 and sqr or 1)
721
749
  end
722
750
  local function dis2(x1,y1,x2,y2)
723
751
  return (x2 - x1) ^ 2 + (y2 - y1) ^ 2
724
752
  end
753
+ local function dis3(x1,y1,x2,y2)
754
+ return abs(x1 - x2) + abs(x2 - y2)
755
+ end
725
756
  local function lerp(a, b, alpha)
726
757
  return a + alpha * ( b - a )
727
758
  end
@@ -762,31 +793,20 @@ index = index + 1
762
793
  end
763
794
  return min_value
764
795
  end
765
- local function saw(value)
766
- if value < 0.25 then
767
- return value * 4
768
- elseif value < 0.50 then
769
- return 1 - ((value - 0.25) * 4)
770
- elseif value < 0.75 then
771
- return ((value - 0.50) * 4) * (-1)
772
- end
773
- return ((value - 0.75) * 4) - 1
774
- end
775
796
  local function install(std)
776
797
  std = std or {}
777
798
  std.math = std.math or {}
778
799
  std.math.abs=abs
779
800
  std.math.clamp=clamp
780
801
  std.math.clamp2=clamp2
781
- std.math.cycle=cycle
782
802
  std.math.dir=dir
783
803
  std.math.dis=dis
784
804
  std.math.dis2=dis2
805
+ std.math.dis3=dis3
785
806
  std.math.lerp=lerp
786
807
  std.math.map=map
787
808
  std.math.max=max
788
809
  std.math.min=min
789
- std.math.saw=saw
790
810
  return std.math
791
811
  end
792
812
  local function install_clib(std)
@@ -841,7 +861,237 @@ install = install_clib_random
841
861
  return P;
842
862
  end
843
863
  --
844
- core_src_lib_engine_draw_fps = function()
864
+ src_lib_engine_api_array_561fa16c1450 = function()
865
+ local util_decorator = src_lib_util_decorator_561fa16bfce0()
866
+ local function array_map(array, func)
867
+ local res = {}
868
+ local index = 1
869
+ local length = #array
870
+ while index <= length do
871
+ res[#res + 1] = func(array[index], index)
872
+ index = index + 1
873
+ end
874
+ return res
875
+ end
876
+ local function array_filter(array, func)
877
+ func = func or (function(v) return v and v ~= 0 end)
878
+ local res = {}
879
+ local index = 1
880
+ local length = #array
881
+ while index <= length do
882
+ local value = array[index]
883
+ if func(value, index) then
884
+ res[#res + 1] = value
885
+ end
886
+ index = index + 1
887
+ end
888
+ return res
889
+ end
890
+ local function array_unique(array)
891
+ local res = {}
892
+ local index = 1
893
+ local length = #array
894
+ local setmap = {}
895
+ while index <= length do
896
+ local value = array[index]
897
+ if not setmap[value] then
898
+ res[#res + 1] = value
899
+ end
900
+ setmap[value] = true
901
+ index = index + 1
902
+ end
903
+ return res
904
+ end
905
+ local function array_foreach(array, func)
906
+ local index = 1
907
+ local length = #array
908
+ while index <= length do
909
+ func(array[index], index)
910
+ index = index + 1
911
+ end
912
+ end
913
+ local function array_reducer(array, func, value)
914
+ local index = value and 1 or 2
915
+ local length = #array
916
+ value = value or array[1]
917
+ while index <= length do
918
+ value = func(value, array[index], index)
919
+ index = index + 1
920
+ end
921
+ return value
922
+ end
923
+ local function array_index(array, func, reverse)
924
+ func = func or function() return true end
925
+ local index, inc, final = 1, 1, #array
926
+ if reverse then
927
+ index, inc, final = #array, -1, 1
928
+ end
929
+ repeat
930
+ if func(array[index], index) then
931
+ return index
932
+ end
933
+ index = index + inc
934
+ until (reverse and index < final) or (not reverse and index > final)
935
+ return nil
936
+ end
937
+ local function array_first(array, func)
938
+ local index = array_index(array, func)
939
+ if index then
940
+ return array[index]
941
+ end
942
+ return nil
943
+ end
944
+ local function array_last(array, func)
945
+ local index = array_index(array, func, true)
946
+ if index then
947
+ return array[index]
948
+ end
949
+ return nil
950
+ end
951
+ local function array_some(array, func, reverse)
952
+ local index, inc, final = 1, 1, #array
953
+ if reverse then
954
+ index, inc, final = #array, -1, 1
955
+ end
956
+ repeat
957
+ if func(array[index], index) then
958
+ return true
959
+ end
960
+ index = index + inc
961
+ until (reverse and index < final) or (not reverse and index > final)
962
+ return false
963
+ end
964
+ local function array_every(array, func)
965
+ local index = 1
966
+ local length = #array
967
+ while index <= length do
968
+ if not func(array[index], index) then
969
+ return false
970
+ end
971
+ index = index + 1
972
+ end
973
+ return true
974
+ end
975
+ local function array_pipeline(std, array)
976
+ local decorator_iterator = function(func)
977
+ return function(self, func2, extra)
978
+ self.array = func(self.array, func2, extra)
979
+ return self
980
+ end
981
+ end
982
+ local decorator_reduce = function(func, return_self)
983
+ return function(self, func2, extra)
984
+ local res = func(self.array, func2, extra)
985
+ return (return_self and self) or res
986
+ end
987
+ end
988
+ local self = {
989
+ array = array,
990
+ map = decorator_iterator(array_map),
991
+ filter = decorator_iterator(array_filter),
992
+ unique = decorator_iterator(array_unique),
993
+ each = decorator_reduce(array_foreach, true),
994
+ reducer = decorator_reduce(array_reducer),
995
+ index = decorator_reduce(array_index),
996
+ first = decorator_reduce(array_first),
997
+ last = decorator_reduce(array_last),
998
+ some = decorator_reduce(array_some),
999
+ every = decorator_reduce(array_every),
1000
+ table = function(self) return self.array end,
1001
+ json = function(self) return std.json.encode(self.array) end
1002
+ }
1003
+ return self
1004
+ end
1005
+ local function install(std, engine, library, name)
1006
+ local lib = std[name] or {}
1007
+ lib.filter = array_filter
1008
+ lib.unique = array_unique
1009
+ lib.each = array_foreach
1010
+ lib.reducer = array_reducer
1011
+ lib.index = array_index
1012
+ lib.first = array_first
1013
+ lib.last = array_last
1014
+ lib.some = array_some
1015
+ lib.every = array_every
1016
+ lib.from = util_decorator.prefix1(std, array_pipeline)
1017
+ std[name] = lib
1018
+ end
1019
+ local P = {
1020
+ install = install
1021
+ }
1022
+ return P
1023
+ end
1024
+ --
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()
845
1095
  local function draw_fps(std, engine, show, pos_x, pos_y)
846
1096
  if show < 1 then return end
847
1097
  local x = engine.current.config.offset_x + pos_x
@@ -858,19 +1108,19 @@ if show >= 3 then
858
1108
  std.draw.rect(0, x + 96, y, 40, 24)
859
1109
  end
860
1110
  std.draw.color(0x000000FF)
861
- std.draw.font('Tiresias', 16)
1111
+ std.text.font_size(16)
862
1112
  if show >= 3 then
863
1113
  local floor = std.math.floor or math.floor or function() return 'XX' end
864
1114
  local fps = floor((1/std.delta) * 1000)
865
- std.draw.text(x + s, y, fps)
1115
+ std.text.print(x + s, y, fps)
866
1116
  s = s + 46
867
1117
  end
868
1118
  if show >= 1 then
869
- std.draw.text(x + s, y, engine.fps)
1119
+ std.text.print(x + s, y, engine.fps)
870
1120
  s = s + 46
871
1121
  end
872
1122
  if show >= 2 then
873
- std.draw.text(x + s, y, engine.root.config.fps_max)
1123
+ std.text.print(x + s, y, engine.root.config.fps_max)
874
1124
  s = s + 46
875
1125
  end
876
1126
  end
@@ -893,8 +1143,8 @@ install=install
893
1143
  return P
894
1144
  end
895
1145
  --
896
- core_src_lib_engine_draw_text = function()
897
- local util_decorator = core_src_lib_util_decorator()
1146
+ src_lib_engine_draw_text_561fa16c8d50 = function()
1147
+ local util_decorator = src_lib_util_decorator_561fa16bfce0()
898
1148
  local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
899
1149
  size = size or 2
900
1150
  local hem = engine.current.data.width / 80
@@ -921,7 +1171,7 @@ install=install
921
1171
  return P
922
1172
  end
923
1173
  --
924
- core_src_lib_engine_draw_poly = function()
1174
+ src_lib_engine_draw_poly_561fa16ca270 = function()
925
1175
  local function decorator_poo(object, func)
926
1176
  if not object or not func then return func end
927
1177
  return function(a, b, c, d)
@@ -1028,7 +1278,7 @@ install=install
1028
1278
  return P
1029
1279
  end
1030
1280
  --
1031
- core_src_lib_engine_raw_memory = function()
1281
+ src_lib_engine_raw_memory_561fa16caab0 = function()
1032
1282
  local memory_dict_unload = {}
1033
1283
  local memory_dict = {}
1034
1284
  local memory_list = {}
@@ -1077,7 +1327,7 @@ install=install
1077
1327
  return P
1078
1328
  end
1079
1329
  --
1080
- core_src_lib_object_root = function()
1330
+ src_lib_object_root_561fa16cb030 = function()
1081
1331
  local P = {
1082
1332
  data={
1083
1333
  width=1280,
@@ -1089,13 +1339,14 @@ title='',
1089
1339
  author='',
1090
1340
  company='',
1091
1341
  description='',
1342
+ tizen_package='',
1092
1343
  version=''
1093
1344
  },
1094
1345
  config = {
1095
1346
  offset_x = 0,
1096
1347
  offset_y = 0,
1097
1348
  require = '',
1098
- fps_max = 100,
1349
+ fps_max = 60,
1099
1350
  fps_show = 0,
1100
1351
  fps_drop = 5,
1101
1352
  fps_time = 5
@@ -1106,7 +1357,7 @@ callbacks={
1106
1357
  return P;
1107
1358
  end
1108
1359
  --
1109
- core_src_lib_object_color = function()
1360
+ src_lib_object_color_561fa16d0260 = function()
1110
1361
  local white = 0xFFFFFFFF
1111
1362
  local lightgray = 0xC8CCCCFF
1112
1363
  local gray = 0x828282FF
@@ -1168,7 +1419,7 @@ install = install
1168
1419
  return P
1169
1420
  end
1170
1421
  --
1171
- core_src_lib_object_std = function()
1422
+ src_lib_object_std_561fa16c9dc0 = function()
1172
1423
  local P = {
1173
1424
  milis = 0,
1174
1425
  delta = 0,
@@ -1229,7 +1480,7 @@ d=false
1229
1480
  return P;
1230
1481
  end
1231
1482
  --
1232
- core_src_lib_util_pipeline = function()
1483
+ src_lib_util_pipeline_561fa16c26b0 = function()
1233
1484
  local function pipe(self)
1234
1485
  return function()
1235
1486
  self:run()
@@ -1279,7 +1530,7 @@ run=run
1279
1530
  return P
1280
1531
  end
1281
1532
  --
1282
- core_src_lib_util_decorator = function()
1533
+ src_lib_util_decorator_561fa16bfce0 = function()
1283
1534
  local function decorator_prefix3(zig, zag, zom, func)
1284
1535
  return function (a, b, c, d, e, f)
1285
1536
  return func(zig, zag, zom, a, b, c, d, e, f)
@@ -1329,4 +1580,4 @@ prefix1 = decorator_prefix1
1329
1580
  return P
1330
1581
  end
1331
1582
  --
1332
- return main()
1583
+ return main_561fa16ca3f0()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamely/gly-engine-lite",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "author": "RodrigoDornelles",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.gamely.com.br",