@gamely/gly-engine-lite 0.0.20 → 0.1.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.
Files changed (2) hide show
  1. package/dist/main.lua +175 -117
  2. package/package.json +4 -3
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 src_version_55789ed81210 = nil
3
- local src_lib_common_module_55789ed58c40 = nil
4
- local src_lib_engine_api_encoder_55789ed92660 = nil
5
- local src_lib_engine_api_app_55789eda8c90 = nil
6
- local src_lib_engine_api_hash_55789ed5fba0 = nil
7
- local src_lib_engine_api_http_55789ed73940 = nil
8
- local src_lib_engine_api_i18n_55789ed73390 = nil
9
- local src_lib_engine_api_key_55789ed67430 = nil
10
- local src_lib_engine_api_log_55789ed6ec50 = nil
11
- local src_lib_engine_api_math_55789ed97690 = nil
12
- local src_lib_engine_api_array_55789ed6a870 = nil
13
- local src_lib_engine_api_media_55789ed5bbd0 = nil
14
- local src_lib_engine_draw_fps_55789edb30e0 = nil
15
- local src_lib_engine_draw_text_55789ed7cb30 = nil
16
- local src_lib_engine_draw_poly_55789ed758d0 = nil
17
- local src_lib_engine_raw_memory_55789ed6cc30 = nil
18
- local src_lib_protocol_http_callback_55789ed506b0 = nil
19
- local src_lib_object_root_55789ed7d4c0 = nil
20
- local src_lib_object_color_55789edbd130 = nil
21
- local src_lib_object_std_55789ed51260 = nil
22
- local src_lib_util_pipeline_55789ed7d870 = nil
23
- local src_lib_util_decorator_55789ed6a3c0 = nil
24
- local src_lib_util_http_55789eda0210 = nil
25
- local function main_55789ed4b7f0()
26
- local version = src_version_55789ed81210()
27
- local zeebo_module = src_lib_common_module_55789ed58c40()
28
- local engine_encoder = src_lib_engine_api_encoder_55789ed92660()
29
- local engine_game = src_lib_engine_api_app_55789eda8c90()
30
- local engine_hash = src_lib_engine_api_hash_55789ed5fba0()
31
- local engine_http = src_lib_engine_api_http_55789ed73940()
32
- local engine_i18n = src_lib_engine_api_i18n_55789ed73390()
33
- local engine_key = src_lib_engine_api_key_55789ed67430()
34
- local engine_log = src_lib_engine_api_log_55789ed6ec50()
35
- local engine_math = src_lib_engine_api_math_55789ed97690()
36
- local engine_array = src_lib_engine_api_array_55789ed6a870()
37
- local engine_media = src_lib_engine_api_media_55789ed5bbd0()
38
- local engine_draw_fps = src_lib_engine_draw_fps_55789edb30e0()
39
- local engine_draw_text = src_lib_engine_draw_text_55789ed7cb30()
40
- local engine_draw_poly = src_lib_engine_draw_poly_55789ed758d0()
41
- local engine_raw_memory = src_lib_engine_raw_memory_55789ed6cc30()
42
- local callback_http = src_lib_protocol_http_callback_55789ed506b0()
43
- local application_default = src_lib_object_root_55789ed7d4c0()
44
- local color = src_lib_object_color_55789edbd130()
45
- local std = src_lib_object_std_55789ed51260()
2
+ local source_version_55b12fccc2f0 = nil
3
+ local source_shared_module_55b12fccb780 = nil
4
+ local source_engine_api_data_encoder_55b12fcbbfb0 = nil
5
+ local source_engine_api_system_app_55b12fcbbe60 = nil
6
+ local source_engine_api_data_hash_55b12fca97d0 = nil
7
+ local source_engine_api_io_http_55b12fcbc6a0 = nil
8
+ local source_engine_api_data_i18n_55b12fccb930 = nil
9
+ local source_engine_api_system_key_55b12fccb710 = nil
10
+ local source_engine_api_debug_log_55b12fcdc150 = nil
11
+ local source_engine_api_system_math_55b12fcd9b60 = nil
12
+ local source_engine_api_data_array_55b12fcdac30 = nil
13
+ local source_engine_api_io_media_55b12fccdcc0 = nil
14
+ local source_engine_api_draw_fps_55b12fcc92c0 = nil
15
+ local source_engine_api_draw_text_55b12fcc8aa0 = nil
16
+ local source_engine_api_draw_poly_55b12fcc9100 = nil
17
+ local source_engine_api_raw_memory_55b12fc62480 = nil
18
+ local source_engine_protocol_http_callback_55b12fca1ac0 = nil
19
+ local source_shared_var_object_root_55b12fcb7d70 = nil
20
+ local source_engine_api_system_color_55b12fcb8930 = nil
21
+ local source_shared_var_object_std_55b12fcb96a0 = nil
22
+ local source_shared_functional_pipeline_55b12fc71770 = nil
23
+ local source_shared_functional_decorator_55b12fc834b0 = nil
24
+ local source_shared_string_encode_http_55b12fc78030 = nil
25
+ local source_shared_string_encode_url_55b12fc82be0 = nil
26
+ local function main_55b12fccbf90()
27
+ local version = source_version_55b12fccc2f0()
28
+ local zeebo_module = source_shared_module_55b12fccb780()
29
+ local engine_encoder = source_engine_api_data_encoder_55b12fcbbfb0()
30
+ local engine_game = source_engine_api_system_app_55b12fcbbe60()
31
+ local engine_hash = source_engine_api_data_hash_55b12fca97d0()
32
+ local engine_http = source_engine_api_io_http_55b12fcbc6a0()
33
+ local engine_i18n = source_engine_api_data_i18n_55b12fccb930()
34
+ local engine_key = source_engine_api_system_key_55b12fccb710()
35
+ local engine_log = source_engine_api_debug_log_55b12fcdc150()
36
+ local engine_math = source_engine_api_system_math_55b12fcd9b60()
37
+ local engine_array = source_engine_api_data_array_55b12fcdac30()
38
+ local engine_media = source_engine_api_io_media_55b12fccdcc0()
39
+ local engine_api_draw_fps = source_engine_api_draw_fps_55b12fcc92c0()
40
+ local engine_api_draw_text = source_engine_api_draw_text_55b12fcc8aa0()
41
+ local engine_api_draw_poly = source_engine_api_draw_poly_55b12fcc9100()
42
+ local engine_raw_memory = source_engine_api_raw_memory_55b12fc62480()
43
+ local callback_http = source_engine_protocol_http_callback_55b12fca1ac0()
44
+ local application_default = source_shared_var_object_root_55b12fcb7d70()
45
+ local color = source_engine_api_system_color_55b12fcb8930()
46
+ local std = source_shared_var_object_std_55b12fcb96a0()
46
47
  local application = application_default
47
48
  local engine = {
48
49
  keyboard = function(a, b, c, d) end,
@@ -61,9 +62,11 @@ local cfg_media = {
61
62
  bootstrap=native_media_bootstrap,
62
63
  position=native_media_position,
63
64
  resize=native_media_resize,
65
+ resume=native_media_resume,
66
+ source=native_media_source,
64
67
  pause=native_media_pause,
65
- load=native_media_load,
66
- play=native_media_play
68
+ play=native_media_play,
69
+ stop=native_media_stop
67
70
  }
68
71
  local cfg_poly = {
69
72
  repeats = {
@@ -166,9 +169,9 @@ zeebo_module.require(std, application, engine)
166
169
  :package('@math', engine_math)
167
170
  :package('@array', engine_array)
168
171
  :package('@key', engine_key, {})
169
- :package('@draw.fps', engine_draw_fps)
170
- :package('@draw.text', engine_draw_text, cfg_text)
171
- :package('@draw.poly', engine_draw_poly, cfg_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)
172
175
  :package('@color', color)
173
176
  :package('@log', engine_log, cfg_log)
174
177
  :package('math', engine_math.clib)
@@ -181,7 +184,6 @@ zeebo_module.require(std, application, engine)
181
184
  :package('i18n', engine_i18n, cfg_system)
182
185
  :package('hash', engine_hash, cfg_system)
183
186
  :package('media.video', engine_media, cfg_media)
184
- :package('media.audio', engine_media, cfg_media)
185
187
  :package('mock.video', engine_media)
186
188
  :package('mock.audio', engine_media)
187
189
  :run()
@@ -201,13 +203,13 @@ version=version
201
203
  }
202
204
  return P
203
205
  end
204
- src_version_55789ed81210 = function()
205
- return '0.0.20'
206
+ source_version_55b12fccc2f0 = function()
207
+ return '0.1.0'
206
208
  end
207
209
  --
208
- src_lib_common_module_55789ed58c40 = function()
209
- local zeebo_pipeline = src_lib_util_pipeline_55789ed7d870()
210
- local application_default = src_lib_object_root_55789ed7d4c0()
210
+ source_shared_module_55b12fccb780 = function()
211
+ local zeebo_pipeline = source_shared_functional_pipeline_55b12fc71770()
212
+ local application_default = source_shared_var_object_root_55b12fcb7d70()
211
213
  local function default(application, defaults)
212
214
  if not application then return nil end
213
215
  local index = 1
@@ -225,6 +227,7 @@ end
225
227
  index = index + 1
226
228
  end
227
229
  normalized_aplication.config.id = tostring(application)
230
+ normalized_aplication.fonts = application.fonts or {}
228
231
  normalized_aplication.assets = application.assets or {}
229
232
  if application.callbacks then
230
233
  for event, handler in pairs(application.callbacks) do
@@ -247,6 +250,7 @@ end
247
250
  local normalized_aplication = {
248
251
  data = {},
249
252
  meta = {},
253
+ fonts = {},
250
254
  assets = {},
251
255
  config = {},
252
256
  callbacks = {}
@@ -254,6 +258,8 @@ callbacks = {}
254
258
  for key, value in pairs(application) do
255
259
  if key == 'assets' then
256
260
  normalized_aplication.assets = value
261
+ elseif key == 'fonts' then
262
+ normalized_aplication.fonts = value
257
263
  elseif application_default.meta[key] then
258
264
  normalized_aplication.meta[key] = value
259
265
  elseif application_default.config[key] then
@@ -405,7 +411,7 @@ require = require
405
411
  return P
406
412
  end
407
413
  --
408
- src_lib_engine_api_encoder_55789ed92660 = function()
414
+ source_engine_api_data_encoder_55b12fcbbfb0 = function()
409
415
  local function install(std, engine, library, name)
410
416
  std = std or {}
411
417
  std[name] = {
@@ -420,8 +426,8 @@ install=install
420
426
  return P
421
427
  end
422
428
  --
423
- src_lib_engine_api_app_55789eda8c90 = function()
424
- local util_decorator = src_lib_util_decorator_55789ed6a3c0()
429
+ source_engine_api_system_app_55b12fcbbe60 = function()
430
+ local util_decorator = source_shared_functional_decorator_55b12fc834b0()
425
431
  local function reset(std, engine)
426
432
  if std.node then
427
433
  std.bus.emit('exit')
@@ -461,17 +467,15 @@ install=install
461
467
  return P
462
468
  end
463
469
  --
464
- src_lib_engine_api_hash_55789ed5fba0 = function()
470
+ source_engine_api_data_hash_55b12fca97d0 = function()
465
471
  local function djb2(digest)
466
472
  local index = 1
467
473
  local hash = 5381
468
474
  while index <= #digest do
469
475
  local char = string.byte(digest, index)
470
- hash = (hash * 33) + char
476
+ hash = (hash * 33 + char) % 4294967296
471
477
  index = index + 1
472
478
  end
473
- hash = string.format('%08x', hash)
474
- hash = tonumber(hash:sub(#hash - 7), 16)
475
479
  return hash
476
480
  end
477
481
  local function install(std, engine, cfg_system)
@@ -487,26 +491,38 @@ install = install
487
491
  return P
488
492
  end
489
493
  --
490
- src_lib_engine_api_http_55789ed73940 = function()
491
- local zeebo_pipeline = src_lib_util_pipeline_55789ed7d870()
492
- local function fast(self)
493
- self.speed = '_fast'
494
+ source_engine_api_io_http_55b12fcbc6a0 = function()
495
+ local zeebo_pipeline = source_shared_functional_pipeline_55b12fc71770()
496
+ local function json(self)
497
+ self.options['json'] = true
494
498
  return self
495
499
  end
496
- local function body(self, content)
497
- self.body_content=content
500
+ local function noforce(self)
501
+ self.options['noforce'] = true
502
+ return self
503
+ end
504
+ local function fast(self)
505
+ self.speed = '_fast'
498
506
  return self
499
507
  end
500
508
  local function param(self, name, value)
501
509
  local index = #self.param_list + 1
502
- self.param_list[index] = name
503
- self.param_dict[name] = value
510
+ self.param_list[index] = tostring(name)
511
+ self.param_dict[name] = tostring(value)
504
512
  return self
505
513
  end
506
514
  local function header(self, name, value)
507
515
  local index = #self.header_list + 1
508
- self.header_list[index] = name
509
- self.header_dict[name] = value
516
+ self.header_list[index] = tostring(name)
517
+ self.header_dict[name] = tostring(value)
518
+ return self
519
+ end
520
+ local function body(self, content, json_encode)
521
+ if type(content) == 'table' then
522
+ header(self, 'Content-Type', 'application/json')
523
+ content = json_encode(content)
524
+ end
525
+ self.body_content=content
510
526
  return self
511
527
  end
512
528
  local function success(self, handler_func)
@@ -533,14 +549,15 @@ return function (url)
533
549
  if protocol.has_callback then
534
550
  engine.http_count = engine.http_count + 1
535
551
  end
536
- if protocol.force then
537
- url = url:gsub("^[^:]+://", protocol.force.."://")
538
- end
552
+ local json_encode = std.json and std.json.encode
553
+ local json_decode = std.json and std.json.decode
554
+ local http_body = function(self, content) return body(self, content, json_encode) end
539
555
  local game = engine.current.data
540
556
  local self = {
541
557
  id = engine.http_count,
542
558
  url = url,
543
559
  speed = '',
560
+ options = {},
544
561
  method = method,
545
562
  body_content = '',
546
563
  header_list = {},
@@ -551,7 +568,9 @@ success_handler = function (std, game) end,
551
568
  failed_handler = function (std, game) end,
552
569
  error_handler = function (std, game) end,
553
570
  fast = fast,
554
- body = body,
571
+ json = json,
572
+ noforce = noforce,
573
+ body = http_body,
555
574
  param = param,
556
575
  header = header,
557
576
  success = success,
@@ -570,10 +589,22 @@ std.http[key] = value
570
589
  end
571
590
  self.pipeline = {
572
591
  function()
592
+ if not protocol.force or self.options['noforce'] then return end
593
+ self.url = url:gsub("^[^:]+://", protocol.force.."://")
594
+ end,
595
+ function()
573
596
  if protocol.has_callback then engine.http_requests[self.id] = self end
574
597
  protocol.handler(self, self.id)
575
598
  end,
576
599
  function()
600
+ if self.options['json'] and json_decode and std.http.body then
601
+ pcall(function()
602
+ local new_body = json_decode(std.http.body)
603
+ std.http.body = new_body
604
+ end)
605
+ end
606
+ end,
607
+ function()
577
608
  callback_handler(std, game)
578
609
  if std.http.ok then
579
610
  self.success_handler(std, game)
@@ -591,6 +622,7 @@ std.http.ok = nil
591
622
  std.http.body = nil
592
623
  std.http.error = nil
593
624
  std.http.status = nil
625
+ std.http.body_is_table = nil
594
626
  end,
595
627
  function()
596
628
  if protocol.has_callback then engine.http_requests[self.id] = nil end
@@ -623,7 +655,7 @@ install=install
623
655
  return P
624
656
  end
625
657
  --
626
- src_lib_engine_api_i18n_55789ed73390 = function()
658
+ source_engine_api_data_i18n_55b12fccb930 = function()
627
659
  local language = 'en-US'
628
660
  local language_default = 'en-US'
629
661
  local language_list = {}
@@ -715,7 +747,7 @@ install=install
715
747
  return P
716
748
  end
717
749
  --
718
- src_lib_engine_api_key_55789ed67430 = function()
750
+ source_engine_api_system_key_55b12fccb710 = function()
719
751
  local function real_key(std, engine, rkey, rvalue)
720
752
  local value = rvalue == 1 or rvalue == true
721
753
  local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
@@ -755,8 +787,8 @@ install = install
755
787
  return P
756
788
  end
757
789
  --
758
- src_lib_engine_api_log_55789ed6ec50 = function()
759
- local util_decorator = src_lib_util_decorator_55789ed6a3c0()
790
+ source_engine_api_debug_log_55b12fcdc150 = function()
791
+ local util_decorator = source_shared_functional_decorator_55b12fc834b0()
760
792
  local logging_types = {
761
793
  'none', 'fatal', 'error', 'warn', 'debug', 'info'
762
794
  }
@@ -802,7 +834,7 @@ install = install
802
834
  return P
803
835
  end
804
836
  --
805
- src_lib_engine_api_math_55789ed97690 = function()
837
+ source_engine_api_system_math_55b12fcd9b60 = function()
806
838
  local function abs(value)
807
839
  if value < 0 then
808
840
  return -value
@@ -977,8 +1009,8 @@ install = install_clib_random
977
1009
  return P;
978
1010
  end
979
1011
  --
980
- src_lib_engine_api_array_55789ed6a870 = function()
981
- local util_decorator = src_lib_util_decorator_55789ed6a3c0()
1012
+ source_engine_api_data_array_55b12fcdac30 = function()
1013
+ local util_decorator = source_shared_functional_decorator_55b12fc834b0()
982
1014
  local function array_map(array, func)
983
1015
  local res = {}
984
1016
  local index = 1
@@ -1139,7 +1171,7 @@ install = install
1139
1171
  return P
1140
1172
  end
1141
1173
  --
1142
- src_lib_engine_api_media_55789ed5bbd0 = function()
1174
+ source_engine_api_io_media_55b12fccdcc0 = function()
1143
1175
  local function media_create(node, channels, handler)
1144
1176
  local decorator = function(func)
1145
1177
  func = func or function() end
@@ -1156,6 +1188,8 @@ resume = decorator(handler.resume),
1156
1188
  stop = decorator(handler.stop),
1157
1189
  position = decorator(handler.position),
1158
1190
  resize = decorator(handler.resize),
1191
+ in_mutex = handler.mutex or function() return false end,
1192
+ get_error = handler.error or function() return nil end,
1159
1193
  node = node,
1160
1194
  apply = function() end
1161
1195
  }
@@ -1166,6 +1200,9 @@ end
1166
1200
  local function install(std, engine, handler, name)
1167
1201
  std.media = std.media or {}
1168
1202
  local mediatype = name:match('%w+%.(%w+)')
1203
+ if handler.install then
1204
+ handler.install(std, engine, mediatype, name)
1205
+ end
1169
1206
  if not std.media[mediatype] then
1170
1207
  local channels = handler.bootstrap and handler.bootstrap(mediatype)
1171
1208
  if (not channels or channels == 0) and handler.bootstrap then
@@ -1181,7 +1218,7 @@ install=install
1181
1218
  return P
1182
1219
  end
1183
1220
  --
1184
- src_lib_engine_draw_fps_55789edb30e0 = function()
1221
+ source_engine_api_draw_fps_55b12fcc92c0 = function()
1185
1222
  local function draw_fps(std, engine, show, pos_x, pos_y)
1186
1223
  if show < 1 then return end
1187
1224
  local x = engine.current.config.offset_x + pos_x
@@ -1233,8 +1270,8 @@ install=install
1233
1270
  return P
1234
1271
  end
1235
1272
  --
1236
- src_lib_engine_draw_text_55789ed7cb30 = function()
1237
- local util_decorator = src_lib_util_decorator_55789ed6a3c0()
1273
+ source_engine_api_draw_text_55b12fcc8aa0 = function()
1274
+ local util_decorator = source_shared_functional_decorator_55b12fc834b0()
1238
1275
  local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
1239
1276
  size = size or 2
1240
1277
  local hem = engine.current.data.width / 80
@@ -1245,10 +1282,10 @@ std.text.font_size(font_size)
1245
1282
  std.text.print(pos_x * hem, pos_y * vem, text)
1246
1283
  font_previous()
1247
1284
  end
1248
- local function text_print_ex(std, engine, x, y, text, align)
1285
+ local function text_print_ex(std, engine, x, y, text, align_x, align_y)
1249
1286
  local w, h = std.text.mensure(text)
1250
- local aligns = {w, w/2, 0}
1251
- std.text.print(x - aligns[(align or 1) + 2], y, text)
1287
+ local aligns_x, aligns_y = {w, w/2, 0}, {h, h/2, 0}
1288
+ std.text.print(x - aligns_x[(align_x or 1) + 2], y - aligns_y[(align_y or 1) + 2], text)
1252
1289
  return w, h
1253
1290
  end
1254
1291
  local function install(std, engine, config)
@@ -1261,7 +1298,7 @@ install=install
1261
1298
  return P
1262
1299
  end
1263
1300
  --
1264
- src_lib_engine_draw_poly_55789ed758d0 = function()
1301
+ source_engine_api_draw_poly_55b12fcc9100 = function()
1265
1302
  local function decorator_poo(object, func)
1266
1303
  if not object or not func then return func end
1267
1304
  return function(a, b, c, d)
@@ -1368,7 +1405,7 @@ install=install
1368
1405
  return P
1369
1406
  end
1370
1407
  --
1371
- src_lib_engine_raw_memory_55789ed6cc30 = function()
1408
+ source_engine_api_raw_memory_55b12fc62480 = function()
1372
1409
  local memory_dict_unload = {}
1373
1410
  local memory_dict = {}
1374
1411
  local memory_list = {}
@@ -1423,8 +1460,9 @@ install=install
1423
1460
  return P
1424
1461
  end
1425
1462
  --
1426
- src_lib_protocol_http_callback_55789ed506b0 = function()
1427
- local http_util = src_lib_util_http_55789eda0210()
1463
+ source_engine_protocol_http_callback_55b12fca1ac0 = function()
1464
+ local str_http = source_shared_string_encode_http_55b12fc78030()
1465
+ local str_url = source_shared_string_encode_url_55b12fc82be0()
1428
1466
  local callbacks = {
1429
1467
  ['async-promise'] = function(self)
1430
1468
  return self:promise()
@@ -1436,7 +1474,7 @@ end,
1436
1474
  return self.url
1437
1475
  end,
1438
1476
  ['get-fullurl'] = function(self)
1439
- return self.url..http_util.url_search_param(self.param_list, self.param_dict)
1477
+ return self.url..str_url.search_param(self.param_list, self.param_dict)
1440
1478
  end,
1441
1479
  ['get-method'] = function(self)
1442
1480
  return self.method
@@ -1464,7 +1502,7 @@ return self.heeader_dict[self.data] or self.heeader_dict[self.header_list[self.d
1464
1502
  end,
1465
1503
  ['set-status'] = function(self, data)
1466
1504
  self.set('status', data)
1467
- self.set('ok', http_util.is_ok(data))
1505
+ self.set('ok', str_http.is_ok(data))
1468
1506
  end,
1469
1507
  ['set-error'] = function(self, data)
1470
1508
  self.set('error', data)
@@ -1491,7 +1529,7 @@ func = native_http_callback
1491
1529
  return P
1492
1530
  end
1493
1531
  --
1494
- src_lib_object_root_55789ed7d4c0 = function()
1532
+ source_shared_var_object_root_55b12fcb7d70 = function()
1495
1533
  local P = {
1496
1534
  data={
1497
1535
  width=1280,
@@ -1521,7 +1559,7 @@ callbacks={
1521
1559
  return P;
1522
1560
  end
1523
1561
  --
1524
- src_lib_object_color_55789edbd130 = function()
1562
+ source_engine_api_system_color_55b12fcb8930 = function()
1525
1563
  local function install(std)
1526
1564
  std.color = std.color or {}
1527
1565
  std.color.white = 0xFFFFFFFF
@@ -1556,7 +1594,7 @@ install = install
1556
1594
  return P
1557
1595
  end
1558
1596
  --
1559
- src_lib_object_std_55789ed51260 = function()
1597
+ source_shared_var_object_std_55b12fcb96a0 = function()
1560
1598
  local P = {
1561
1599
  milis = 0,
1562
1600
  delta = 0,
@@ -1622,7 +1660,7 @@ any=false
1622
1660
  return P;
1623
1661
  end
1624
1662
  --
1625
- src_lib_util_pipeline_55789ed7d870 = function()
1663
+ source_shared_functional_pipeline_55b12fc71770 = function()
1626
1664
  local function pipe(self)
1627
1665
  return function()
1628
1666
  self:run()
@@ -1672,7 +1710,7 @@ run=run
1672
1710
  return P
1673
1711
  end
1674
1712
  --
1675
- src_lib_util_decorator_55789ed6a3c0 = function()
1713
+ source_shared_functional_decorator_55b12fc834b0 = function()
1676
1714
  local function decorator_prefix3(zig, zag, zom, func)
1677
1715
  return function (a, b, c, d, e, f)
1678
1716
  return func(zig, zag, zom, a, b, c, d, e, f)
@@ -1730,7 +1768,7 @@ prefix1_t = table_prefix1
1730
1768
  return P
1731
1769
  end
1732
1770
  --
1733
- src_lib_util_http_55789eda0210 = function()
1771
+ source_shared_string_encode_http_55b12fc78030 = function()
1734
1772
  local function is_ok(status)
1735
1773
  return (status and 200 <= status and status < 300) or false
1736
1774
  end
@@ -1742,20 +1780,17 @@ end
1742
1780
  local function is_redirect(status)
1743
1781
  return (status and 300 <= status and status < 400) or false
1744
1782
  end
1745
- local function url_search_param(param_list, param_dict)
1746
- local index, params = 1, ''
1747
- while param_list and param_dict and index <= #param_list do
1748
- local param = param_list[index]
1749
- local value = param_dict[param]
1750
- if #params == 0 then
1751
- params = params..'?'
1752
- else
1753
- params = params..'&'
1754
- end
1755
- params = params..param..'='..(value or '')
1756
- index = index + 1
1783
+ local function get_content(response)
1784
+ local header, body = response:match("^(.-\r\n\r\n)(.*)")
1785
+ if not header or not body then return nil end
1786
+ local content_length = tonumber(header:match("Content%-Length:%s*(%d+)"))
1787
+ if not content_length then return nil end
1788
+ if #body < content_length then return nil end
1789
+ local content = body:sub(1, content_length)
1790
+ return content
1757
1791
  end
1758
- return params
1792
+ local function get_user_agent()
1793
+ return 'Ginga (GlyOS;SmartTv/Linux)'
1759
1794
  end
1760
1795
  local function create_request(method, uri)
1761
1796
  local self = {
@@ -1874,9 +1909,32 @@ return {
1874
1909
  is_ok=is_ok,
1875
1910
  is_ok_header=is_ok_header,
1876
1911
  is_redirect=is_redirect,
1877
- url_search_param=url_search_param,
1912
+ get_content=get_content,
1913
+ get_user_agent=get_user_agent,
1878
1914
  create_request=create_request
1879
1915
  }
1880
1916
  end
1881
1917
  --
1882
- return main_55789ed4b7f0()
1918
+ source_shared_string_encode_url_55b12fc82be0 = 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_55b12fccbf90()
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@gamely/gly-engine-lite",
3
- "version": "0.0.20",
3
+ "version": "0.1.0",
4
4
  "author": "RodrigoDornelles",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.gamely.com.br",
7
- "repository": "https://github.com/gamelly/gly-engine",
7
+ "repository": "https://github.com/gly-engine/gly-engine",
8
8
  "funding": "https://github.com/sponsors/RodrigoDornelles",
9
- "bugs": "https://github.com/gamelly/gly-engine/issues",
9
+ "bugs": "https://github.com/gly-engine/gly-engine/issues",
10
10
  "description": "Game Engine written in 100% lua that runs in a vacuum.",
11
11
  "main": "dist/main.lua",
12
+ "browser": "dist/main.lua",
12
13
  "types": "types/main.d.ts",
13
14
  "keywords": [
14
15
  "game engine",